feat(router): subgraph error masking #6374
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| actions: write | |
| contents: write | |
| issues: read | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| unit: | |
| name: test / unit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: setup rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 | |
| - uses: ./.github/actions/install-tools | |
| - name: test all | |
| run: cargo test_all | |
| timeout-minutes: 5 | |
| env: | |
| RUST_BACKTRACE: full | |
| RUST_LOG: debug | |
| e2e: | |
| name: test / e2e | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: setup rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 | |
| - uses: ./.github/actions/install-tools | |
| - name: test e2e | |
| run: cargo test_e2e | |
| timeout-minutes: 10 | |
| env: | |
| RUST_BACKTRACE: full | |
| RUST_LOG: debug | |
| plugin_examples: | |
| name: test / plugin examples | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 | |
| - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 | |
| with: | |
| shared-key: ${{ hashFiles('**/Cargo.lock') }} | |
| - uses: ./.github/actions/install-tools | |
| - name: test plugin examples | |
| run: cargo test_plugin_examples | |
| timeout-minutes: 10 | |
| working-directory: plugin_examples | |
| env: | |
| RUST_BACKTRACE: full | |
| RUST_LOG: debug | |
| node-addon-test: | |
| name: test / node-addon | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: setup node | |
| uses: the-guild-org/shared-config/setup@v1 | |
| with: | |
| node-version-file: .node-version | |
| - name: build | |
| run: npm run build:debug | |
| working-directory: lib/node-addon | |
| - name: test | |
| working-directory: lib/node-addon | |
| run: npm test | |
| build: | |
| name: check / build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: setup rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 | |
| - name: build | |
| run: cargo build --release | |
| fmt: | |
| name: check / fmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: setup rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 | |
| with: | |
| components: rustfmt | |
| - name: cargo fmt | |
| uses: actions-rust-lang/rustfmt@4066006ec54a31931b9b1fddfd38f2fdf2d27143 # v1 | |
| clippy: | |
| name: check / clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: setup rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 | |
| with: | |
| components: clippy | |
| - name: cargo clippy | |
| run: cargo clippy --all | |
| benchmark: | |
| strategy: | |
| matrix: | |
| include: | |
| - name: "graphql-tools" | |
| package: "./lib/graphql-tools" | |
| - name: "query-planner" | |
| package: "./lib/query-planner" | |
| - name: "executor" | |
| package: "./lib/executor" | |
| - name: "router" | |
| package: "./bin/router" | |
| name: benchmark / ${{ matrix.name }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: setup rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 | |
| - if: matrix.name == 'executor' | |
| name: Build subgraphs | |
| run: cargo build --release -p subgraphs | |
| - if: matrix.name == 'executor' | |
| name: Run subgraphs | |
| run: ./target/release/subgraphs & sleep 5 | |
| - name: Run benchmarks | |
| run: cargo bench | |
| working-directory: ${{ matrix.package }} | |
| - name: Upload benchmark results | |
| if: always() # Upload results even if benchmarks fail | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: ${{matrix.package}}-benchmark-results | |
| path: ${{matrix.package}}/target/criterion | |
| router-benchmark: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: "default" | |
| args: "" | |
| package: "hive-router" | |
| binary: "hive_router" | |
| config: "bench/configs/default.config.yaml" | |
| compare_with_default: true | |
| - name: "dedupe-inbound" | |
| args: "" | |
| package: "hive-router" | |
| binary: "hive_router" | |
| config: "bench/configs/dedupe-inbound.config.yaml" | |
| compare_with_default: false | |
| - name: "no-dedupe" | |
| args: "" | |
| package: "hive-router" | |
| binary: "hive_router" | |
| config: bench/configs/no-deduplication.config.yaml | |
| compare_with_default: false | |
| - name: "hive-tracing" | |
| # turns otlp http/grpc to noop | |
| args: "--features noop_otlp_exporter" | |
| package: "hive-router" | |
| binary: "hive_router" | |
| config: bench/configs/hive-tracing.config.yaml | |
| compare_with_default: false | |
| - name: "otel" | |
| # turns otlp http/grpc to noop | |
| args: "--features noop_otlp_exporter" | |
| package: "hive-router" | |
| binary: "hive_router" | |
| config: bench/configs/otel.config.yaml | |
| compare_with_default: false | |
| - name: "plugins" | |
| args: "" | |
| package: "plugin-template" | |
| binary: "hive_router_with_plugin" | |
| config: "bench/configs/plugins.config.yaml" | |
| compare_with_default: true | |
| - name: "persisted-documents" | |
| args: "" | |
| package: "hive-router" | |
| binary: "hive_router" | |
| config: "bench/configs/persisted-documents.config.yaml" | |
| compare_with_default: true | |
| name: benchmark / router / ${{ matrix.name }} | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_NO_WARNINGS: true | |
| NODE_ENV: production | |
| GITHUB_PR: ${{ github.event.number }} | |
| GITHUB_SHA: ${{ github.sha }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: setup rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 | |
| - name: Setup wrk | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y wrk | |
| - name: Build subgraphs | |
| run: cargo build --release -p subgraphs | |
| - name: Run subgraphs | |
| run: ./target/release/subgraphs & sleep 5 | |
| - name: Build router | |
| run: cargo build --release -p ${{ matrix.package }} ${{matrix.args}} | |
| - name: Run router | |
| run: | | |
| ./target/release/${{ matrix.binary }} & | |
| echo "$!" > router.pid | |
| sleep 5 | |
| env: | |
| ROUTER_CONFIG_FILE_PATH: ${{matrix.config}} | |
| - name: Run benchmark for ${{ github.ref }} | |
| if: github.event_name == 'pull_request' | |
| run: ./bench/run-benchmark.sh | |
| env: | |
| SUMMARY_PATH: ./bench/results/pr | |
| BENCH_PERSISTED_MODE: ${{ matrix.name == 'persisted-documents' && 'true' || '' }} | |
| BENCH_DOCUMENT_ID: ${{ matrix.name == 'persisted-documents' && 'bench_test_query' || '' }} | |
| - name: Checkout main branch in a separate directory | |
| if: github.event_name == 'pull_request' | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| ref: main | |
| path: main-branch | |
| - name: Build router from main branch w/ default config | |
| if: github.event_name == 'pull_request' && matrix.compare_with_default == true | |
| run: cargo build --release -p hive-router | |
| working-directory: main-branch | |
| - name: Run router from main branch w/ default config | |
| if: github.event_name == 'pull_request' && matrix.compare_with_default == true | |
| run: | | |
| kill $(cat router.pid) | |
| ./main-branch/target/release/hive_router & | |
| sleep 5 | |
| env: | |
| ROUTER_CONFIG_FILE_PATH: bench/configs/default.config.yaml | |
| - name: Build router from main branch w/ ${{ matrix.config }} config | |
| if: github.event_name == 'pull_request' && matrix.compare_with_default == false | |
| run: cargo build --release -p ${{ matrix.package }} ${{matrix.args}} | |
| working-directory: main-branch | |
| - name: Run router from main branch w/ ${{ matrix.config }} config | |
| if: github.event_name == 'pull_request' && matrix.compare_with_default == false | |
| run: | | |
| kill $(cat router.pid) | |
| ./main-branch/target/release/${{ matrix.binary }} & | |
| sleep 5 | |
| env: | |
| ROUTER_CONFIG_FILE_PATH: ${{matrix.config}} | |
| - name: Run benchmark for main | |
| if: github.event_name == 'pull_request' | |
| run: ./bench/run-benchmark.sh | |
| env: | |
| SUMMARY_PATH: ./bench/results/main | |
| - name: Compare benchmark results | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| chmod +x ./bench/ci-detect-regression.sh | |
| ./bench/ci-detect-regression.sh | |
| differential: | |
| name: test / differential | |
| runs-on: ubuntu-latest | |
| env: | |
| NODE_NO_WARNINGS: true | |
| NODE_ENV: production | |
| GRAPHQL_DIFF_QUERIES: 250 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 | |
| - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 | |
| with: | |
| shared-key: ${{ hashFiles('**/Cargo.lock') }} | |
| - name: setup node | |
| uses: the-guild-org/shared-config/setup@v1 | |
| with: | |
| node-version-file: .node-version | |
| - name: build resources | |
| run: | | |
| cargo build -p subgraphs | |
| cargo build -p hive-router | |
| - name: Run subgraphs | |
| run: | | |
| ./target/debug/subgraphs & | |
| echo "$!" > subgraphs.pid | |
| sleep 5 | |
| - name: Run router | |
| run: | | |
| ./target/debug/hive_router & | |
| echo "$!" > router.pid | |
| sleep 5 | |
| env: | |
| ROUTER_CONFIG_FILE_PATH: bench/configs/default.config.yaml | |
| - name: Run monolith baseline | |
| run: | | |
| npm start --workspace=monolith-js & | |
| echo "$!" > monolith.pid | |
| sleep 5 | |
| - name: Run differential test | |
| run: | | |
| cargo run -p graphql-differential -- \ | |
| http://localhost:4300/graphql \ | |
| http://localhost:4000/graphql \ | |
| bench/schema.graphql | |
| timeout-minutes: 5 | |
| - name: Stop services | |
| if: always() | |
| run: | | |
| for pid_file in monolith.pid router.pid subgraphs.pid; do | |
| if [ -f "$pid_file" ]; then | |
| kill "$(cat "$pid_file")" 2>/dev/null || true | |
| fi | |
| done | |
| - name: Upload failed test cases | |
| if: failure() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: differential-failed-tests | |
| path: failed-tests/ | |
| graphql-over-http: | |
| name: test / graphql-over-http | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: setup rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 | |
| - name: setup node | |
| uses: the-guild-org/shared-config/setup@v1 | |
| with: | |
| node-version-file: .node-version | |
| - name: Run Audits | |
| run: npm run ci:test:graphql-over-http | |
| working-directory: audits | |
| federation-audit: | |
| name: test / federation-audit | |
| runs-on: ubuntu-latest | |
| env: | |
| GATEWAY_TIMEOUT: 1800000 # 30 minutes, to prevent CI timeout for long-running tests | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: setup rust | |
| uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 | |
| - name: setup node | |
| uses: the-guild-org/shared-config/setup@v1 | |
| with: | |
| node-version-file: .node-version | |
| - name: Run Audits | |
| run: npm run test:federation-all | |
| working-directory: audits | |
| continue-on-error: true # continue even if the test fails | |
| - name: Upload logs | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: federation-audit-logs | |
| path: | | |
| ./audits/logs/*.log | |
| - name: Run Audits (experimental_abstract_type_folding) | |
| run: npm run test:federation-all | |
| env: | |
| QUERY_PLANNER_EXPERIMENTAL_ABSTRACT_TYPE_FOLDING: true | |
| working-directory: audits | |
| continue-on-error: true # continue even if the test fails |