Skip to content

Commit

Permalink
ci: use cargo insta to run tests (#3220)
Browse files Browse the repository at this point in the history
  • Loading branch information
meskill authored Dec 11, 2024
1 parent 0f3721b commit 0b05b83
Show file tree
Hide file tree
Showing 959 changed files with 979 additions and 72 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.setup_build_matrix.outputs.matrix) }}

env:
WITH_COVERAGE: ${{ matrix.build == 'darwin-arm64' }}

steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -164,15 +167,28 @@ jobs:
}
echo "$(Resolve-Path nasm-2.16.02)" >> $env:GITHUB_PATH
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Install insta test runner
if: ${{ env.WITH_COVERAGE == 'false' && matrix.test != 'false' }}
uses: taiki-e/install-action@v2
with:
tool: cargo-insta

- name: Run cargo insta test
if: ${{ env.WITH_COVERAGE == 'false' && matrix.test != 'false' }}
run: cargo insta test --unreferenced reject --workspace --target ${{ matrix.target }}

- name: Install llvm-cov test runner
if: ${{ env.WITH_COVERAGE == 'true' && matrix.test != 'false' }}
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov

- name: Run Cargo Test
if: matrix.test != 'false'
# TODO: run llvm-cov only for single build since other builds are not sent to codecov anyway
- name: Run cargo llvm-cov test
if: ${{ env.WITH_COVERAGE == 'true' && matrix.test != 'false' }}
run: cargo llvm-cov --workspace ${{ matrix.features }} --lcov --target ${{ matrix.target }} --output-path lcov.info

- name: Upload Coverage to Codecov
if: matrix.build == 'darwin-arm64'
if: ${{ env.WITH_COVERAGE == 'true' && matrix.test != 'false' }}
uses: Wandalen/wretry.action@v3
with:
action: codecov/codecov-action@v4
Expand Down
66 changes: 0 additions & 66 deletions .github/workflows/test-jit.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/generator/config.rs
expression: actual
snapshot_kind: text
---
{
"inputs": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/llm/infer_type_name.rs
expression: answer
snapshot_kind: text
---
Answer {
suggestions: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/cli/llm/infer_type_name.rs
expression: request
snapshot_kind: text
---
ChatRequest {
system: None,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/blueprint/index.rs
expression: index
snapshot_kind: text
---
Index {
map: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/config_module/merge.rs
expression: merged.unwrap_err()
snapshot_kind: text
---
Validation Error
Enum is used as input type in one subgraph and output type in another [enumOutput]
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/config_module/merge.rs
expression: merged.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/config_module/merge.rs
expression: merged.unwrap_err()
snapshot_kind: text
---
Validation Error
Type mismatch: expected `String`, got `Int` [A, a]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/config_module/merge.rs
expression: merged.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/config_module/merge.rs
expression: merged.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/core/config/npo/tracker.rs
expression: actual
snapshot_kind: text
---

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/core/config/npo/tracker.rs
expression: actual
snapshot_kind: text
---

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/core/config/npo/tracker.rs
expression: actual
snapshot_kind: text
---
query { f1 { f1 { f2 } } }
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/core/config/npo/tracker.rs
expression: actual
snapshot_kind: text
---
query { f1 { f2 } }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/npo/tracker.rs
expression: actual
snapshot_kind: text
---
query { t2 { t2 { n } } }
query { t2_ls { t2 } }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/npo/tracker.rs
expression: actual
snapshot_kind: text
---
query { bar { spam } }
query { buzz { spam } }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/core/config/npo/tracker.rs
expression: actual
snapshot_kind: text
---

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/core/config/npo/tracker.rs
expression: actual
snapshot_kind: text
---
query { f1 { f2 { f3 { f4 } } } }
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/core/config/npo/tracker.rs
expression: actual
snapshot_kind: text
---
query { f1 { f2 { f3 { f4 } } } }
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/core/config/npo/tracker.rs
expression: actual
snapshot_kind: text
---

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: src/core/config/npo/tracker.rs
expression: actual
snapshot_kind: text
---
query { f1 { f2 } }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/merge_types/type_merger.rs
expression: config.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/merge_types/type_merger.rs
expression: config.to_sdl()
snapshot_kind: text
---
type T1 {
a: Int
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/merge_types/type_merger.rs
expression: config.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/merge_types/type_merger.rs
expression: config.to_sdl()
snapshot_kind: text
---
interface GEN__M1 {
a: Int
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/merge_types/type_merger.rs
expression: config.to_sdl()
snapshot_kind: text
---
schema @server(hostname: "0.0.0.0", port: 8000) @upstream(httpCache: 42) {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/merge_types/type_merger.rs
expression: config.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/merge_types/type_merger.rs
expression: config.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/merge_types/type_merger.rs
expression: config.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/ambiguous_type.rs
expression: config.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/ambiguous_type.rs
expression: config.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/flatten_single_field.rs
expression: transformed_config.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/improve_type_names.rs
expression: transformed_config.to_sdl()
snapshot_kind: text
---
schema @server(hostname: "0.0.0.0", port: 8000) @upstream(httpCache: 42) {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/improve_type_names.rs
expression: transformed_config.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/improve_type_names.rs
expression: transformed_config.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/nested_unions.rs
expression: config.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/nested_unions.rs
expression: error
snapshot_kind: text
---
Validation Error
Recursive type U1 [U]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/core/config/transformer/rename_types.rs
expression: result.to_sdl()
snapshot_kind: text
---
schema @server @upstream {
query: Query
Expand Down
Loading

1 comment on commit 0b05b83

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running 30s test @ http://localhost:8000/graphql

4 threads and 100 connections

Thread Stats Avg Stdev Max +/- Stdev
Latency 4.10ms 1.90ms 29.77ms 77.94%
Req/Sec 6.24k 806.94 7.26k 93.42%

745671 requests in 30.02s, 3.74GB read

Requests/sec: 24838.57

Transfer/sec: 127.49MB

Please sign in to comment.