fix: workflow^3 #4
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: Rust | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| concurrency: | |
| group: rust-ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUSTC_WRAPPER: sccache | |
| CARGO_INCREMENTAL: 0 | |
| SCCACHE_CACHE_SIZE: 10G | |
| jobs: | |
| check: | |
| runs-on: macos-14 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache Cargo registry, git index, target and sccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| ~/.cache/sccache | |
| ~/.cargo/bin | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml', 'rust-toolchain') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Add cargo bin to PATH | |
| run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" | |
| - name: Install stable & nightly toolchains (+ nightly rustfmt) | |
| run: | | |
| rustup toolchain install stable | |
| rustup toolchain install nightly | |
| rustup default stable | |
| rustup component add rustfmt --toolchain nightly | |
| rustup show | |
| - name: Install sccache | |
| run: | | |
| cargo install sccache || true | |
| sccache --start-server || true | |
| sccache --version || true | |
| - name: Formatting (nightly) | |
| run: cargo +nightly fmt --all --check --verbose | |
| - name: Check (host) | |
| run: cargo check --verbose --locked | |
| - name: sccache stats | |
| if: always() | |
| run: sccache --show-stats || true | |
| build: | |
| needs: check | |
| runs-on: macos-14 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache Cargo registry, git index, target and sccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| ~/.cache/sccache | |
| ~/.cargo/bin | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml', 'rust-toolchain') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Add cargo bin to PATH | |
| run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" | |
| - name: Install latest stable toolchain | |
| run: | | |
| rustup toolchain install stable | |
| rustup default stable | |
| rustup show | |
| - name: Install sccache | |
| run: | | |
| cargo install sccache || true | |
| sccache --start-server || true | |
| sccache --version || true | |
| - name: Build | |
| run: cargo build --verbose --locked | |
| - name: Run tests | |
| run: cargo test --verbose --locked | |
| - name: sccache stats | |
| if: always() | |
| run: sccache --show-stats || true |