remove if #2
This file contains 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: cli (benchmark Depot) | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- "main" | |
permissions: | |
# Allow checks read | |
checks: write | |
# Allow repo checkout | |
contents: write | |
# Allow PRs write | |
pull-requests: write | |
# Allow issues write | |
issues: write | |
env: | |
GRAFBASE_SKIP_ASSET_VERSION_CHECK: "true" | |
CARGO_TERM_COLOR: "always" | |
CARGO_PROFILE_DEV_DEBUG: 0 | |
CARGO_PROFILE_TEST_DEBUG: 0 | |
DO_NOT_TRACK: 1 | |
GRAFBASE_RUDDERSTACK_WRITE_KEY: ${{ secrets.GRAFBASE_RUDDERSTACK_WRITE_KEY }} | |
GRAFBASE_RUDDERSTACK_DATAPLANE_URL: ${{ secrets.GRAFBASE_RUDDERSTACK_DATAPLANE_URL }} | |
CLI_RELEASE_CLOUDFLARE_R2_ENDPOINT_URL: https://d267a8ab95268b272f5147e8939c9d38.r2.cloudflarestorage.com | |
CLI_RELEASE_CLOUDFLARE_R2_PUBLIC_URL: https://pub-b0013effd6614b32a4fb9bf338b90658.r2.dev | |
CLI_RELEASE_CLOUDFLARE_R2_BUCKET_NAME: cli-releases | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
detect-change-type: | |
runs-on: depot-ubuntu-latest | |
outputs: | |
build: ${{ steps.filter.outputs.build }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Path filter check | |
uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
build: | |
- Dockerfile | |
- 'gateway/**/*' | |
- 'cli/**/*' | |
- 'engine/**/*' | |
- '.github/workflows/gateway.yml' | |
- '.github/actions/**/*' | |
- '!**/*.md' | |
lint: | |
name: "Lint" | |
needs: [detect-change-type] | |
if: ${{ needs.detect-change-type.outputs.build == 'true' || startsWith(github.ref, 'refs/tags/') }} | |
runs-on: depot-ubuntu-latest-8 | |
steps: | |
- name: Get sources | |
uses: actions/checkout@v4 | |
- name: Rust job init | |
uses: ./.github/actions/init_rust_job | |
with: | |
platform: linux | |
cache-key: ${{ runner.os }}-${{ runner.arch }}-cargo-dev-${{ hashFiles('Cargo.lock') }} | |
restore-key: ${{ runner.os }}-${{ runner.arch }}-cargo-dev | |
- name: Prepare Grafbase assets | |
uses: ./.github/actions/cli_assets | |
- name: Lint | |
uses: ./.github/actions/lint | |
individual-builds: | |
needs: [detect-change-type] | |
if: ${{ needs.detect-change-type.outputs.build == 'true' || startsWith(github.ref, 'refs/tags/') }} | |
strategy: | |
fail-fast: false | |
matrix: | |
package: | |
[ | |
grafbase-local-common, | |
grafbase-local-server, | |
grafbase-local-backend, | |
grafbase, | |
grafbase-gateway, | |
federated-server, | |
] | |
runs-on: depot-ubuntu-latest-8 | |
steps: | |
- name: Get sources | |
uses: actions/checkout@v4 | |
- name: Rust job init | |
uses: ./.github/actions/init_rust_job | |
with: | |
platform: linux | |
cache-key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-${{ matrix.package }}-${{ hashFiles('Cargo.lock') }} | |
restore-key: ${{ runner.os }}-${{ runner.arch }}-cargo-build | |
- name: Build assets | |
if: ${{ matrix.package != 'grafbase-gateway' }} | |
uses: ./.github/actions/cli_assets | |
- name: Individual package build | |
shell: bash | |
run: | | |
set -euo pipefail | |
# The actual features used for each dependency depends on what is being built simultaneously. | |
# However, each package is published individually, so we're checking that all packages compile | |
# with only their defined features. | |
# See: https://github.com/rust-lang/cargo/issues/4463 | |
cargo check --all-features --package ${{ matrix.package }} | |
- name: Individual package without lambda | |
if: ${{ matrix.package == 'grafbase-gateway' }} | |
shell: bash | |
run: | | |
set -euo pipefail | |
cargo check --package ${{ matrix.package }} | |
docker-grafbase: | |
runs-on: depot-ubuntu-latest-16 | |
permissions: | |
packages: write | |
env: | |
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
steps: | |
- name: Get sources | |
uses: actions/checkout@v4 | |
- uses: depot/setup-action@v1 | |
- uses: depot/build-push-action@v1 | |
with: | |
context: ./upstream/cli | |
tags: ghcr.io/grafbase/grafbase:$COMMIT_SHA | |
save: true | |
- name: Rust job init | |
uses: ./.github/actions/init_rust_job | |
with: | |
platform: linux | |
cache-key: ${{ runner.os }}-${{ runner.arch }}-cargo-dev-${{ hashFiles('Cargo.lock') }} | |
restore-key: ${{ runner.os }}-${{ runner.arch }}-cargo-dev | |
- name: Docker tests | |
run: | | |
GRAFBASE_DOCKER_IMAGE="ghcr.io/grafbase/grafbase:$COMMIT_SHA" RUST_BACKTRACE=1 cargo nextest run -p grafbase-docker-tests | |
docker-gateway: | |
runs-on: depot-ubuntu-latest-16 | |
permissions: | |
packages: write | |
env: | |
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
steps: | |
- name: Get sources | |
uses: actions/checkout@v4 | |
- uses: depot/setup-action@v1 | |
- uses: depot/build-push-action@v1 | |
with: | |
context: ./upstream/gateway | |
tags: ghcr.io/grafbase/gateway:$COMMIT_SHA | |
save: true |