name: CI on: push: branches: [main] pull_request: workflow_dispatch: env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 permissions: contents: read concurrency: # Pull requests share one group per branch, so a newer push cancels the older run. Every other # run (main, manual) gets its own group: it is never cancelled or replaced while queued, so it # always gets to save the cache. group: ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: lint: name: fmt, clippy, wasm runs-on: ubuntu-latest timeout-minutes: 15 steps: - name: Harden runner uses: step-security/harden-runner@v2.22.4 with: egress-policy: audit - uses: actions/checkout@v7.0.1 - uses: step-security/dtolnay-rust-toolchain@v1.0.0 with: toolchain: stable components: clippy, rustfmt targets: wasm32-unknown-unknown - uses: step-security/rust-cache@v2.9.2 with: # Save from main only; pull requests restore main's cache. A cache saved from a pull # request can only be restored by that same pull request. save-if: ${{ github.ref == 'refs/heads/main' }} - run: cargo fmt --all --check - run: cargo clippy --workspace --all-targets --locked -- -D warnings # The core crate promises to compile for wasm, with and without the third-party feature. - run: cargo check -p craft-ext-core --target wasm32-unknown-unknown --locked test: name: test (${{ matrix.os }}) runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] steps: - name: Harden runner uses: step-security/harden-runner@v2.22.4 with: egress-policy: audit - uses: actions/checkout@v7.0.1 - uses: step-security/dtolnay-rust-toolchain@v1.0.0 with: toolchain: stable - uses: step-security/rust-cache@v2.9.2 with: # Save from main only; pull requests restore main's cache. A cache saved from a pull # request can only be restored by that same pull request. save-if: ${{ github.ref == 'refs/heads/main' }} - run: cargo test --workspace --locked