refactor: migrate to Session API with improved caching and cross-platform support #176
Workflow file for this run
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 | |
| permissions: | |
| # Doing it explicitly because the default permission only includes metadata: read. | |
| contents: read | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: [opened, synchronize] | |
| paths-ignore: | |
| - '**/*.md' | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**/*.md' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: ${{ github.ref_name != 'main' }} | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| test: | |
| name: Test | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| - os: namespace-profile-mac-default | |
| target: aarch64-apple-darwin | |
| - os: namespace-profile-mac-default | |
| target: x86_64-apple-darwin | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| persist-credentials: false | |
| submodules: true | |
| - uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0 | |
| with: | |
| save-cache: ${{ github.ref_name == 'main' }} | |
| cache-key: test | |
| - run: rustup target add ${{ matrix.target }} | |
| - run: rustup target add x86_64-unknown-linux-musl | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| - run: pip install cargo-zigbuild | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| - run: cargo check --all-targets --all-features --target ${{ matrix.target }} | |
| env: | |
| RUSTFLAGS: '-D warnings --cfg tokio_unstable' # also update .cargo/config.toml | |
| # fspy contains tests for Node.js fs accesses. | |
| # use x86_64 node for x86_64-apple-darwin target. | |
| - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 | |
| with: | |
| node-version-file: .node-version | |
| architecture: x64 | |
| if: ${{ matrix.target == 'x86_64-apple-darwin' }} | |
| - run: cargo test --target ${{ matrix.target }} | |
| if: ${{ matrix.os != 'ubuntu-latest' }} | |
| - run: cargo-zigbuild test --target x86_64-unknown-linux-gnu.2.17 | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| persist-credentials: false | |
| submodules: true | |
| - uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0 | |
| with: | |
| save-cache: ${{ github.ref_name == 'main' }} | |
| cache-key: lint | |
| tools: dprint,cargo-shear | |
| components: clippy rust-docs rustfmt | |
| - run: | | |
| dprint check | |
| cargo shear | |
| cargo fmt --check | |
| # cargo clippy --all-targets --all-features -- -D warnings | |
| RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --document-private-items | |
| - uses: crate-ci/typos@85f62a8a84f939ae994ab3763f01a0296d61a7ee # v1.36.2 | |
| with: | |
| files: . | |
| - uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 | |
| - name: Deduplicate dependencies | |
| run: pnpm dedupe --check | |
| done: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - test | |
| - lint | |
| steps: | |
| - run: exit 1 | |
| # Thank you, next https://github.com/vercel/next.js/blob/canary/.github/workflows/build_and_test.yml#L379 | |
| if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }} |