Add group to update instruction (#44) #212
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: | |
branches: [main] | |
env: | |
CACHE: true | |
jobs: | |
changes: | |
name: Detect changes | |
runs-on: buildjet-8vcpu-ubuntu-2204 | |
outputs: | |
any: ${{ steps.changes.outputs.any }} | |
programs: ${{ steps.changes.outputs.programs }} | |
program_matrix: ${{ steps.program_matrix.outputs.matrix }} | |
js_clients: ${{ steps.changes.outputs.js_clients }} | |
rust_clients: ${{ steps.changes.outputs.rust_clients }} | |
js_client_matrix: ${{ steps.js_client_matrix.outputs.matrix }} | |
rust_client_matrix: ${{ steps.rust_client_matrix.outputs.matrix }} | |
rust_cli: ${{ steps.changes.outputs.rust_cli }} | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Load environment variables | |
run: cat .github/.env >> $GITHUB_ENV | |
- name: Detect changes | |
uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: .github/file-filters.yml | |
- name: Filter program matrix | |
id: program_matrix | |
uses: nifty-oss/actions/filter-matrix@v1 | |
with: | |
matrix: ${{ env.PROGRAMS }} | |
changes: ${{ steps.changes.outputs.changes }} | |
suffix: _program | |
- name: Filter JS client matrix | |
id: js_client_matrix | |
uses: nifty-oss/actions/filter-matrix@v1 | |
with: | |
matrix: ${{ env.PROGRAMS }} | |
changes: ${{ steps.changes.outputs.changes }} | |
suffix: _js_client | |
- name: Filter Rust client matrix | |
id: rust_client_matrix | |
uses: nifty-oss/actions/filter-matrix@v1 | |
with: | |
matrix: ${{ env.PROGRAMS }} | |
changes: ${{ steps.changes.outputs.changes }} | |
suffix: _rust_client | |
lint_rust: | |
name: Lint Rust | |
if: ${{ needs.changes.outputs.any == 'true' }} | |
needs: changes | |
runs-on: buildjet-8vcpu-ubuntu-2204 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Load environment variables | |
run: cat .github/.env >> $GITHUB_ENV | |
- name: Install Rust | |
uses: nifty-oss/actions/install-rust@v1 | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- name: Cache program dependencies | |
if: env.CACHE == 'true' | |
uses: nifty-oss/actions/buildjet-cache-crate@v1 | |
with: | |
folder: "." | |
key: programs | |
- name: Run cargo fmt | |
uses: nifty-oss/actions/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: Run cargo clippy | |
uses: nifty-oss/actions/cargo@v1 | |
with: | |
command: clippy | |
args: --all-targets --all-features --no-deps | |
lint_js: | |
name: Lint JS | |
if: ${{ needs.changes.outputs.any == 'true' }} | |
needs: changes | |
runs-on: buildjet-8vcpu-ubuntu-2204 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Load environment variables | |
run: cat .github/.env >> $GITHUB_ENV | |
- name: Install Node.js | |
uses: nifty-oss/actions/install-node-with-pnpm@v1 | |
with: | |
version: ${{ env.NODE_VERSION }} | |
cache: ${{ env.CACHE }} | |
- name: Install dependencies | |
uses: nifty-oss/actions/install-node-dependencies@v1 | |
with: | |
folder: ./clients/js | |
cache: ${{ env.CACHE }} | |
key: client-js | |
- name: Format | |
working-directory: ./clients/js | |
run: pnpm format | |
- name: Lint | |
working-directory: ./clients/js | |
run: pnpm lint | |
build_programs: | |
name: Programs | |
if: ${{ needs.changes.outputs.any == 'true' }} | |
needs: [changes, lint_rust, lint_js] | |
uses: ./.github/workflows/build-programs.yml | |
secrets: inherit | |
test_programs: | |
name: Programs | |
if: ${{ needs.changes.outputs.programs == 'true' }} | |
needs: [changes, lint_rust, lint_js] | |
uses: ./.github/workflows/test-programs.yml | |
secrets: inherit | |
with: | |
program_matrix: ${{ needs.changes.outputs.program_matrix }} | |
generate_clients: | |
name: Generate clients | |
if: ${{ needs.changes.outputs.any == 'true' }} | |
needs: [changes, build_programs] | |
runs-on: buildjet-8vcpu-ubuntu-2204 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Load environment variables | |
run: cat .github/.env >> $GITHUB_ENV | |
- name: Install Linux Build Deps | |
run: sudo apt-get update && sudo apt-get install -y pkg-config build-essential libudev-dev | |
- name: Install Rust | |
uses: nifty-oss/actions/install-rust@v1 | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
- name: Install Solana | |
uses: nifty-oss/actions/install-solana@v1 | |
with: | |
version: ${{ env.SOLANA_VERSION }} | |
cache: ${{ env.CACHE }} | |
- name: Cache program dependencies | |
if: env.CACHE == 'true' | |
uses: nifty-oss/actions/buildjet-cache-crate@v1 | |
with: | |
folder: "." | |
key: programs | |
- name: Install Node.js | |
uses: nifty-oss/actions/install-node-with-pnpm@v1 | |
with: | |
version: ${{ env.NODE_VERSION }} | |
cache: ${{ env.CACHE }} | |
dependencies: true | |
- name: Cache IDL generators | |
if: env.CACHE == 'true' | |
uses: nifty-oss/actions/buildjet-cache-idl-generators@v1 | |
- name: Generate IDLs and clients | |
run: pnpm generate | |
- name: Ensure working directory is clean | |
run: test -z "$(git status --porcelain)" | |
test_js: | |
if: ${{ needs.changes.outputs.js_clients == 'true' }} | |
name: JS Client | |
needs: [changes, generate_clients] | |
uses: ./.github/workflows/test-js-client.yml | |
secrets: inherit | |
with: | |
client_matrix: ${{ needs.changes.outputs.js_client_matrix }} | |
test_rust: | |
if: ${{ needs.changes.outputs.rust_clients == 'true' }} | |
name: Rust Client | |
needs: [changes, generate_clients] | |
uses: ./.github/workflows/test-rust-client.yml | |
secrets: inherit | |
with: | |
client_matrix: ${{ needs.changes.outputs.rust_client_matrix }} | |
build_rust: | |
if: ${{ needs.changes.outputs.rust_clients == 'true' }} | |
name: Rust Client | |
needs: [changes, generate_clients] | |
uses: ./.github/workflows/build-rust-client.yml | |
secrets: inherit | |
with: | |
client_matrix: ${{ needs.changes.outputs.rust_client_matrix }} | |
build_rust_cli: | |
if: ${{ needs.changes.outputs.rust_cli == 'true' }} | |
name: Rust CLI | |
needs: [changes, generate_clients] | |
uses: ./.github/workflows/build-cli.yml | |
secrets: inherit |