Skip to content

Migrate from buildkite to github actions. #15

Migrate from buildkite to github actions.

Migrate from buildkite to github actions. #15

Workflow file for this run

name: CI
# TODO: Remove this before merging.
on: [push, pull_request]
# TODO: Uncomment before merging
# on:
# push:
# branches: [main]
# pull_request:
# branches: [main]
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
check:
strategy:
fail-fast: false
matrix:
include:
- platform: linux
runner: ubuntu-24.04
- platform: macos
runner: macos-latest
- platform: windows
runner: windows-latest
runs-on: ${{ matrix.runner }}
name: check (${{ matrix.platform }})
steps:
# Check out the PR head commit (not the merge ref) so that
# check:minilints can verify the commit author is in CONTRIBUTORS.
# The default merge ref author is GitHub, not the PR author.
- 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 }}-
# Fallback order for new PRs:
# 1. build-{OS}-main (seed from latest main cache)
# 2. build-{OS}- (any prior cache for this OS)
- name: Restore build output cache
uses: actions/cache/restore@v4
with:
path: out
key: build-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-${{ github.run_id }}
restore-keys: |
build-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-
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 (Linux)
if: matrix.platform == 'linux'
run: |
ln -sf out/node_modules .
rm -f out/build.ninja
- name: Symlink node_modules (macOS)
if: matrix.platform == 'macos'
run: ln -sf out/node_modules .
# Linting and type checking on Linux only (formatting is separate job).
# Tests run on all platforms to catch platform-specific issues.
- name: Build, lint, and test (Linux)
if: matrix.platform == 'linux'
env:
ONLINE_TESTS: "1"
run: |
just build
just lint
just test
- 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: Ensure libs importable (Linux)
if: matrix.platform == 'linux'
env:
SKIP_RUN: "1"
run: ./run
- name: Check Rust dependencies (Linux)
if: matrix.platform == 'linux'
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-${{ runner.os }}-${{ github.event.pull_request.number || 'main' }}-${{ github.run_id }}