ci: Refactor scripts #304
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: Main | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
env: | |
CACHE: true | |
jobs: | |
audit: | |
name: Audit Dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Setup Environment | |
uses: ./.github/actions/setup | |
with: | |
cargo-cache-key: cargo-audit | |
components: audit | |
- name: cargo-audit | |
run: pnpm audit | |
filter: | |
name: Filter Workspace | |
runs-on: ubuntu-latest | |
needs: audit | |
outputs: | |
members: ${{ steps.filter.outputs.members }} | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Environment | |
uses: ./.github/actions/setup | |
with: | |
cargo-cache-key: cargo-filter-workspace | |
- name: Filter | |
id: filter | |
run: pnpm tsx ./scripts/setup/members.mts | |
process: | |
name: Crate | |
needs: filter | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
member: ${{ fromJson(needs.filter.outputs.members) }} | |
steps: | |
- name: Git Checkout | |
uses: actions/checkout@v4 | |
- name: Detect Changes | |
uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
crate: | |
- '${{ matrix.member }}/**' | |
- name: Setup Environment | |
uses: ./.github/actions/setup | |
if: ${{ steps.changes.outputs.crate == 'true' }} | |
with: | |
cargo-cache-key: cargo-${{ matrix.member }} | |
toolchain: build, format, lint, test | |
components: hack | |
solana: true | |
- name: fmt | |
if: ${{ steps.changes.outputs.crate == 'true' }} | |
run: pnpm format ${{ matrix.member }} | |
- name: clippy | |
if: ${{ steps.changes.outputs.crate == 'true' }} | |
run: pnpm clippy ${{ matrix.member }} | |
- name: cargo-doc | |
if: ${{ steps.changes.outputs.crate == 'true' }} | |
run: pnpm doc ${{ matrix.member }} | |
- name: cargo-hack | |
if: ${{ steps.changes.outputs.crate == 'true' }} | |
run: pnpm hack ${{ matrix.member }} | |
- name: build-sbf | |
if: ${{ steps.changes.outputs.crate == 'true' }} | |
run: pnpm build ${{ matrix.member }} | |
- name: test | |
if: ${{ steps.changes.outputs.crate == 'true' }} | |
run: pnpm test ${{ matrix.member }} |