ci: fix action tag #25
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: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - .github/workflows/ci.yml | |
| - Cargo.** | |
| - crates/** | |
| - examples/** | |
| pull_request: | |
| branches: | |
| - main | |
| env: | |
| CARGO_TERM_COLOR: "always" | |
| RUST_LOG: "info" | |
| RUST_BACKTRACE: "1" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Test | |
| if: github.event_name != 'pull_request' || !startsWith(github.head_ref, 'release-plz-') | |
| permissions: | |
| contents: read | |
| actions: write # evict cache | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - uses: denoland/setup-deno@v2 | |
| with: | |
| deno-version: v2.x | |
| - name: Get Cargo version | |
| run: echo "cargo-version=$(cargo --version)" >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| id: cargo-version | |
| - uses: tonywu6/cache-hit-please@v1.1.0 | |
| id: cache | |
| env: | |
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| with: | |
| deps: | | |
| ${{runner.os}} | |
| ${{runner.arch}} | |
| ${{steps.cargo-version.outputs.cargo-version}} | |
| ${{hashFiles('**/Cargo.toml')}} | |
| ${{hashFiles('**/Cargo.lock')}} | |
| ${{hashFiles('deno.json')}} | |
| ${{hashFiles('deno.lock')}} | |
| ${{github.workflow}} | |
| ${{github.run_id}} | |
| path: | | |
| .bin/ | |
| target/ | |
| - run: cargo test --all-features --no-run | |
| - run: cargo test --all-features --no-fail-fast -- --include-ignored | |
| - run: cargo build --workspace | |
| outputs: | |
| cache-primary-key: ${{steps.cache.outputs.primary-key}} | |
| cache-restore-key: ${{steps.cache.outputs.restore-key}} | |
| cache-path: ${{steps.cache.outputs.path}} | |
| test-examples: | |
| name: Test examples | |
| needs: | |
| - test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - uses: denoland/setup-deno@v2 | |
| with: | |
| deno-version: v2.x | |
| - uses: actions/cache/restore@v4 | |
| with: | |
| path: ${{needs.test.outputs.cache-path}} | |
| key: ${{ needs.test.outputs.cache-primary-key }} | |
| restore-keys: ${{ needs.test.outputs.cache-restore-key }} | |
| - run: cargo run --package example-console | |
| if: always() | |
| - run: cargo run --package example-calculator | |
| if: always() | |
| - run: cargo run --package example-fibonacci | |
| if: always() | |
| - run: cargo run --package example-ts | |
| if: always() | |
| - run: cargo run --package example-ts-blank-space | |
| if: always() |