Github CI: Test CI to reduce build time with matrix concurrency #669
Workflow file for this run
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: ci | |
on: | |
pull_request: | |
paths-ignore: | |
- "**.md" | |
- "doc/**" | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
env: | |
RUST_BACKTRACE: 1 | |
CARGO_TERM_COLOR: always | |
jobs: | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libssl-dev | |
- name: Install Rust nightly | |
run: rustup toolchain install nightly | |
- name: Show active toolchain | |
run: rustup show active-toolchain | |
- name: Add nightly rustfmt | |
run: rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu | |
- name: Cache rust toolchain and dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/ | |
target/ | |
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-rust- | |
- name: Rustfmt | |
run: cargo +nightly fmt --all -- --check | |
clippy: | |
runs-on: ubuntu-latest | |
needs: rustfmt | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libssl-dev | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/ | |
target/ | |
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-rust- | |
- name: Cargo Clippy | |
run: rustup component add rust-src && cargo clippy --all --no-deps --all-targets --features=runtime-benchmarks -- -D warnings | |
check-runtime-benchmarks: | |
runs-on: ubuntu-latest | |
needs: rustfmt | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Install jq | |
run: sudo apt-get update && sudo apt-get install -y jq | |
- name: Generate and store package lists | |
run: | | |
. ./.github/scripts/generate_lists.sh # This script will create the two files | |
- name: Run tests with runtime-benchmarks | |
if: ${{ always() }} | |
run: | | |
if [ -s packages_with_runtime_benchmarks.txt ]; then | |
echo "Running tests for packages with 'runtime-benchmarks' feature..." | |
while IFS= read -r package; do | |
cargo test --release --package "$package" --features "runtime-benchmarks" --no-fail-fast | |
done < packages_with_runtime_benchmarks.txt | |
else | |
echo "No packages found with 'runtime-benchmarks' feature." | |
fi | |
- name: Run tests without runtime-benchmarks | |
if: ${{ always() }} | |
run: | | |
if [ -s packages_without_runtime_benchmarks.txt ]; then | |
echo "Running tests for packages without 'runtime-benchmarks' feature..." | |
while IFS= read -r package; do | |
cargo test --release --package "$package" --no-fail-fast | |
done < packages_without_runtime_benchmarks.txt | |
else | |
echo "No packages found without 'runtime-benchmarks' feature." | |
fi |