Skip to content

CI: can filter jobs to run depending on modified files #1

CI: can filter jobs to run depending on modified files

CI: can filter jobs to run depending on modified files #1

Workflow file for this run

name: CI v2
permissions:
contents: read
on:
merge_group:
pull_request:
push:
branches:
- release-*
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_PROFILE_DEV_DEBUG: 0
# If nightly is breaking CI, modify this variable to target a specific nightly version.
NIGHTLY_TOOLCHAIN: nightly
RUSTFLAGS: "-D warnings"
jobs:
# job to list the jobs to run on rust stable
stable-prepare:
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
jobs: ${{ steps.prepare.outputs.jobs }}
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Prepare CI jobs
id: prepare
run: |
echo "jobs=`cargo run -p ci -- what-to-run --trigger ${{ github.event_name }} --head ${{ github.head_ref }} --rust-version stable`" >> $GITHUB_OUTPUT
# run all the jobs on stable
stable-run:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [stable-prepare]
strategy:
fail-fast: false
matrix:
job: ${{ fromJson(needs.stable-prepare.outputs.jobs) }}
steps:
- uses: actions/checkout@v6
- uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-ci-runner--${{ hashFiles('tools/ci/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-ci-runner--${{ hashFiles('tools/ci/Cargo.toml') }}
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Install Linux dependencies
uses: ./.github/actions/install-linux-deps
- uses: dtolnay/rust-toolchain@stable
- name: Run CI job
run: |
${{ matrix.job }}
# single job to report status, usable in branch protection rules
stable-status:
runs-on: ubuntu-latest
needs: [stable-run]
if: always()
steps:
- run: ${{!contains(needs.*.result, 'failure')}}