[CI] Refactor workflows to support matrix builds and config file #4
Workflow file for this run
This file contains hidden or 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: Quality Checks | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| tags-ignore: | |
| - '**' | |
| pull_request: | |
| workflow_call: | |
| jobs: | |
| load-config: | |
| name: Load CI Configuration | |
| runs-on: ubuntu-latest | |
| outputs: | |
| targets: ${{ steps.config.outputs.targets }} | |
| rust_components: ${{ steps.config.outputs.rust_components }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Load configuration | |
| id: config | |
| run: | | |
| TARGETS=$(jq -c '.targets' .github/config.json) | |
| COMPONENTS=$(jq -r '.rust_components | join(", ")' .github/config.json) | |
| echo "targets=$TARGETS" >> $GITHUB_OUTPUT | |
| echo "rust_components=$COMPONENTS" >> $GITHUB_OUTPUT | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| needs: load-config | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: ${{ fromJson(needs.load-config.outputs.targets) }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: ${{ needs.load-config.outputs.rust_components }} | |
| targets: ${{ matrix.target }} | |
| - name: Check rust version | |
| run: rustc --version --verbose | |
| - name: Check code format | |
| run: cargo fmt --all -- --check | |
| - name: Build | |
| run: cargo build --target ${{ matrix.target }} --all-features | |
| - name: Run clippy | |
| run: cargo clippy --target ${{ matrix.target }} --all-features -- -D warnings | |
| - name: Build documentation | |
| env: | |
| RUSTDOCFLAGS: -D rustdoc::broken_intra_doc_links -D missing-docs | |
| run: cargo doc --no-deps --target ${{ matrix.target }} --all-features |