Skip to content

Tools CI

Tools CI #2

Workflow file for this run

name: Tools CI
on:
push:
branches: [main]
paths:
- 'tools/**'
- '.github/workflows/tools-ci.yml'
pull_request:
branches: [main]
paths:
- 'tools/**'
- '.github/workflows/tools-ci.yml'
env:
CARGO_TERM_COLOR: always
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate matrix
id: set-matrix
run: |
tools=$(ls tools)
tools_json=$(echo $tools | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "::set-output name=matrix::${tools_json}"
# Run cargo test
test:
name: Runs Tests
runs-on: ubuntu-latest
strategy:
matrix:
tool: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
timeout-minutes: 30
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-test-${{ hashFiles('compile_api/Cargo.toml') }}
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run cargo test
working-directory: tools/${{ matrix.tool }}
run: cargo test
# Run cargo clippy -- -D warnings
clippy_check:
name: Check Clippy
runs-on: ubuntu-latest
strategy:
matrix:
tool: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
timeout-minutes: 30
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('compile_api/Cargo.toml') }}
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Run clippy
working-directory: tools/${{ matrix.tool }}
run: cargo clippy -- -D warnings
# Run cargo fmt --all -- --check
format:
name: Check Formatting
runs-on: ubuntu-latest
strategy:
matrix:
tool: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
timeout-minutes: 30
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run cargo fmt
working-directory: tools/${{ matrix.tool }}
run: cargo fmt --all -- --check