Migrate from buildkite to github actions. #16
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 | ||
|
Check failure on line 1 in .github/workflows/ci.yml
|
||
| # TODO: Remove this before merging. | ||
| on: | ||
| push: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, labeled] | ||
| # TODO: Uncomment before merging | ||
| # on: | ||
| # push: | ||
| # branches: [main] | ||
| # pull_request: | ||
| # branches: [main] | ||
| # types: [opened, synchronize, reopened, labeled] | ||
| concurrency: | ||
| group: ci-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| minilints: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| # Check out the PR head commit (not the merge ref) so that | ||
| # minilints can verify the commit author is in CONTRIBUTORS. | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
| - name: Install Rust toolchain | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| cache: false | ||
| - name: Run minilints | ||
| run: cargo run -p minilints -- check /tmp/minilints.stamp | ||
| # Lightweight formatting checks (no build outputs needed) | ||
| format: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust toolchain | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| cache: false | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v7 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| - name: Install n2 | ||
| run: tools/install-n2 | ||
| env: | ||
| RUSTFLAGS: "--cap-lints warn" | ||
| - name: Install just | ||
| uses: extractions/setup-just@v3 | ||
| - name: Run format checks | ||
| run: just fmt | ||
| # Linux runs on every PR and push to main. | ||
| check-linux: | ||
| runs-on: ubuntu-24.04 | ||
| name: check (linux) | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
| - name: Restore cargo cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry/index | ||
| ~/.cargo/registry/cache | ||
| ~/.cargo/git/db | ||
| ~/.cargo/bin | ||
| ~/.cargo/.crates.toml | ||
| ~/.cargo/.crates2.json | ||
| key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} | ||
| restore-keys: cargo-${{ runner.os }}- | ||
| - name: Restore build output cache | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: out | ||
| key: build-Linux-${{ github.event.pull_request.number || 'main' }}-${{ github.run_id }} | ||
| restore-keys: | | ||
| build-Linux-${{ github.event.pull_request.number || 'main' }}- | ||
| build-Linux-main- | ||
| build-Linux- | ||
| - name: Setup build environment | ||
| uses: ./.github/actions/setup-anki | ||
| - name: Install just | ||
| uses: extractions/setup-just@v3 | ||
| - name: Symlink node_modules | ||
| run: | | ||
| ln -sf out/node_modules . | ||
| rm -f out/build.ninja | ||
| - name: Build, lint, and test | ||
| env: | ||
| ONLINE_TESTS: "1" | ||
| run: | | ||
| just build | ||
| just lint | ||
| just test | ||
| - name: Ensure libs importable | ||
| env: | ||
| SKIP_RUN: "1" | ||
| run: ./run | ||
| - name: Check Rust dependencies | ||
| run: | | ||
| cargo install cargo-deny@0.19.0 | ||
| cargo deny check | ||
| - name: Save build output cache | ||
| if: always() | ||
| uses: actions/cache/save@v4 | ||
| with: | ||
| path: out | ||
| key: build-Linux-${{ github.event.pull_request.number || 'main' }}-${{ github.run_id }} | ||
| # macOS and Windows run on pushes to main and on PRs with the | ||
| # corresponding label (check:macos or check:windows). | ||
| check-other-platforms: | ||
| if: >- | ||
| github.event_name == 'push' | ||
| || contains(github.event.pull_request.labels.*.name, matrix.label) | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - platform: macos | ||
| runner: macos-latest | ||
| label: check:macos | ||
| - platform: windows | ||
| runner: windows-latest | ||
| label: check:windows | ||
| runs-on: ${{ matrix.runner }} | ||
| name: check (${{ matrix.platform }}) | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.sha }} | ||
| - name: Restore cargo cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry/index | ||
| ~/.cargo/registry/cache | ||
| ~/.cargo/git/db | ||
| ~/.cargo/bin | ||
| ~/.cargo/.crates.toml | ||
| ~/.cargo/.crates2.json | ||
| key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} | ||
| restore-keys: cargo-${{ runner.os }}- | ||
| - name: Restore build output cache | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: out | ||
| key: build-${{ runner.os }}-main-${{ github.run_id }} | ||
| restore-keys: | | ||
| build-${{ runner.os }}-main- | ||
| build-${{ runner.os }}- | ||
| - name: Setup build environment | ||
| uses: ./.github/actions/setup-anki | ||
| - name: Install just | ||
| uses: extractions/setup-just@v3 | ||
| - name: Symlink node_modules (macOS) | ||
| if: matrix.platform == 'macos' | ||
| run: ln -sf out/node_modules . | ||
| - name: Build and test (macOS) | ||
| if: matrix.platform == 'macos' | ||
| run: | | ||
| just build | ||
| just wheels | ||
| just test | ||
| - name: Build and test (Windows) | ||
| if: matrix.platform == 'windows' | ||
| run: | | ||
| just build | ||
| just test | ||
| - name: Save build output cache | ||
| if: always() | ||
| uses: actions/cache/save@v4 | ||
| with: | ||
| path: out | ||
| key: build-${{ runner.os }}-main-${{ github.run_id }} | ||