Skip to content

Subscriptions

Subscriptions #3702

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
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- 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
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- 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
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- name: build
run: cargo build --release
fmt:
name: check / fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
with:
components: rustfmt
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- name: cargo fmt
uses: actions-rust-lang/rustfmt@4066006ec54a31931b9b1fddfd38f2fdf2d27143 # v1
clippy:
name: check / clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
with:
components: clippy
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- 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
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- 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:
name: benchmark / router
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
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- 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
- name: Run router
run: |
./target/release/hive_router &
echo "$!" > router.pid
sleep 5
env:
SUPERGRAPH_FILE_PATH: bench/supergraph.graphql
# run only on main
- name: Run k6 benchmark for Pull Request
if: github.event_name == 'push'
run: k6 run bench/k6.js
# run only on PR
- name: Run k6 benchmark for Pull Request
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
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:
SUPERGRAPH_FILE_PATH: bench/supergraph.graphql
- name: Run k6 benchmark for main
if: github.event_name == 'pull_request'
run: k6 run -e SUMMARY_PATH=./bench/results/main -e NO_GITHUB_COMMENT=true 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
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- name: setup node
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version
- 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
- name: Publish Test Results for details
uses: mikepenz/action-junit-report@74626db7353a25a20a72816467ebf035f674c5f8 # v6
if: (!cancelled())
with:
report_paths: "audits/reports/*.xml"
group_reports: false
job_name: test / graphql-over-http
check_name: test / graphql-over-http
annotate_only: true
fail_on_failure: true
fail_on_parse_error: true
job_summary: true
verbose_summary: false
skip_success_summary: true
include_empty_in_summary: false
include_time_in_summary: true
simplified_summary: true
group_suite: true
comment: false
exclude_sources: /lib/,/audits/node_modules/
federation-audit:
name: test / federation-audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
with:
shared-key: ${{ hashFiles('**/Cargo.lock') }}
- run: cargo build --package hive-router
- name: setup node
uses: the-guild-org/shared-config/setup@v1
with:
node-version-file: .node-version
- 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@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
- name: Publish Test Results for details
uses: mikepenz/action-junit-report@74626db7353a25a20a72816467ebf035f674c5f8 # v6
if: (!cancelled())
with:
report_paths: "audits/reports/*.xml"
group_reports: false
job_name: test / federation-audit
check_name: test / federation-audit
check_title_template: "{{FILE_NAME}}"
fail_on_failure: true
fail_on_parse_error: true
annotate_only: true
job_summary: true
verbose_summary: false
skip_success_summary: true
include_empty_in_summary: false
include_time_in_summary: true
simplified_summary: true
group_suite: true
comment: false
exclude_sources: /lib/,/audits/node_modules/