Skip to content

enhance(router): simplify error handling in the request handler #3675

enhance(router): simplify error handling in the request handler

enhance(router): simplify error handling in the request handler #3675

Workflow file for this run

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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- name: test e2e
run: cargo test_e2e
timeout-minutes: 60
env:
RUST_BACKTRACE: full
RUST_LOG: debug
node-addon-test:
name: test / node-addon
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- name: build
run: cargo build --release
fmt:
name: check / fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # 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: benchmark / ${{ matrix.name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # 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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: ${{matrix.package}}-benchmark-results
path: ${{matrix.package}}/target/criterion
router-benchmark:
strategy:
matrix:
include:
- name: "default"
args: ""
config: bench/configs/default.config.yaml
- name: "no-dedupe"
args: ""
config: bench/configs/no-deduplication.config.yaml
- name: "hive-tracing"
# turns otlp http/grpc to noop
args: "--features noop_otlp_exporter"
config: bench/configs/hive-tracing.config.yaml
- name: "otlp-tracing"
# turns otlp http/grpc to noop
args: "--features noop_otlp_exporter"
config: bench/configs/otlp-tracing.config.yaml
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- name: Setup K6
run: |
wget https://github.com/grafana/k6/releases/download/v0.37.0/k6-v0.37.0-linux-amd64.deb
sudo apt-get update
sudo apt-get install ./k6-v0.37.0-linux-amd64.deb
- 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 hive-router ${{matrix.args}}
- name: Run router
run: |
./target/release/hive_router &
echo "$!" > router.pid
sleep 5
env:
ROUTER_CONFIG_FILE_PATH: ${{matrix.config}}
- name: Run k6 benchmark for ${{ github.ref }}
if: github.event_name == 'pull_request'
run: k6 run -e SUMMARY_PATH=./bench/results/pr bench/k6.js
- name: Checkout main branch in a separate directory
if: github.event_name == 'pull_request'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: main
path: main-branch
- name: Build router
if: github.event_name == 'pull_request'
run: cargo build --release -p hive-router ${{matrix.args}}
working-directory: main-branch
- name: Run router
if: github.event_name == 'pull_request'
run: |
kill $(cat router.pid)
./main-branch/target/release/hive_router &
sleep 5
env:
ROUTER_CONFIG_FILE_PATH: ${{matrix.config}}
- name: Run k6 benchmark for main
if: github.event_name == 'pull_request'
run: k6 run -e SUMMARY_PATH=./bench/results/main bench/k6.js
- name: Compare benchmark results
if: github.event_name == 'pull_request'
run: |
chmod +x ./bench/ci-detect-regression.sh
./bench/ci-detect-regression.sh
graphql-over-http:
name: test / graphql-over-http
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # 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
- name: Publish Test Results for comparison
uses: EnricoMi/publish-unit-test-result-action@27d65e188ec43221b20d26de30f4892fad91df2f # v2
if: (!cancelled())
with:
check_name: test / graphql-over-http
comment_title: GraphQL over HTTP Audit Results
comment_mode: off
files: |
audits/reports/*.xml
federation-audit:
name: test / federation-audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # 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
env:
GATEWAY_TIMEOUT: 1_800_000 # 30 minutes, to prevent CI timeout for long-running tests
working-directory: audits
continue-on-error: true # continue even if the test fails
- name: Upload logs
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: federation-audit-logs
path: |
./audits/logs/*.log
- name: Publish Test Results for comparison
uses: EnricoMi/publish-unit-test-result-action@27d65e188ec43221b20d26de30f4892fad91df2f # v2
if: (!cancelled())
with:
fail_on: "nothing"
check_name: test / federation-audit
comment_title: Federation Audit Results
comment_mode: off
files: |
audits/reports/*.xml