Skip to content

ci: merge queue and registry caching #67

ci: merge queue and registry caching

ci: merge queue and registry caching #67

Workflow file for this run

name: PR
on:
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
rust: [1.31.0, stable]
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v4
if: startsWith(matrix.rust, '1')
with:
path: ~/.cargo/registry/index
key: cargo-${{ matrix.rust }}-git-index
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo build
- run: ./ci/test_full.sh
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.62.0
with:
components: rustfmt
- run: cargo fmt --all --check
# One job that "summarizes" the success state of this pipeline. This can then be added to branch
# protection, rather than having to add each job separately.
success:
name: Success
runs-on: ubuntu-latest
needs: [test, fmt]
# Github branch protection is exceedingly silly and treats "jobs skipped because a dependency
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
# dependencies fails.
if: always() # make sure this is never "skipped"
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: check if any dependency failed
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'