repo: release (#704) #3009
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: | |
| workflow_dispatch: | |
| merge_group: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_UNSTABLE_SPARSE_REGISTRY: "true" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| # Cache strategy (the `with:` on every rust-cache step below). The repo has a | |
| # 10 GB cache cap, so we keep the footprint small: | |
| # - shared-key: every job builds the same workspace, so they share one cache | |
| # per OS/arch (rust-cache appends those) rather than a cache each. | |
| # - save-if: only the default branch writes the cache; PRs and the merge queue | |
| # restore it read-only, so branches don't evict each other and rebuild cold. | |
| jobs: | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - macos-latest | |
| - ubuntu-24.04 | |
| - ubuntu-24.04-arm | |
| - windows-latest | |
| name: ${{ matrix.platform }} / test | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v7.0.0 | |
| - name: Configure toolchain | |
| run: | | |
| rustup toolchain install --profile minimal --no-self-update stable | |
| rustup default stable | |
| # https://github.com/actions/cache/issues/752 | |
| - if: runner.os == 'Windows' | |
| name: Use GNU tar | |
| shell: cmd | |
| run: | | |
| echo "Adding GNU tar to PATH" | |
| echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" | |
| - if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl musl-dev musl-tools gcc-aarch64-linux-gnu | |
| rustup target add x86_64-unknown-linux-musl | |
| rustup target add aarch64-unknown-linux-gnu | |
| rustup target add aarch64-unknown-linux-musl | |
| - if: runner.os == 'Linux' | |
| uses: taiki-e/install-action@v2.82.2 | |
| with: | |
| tool: cross | |
| - if: runner.os == 'macOS' | |
| run: | | |
| rustup target add aarch64-apple-darwin | |
| - uses: ikalnytskyi/action-setup-postgres@v8 | |
| id: postgres | |
| with: | |
| username: ci | |
| database: ci | |
| ssl: false | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - run: cargo test | |
| env: | |
| DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }} | |
| contract: | |
| name: Canopy contract | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7.0.0 | |
| - name: Configure toolchain | |
| run: | | |
| rustup toolchain install --profile minimal --no-self-update stable | |
| rustup default stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Contract tests against live canopy | |
| run: cargo test -p bestool --lib canopy_contract -- --ignored | |
| alertd-no-db: | |
| name: alertd / graceful without postgres | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v7.0.0 | |
| - name: Configure toolchain | |
| run: | | |
| rustup toolchain install --profile minimal --no-self-update stable | |
| rustup default stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Build alertd tests | |
| run: cargo test -p bestool-alertd --lib --no-run --message-format=json > alertd-tests.json | |
| - name: Run doctor checks in a postgres-less network namespace | |
| run: | | |
| set -euo pipefail | |
| bin=$(jq -r 'select(.reason == "compiler-artifact" and (.target.kind == ["lib"]) and .executable != null and (.package_id | test("bestool-alertd"))) | .executable' alertd-tests.json | tail -n1) | |
| test -n "$bin" || { echo "could not locate alertd lib test binary"; exit 1; } | |
| echo "running doctor checks in a fresh network namespace: $bin" | |
| # A new network namespace has no route to the host's postgres, so the | |
| # doctor checks must degrade gracefully (db_connect alerts, DB-backed | |
| # checks skip) rather than hang or panic. `sudo unshare` runs as real | |
| # root, sidestepping ubuntu 24.04's restriction on unprivileged user | |
| # namespaces. We scope to `doctor::` because the http_server tests need | |
| # working loopback HTTP that a bare namespace doesn't provide. | |
| sudo unshare --net -- bash -c "ip link set lo up && exec '$bin' doctor::" | |
| kopia-proxy: | |
| name: kopia S3 proxy / e2e | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7.0.0 | |
| - name: Configure toolchain | |
| run: | | |
| rustup toolchain install --profile minimal --no-self-update stable | |
| rustup default stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Start MinIO | |
| run: | | |
| docker run -d --name minio -p 9000:9000 \ | |
| -e MINIO_ROOT_USER=minioadmin -e MINIO_ROOT_PASSWORD=minioadmin123 \ | |
| quay.io/minio/minio:latest server /data | |
| for _ in $(seq 1 30); do | |
| if curl -fsS http://127.0.0.1:9000/minio/health/live >/dev/null; then echo "minio ready"; break; fi | |
| sleep 1 | |
| done | |
| - name: Create bucket | |
| env: | |
| AWS_ACCESS_KEY_ID: minioadmin | |
| AWS_SECRET_ACCESS_KEY: minioadmin123 | |
| AWS_DEFAULT_REGION: us-east-1 | |
| run: aws --endpoint-url http://127.0.0.1:9000 s3 mb s3://kopia-proxy-ci | |
| - name: Install kopia | |
| run: | | |
| curl -fsSL https://github.com/kopia/kopia/releases/download/v0.23.1/kopia-0.23.1-linux-x64.tar.gz -o kopia.tgz | |
| tar xzf kopia.tgz | |
| echo "KOPIA_BIN=$PWD/kopia-0.23.1-linux-x64/kopia" >> "$GITHUB_ENV" | |
| - name: Run proxy end-to-end test | |
| env: | |
| KOPIA_PROXY_TEST_ENDPOINT: http://127.0.0.1:9000 | |
| KOPIA_PROXY_TEST_BUCKET: kopia-proxy-ci | |
| KOPIA_PROXY_TEST_ACCESS_KEY: minioadmin | |
| KOPIA_PROXY_TEST_SECRET_KEY: minioadmin123 | |
| KOPIA_PROXY_TEST_REGION: us-east-1 | |
| run: cargo test -p bestool-kopia --features proxy --test proxy_e2e -- --ignored --nocapture | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7.0.0 | |
| - name: Configure toolchain | |
| run: | | |
| rustup toolchain install --profile minimal --no-self-update stable | |
| rustup default stable | |
| rustup component add clippy | |
| - uses: taiki-e/install-action@v2.82.2 | |
| with: | |
| tool: just | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - run: cargo clippy --all-targets --all-features | |
| check-docs: | |
| name: Check USAGE.md files are up to date | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7.0.0 | |
| - name: Configure toolchain | |
| run: | | |
| rustup toolchain install --profile minimal --no-self-update stable | |
| rustup default stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Generate USAGE.md files | |
| run: ./update-usage.sh | |
| - name: Check for changes | |
| run: | | |
| if ! git diff --exit-code crates/*/USAGE.md; then | |
| echo "Error: USAGE.md files are out of date!" | |
| echo "Run ./update-usage.sh and commit the changes." | |
| exit 1 | |
| fi | |
| tests-pass: | |
| if: always() | |
| name: Tests pass | |
| needs: [test, contract, check-docs, alertd-no-db, kopia-proxy] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: re-actors/alls-green@release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} |