Switch CI from bors to merge queue #452
This file contains 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: PR build | |
on: [pull_request] | |
jobs: | |
lint: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust nightly | |
run: rustup update nightly && rustup default nightly && rustup component add rustfmt clippy | |
- name: Check the code formatting with rustfmt | |
run: cargo fmt --all -- --check | |
- name: Ensure there are no warnings with Clippy | |
run: cargo clippy --all -- -Dwarnings | |
- name: Check if the configuration is correct | |
run: | | |
cargo run -- create-lists | |
cargo run -- check-config | |
test: | |
name: Linux testing | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust nightly | |
run: rustup update nightly && rustup default nightly | |
- name: Build Crater | |
run: cargo build | |
- name: Run Crater tests | |
run: | | |
cargo run -- create-lists | |
cargo test | |
# Note: this job is used so that there is a job named "conclusion" both in the PR and merge queue | |
# CI. Otherwise, it would not be possible for PR CI to succeed. | |
conclusion: | |
needs: [lint, test] | |
# We need to ensure this job does *not* get skipped if its dependencies fail, | |
# because a skipped job is considered a success by GitHub. So we have to | |
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run | |
# when the workflow is canceled manually. | |
# | |
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! | |
if: ${{ !cancelled() }} | |
runs-on: ubuntu-latest | |
steps: | |
# Manually check the status of all dependencies. `if: failure()` does not work. | |
- name: Conclusion | |
run: | | |
# Print the dependent jobs to see them in the CI log | |
jq -C <<< '${{ toJson(needs) }}' | |
# Check if all jobs that we depend on (in the needs array) were successful. | |
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' |