Skip to content

Commit

Permalink
CI: Add program and all extra steps (#13)
Browse files Browse the repository at this point in the history
* CI: Add program and all extra steps

#### Problem

The token program now lives in its program-specific repo, but no part of
it is being exercised by CI.

#### Summary of changes

Integrate the token program properly into CI. This includes:

* add it to the Cargo workspace, and removing spl-token-client, since
  it's currently empty
* run lint / format / test on the program
* run spellcheck / audit / semver checks on the Rust packages
* move rust scripts to `scripts/rust` and make them reusable
* update to Solana 2.1 and proper rust toolchains

* Move JS scripts around, build program too
  • Loading branch information
joncinque authored Dec 18, 2024
1 parent 30521a1 commit f8bbbb7
Show file tree
Hide file tree
Showing 25 changed files with 2,519 additions and 2,167 deletions.
134 changes: 133 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,85 @@ jobs:
- name: Lint Client Rust
run: pnpm clients:rust:lint

format_and_lint_program:
name: Format & Lint Program
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
clippy: true
rustfmt: true

- name: Format
run: pnpm programs:format

- name: Lint
run: pnpm programs:lint

audit_rust:
name: Audit Rust
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

- name: Install cargo-audit
uses: taiki-e/install-action@v2
with:
tool: cargo-audit

- name: Run cargo-audit
run: pnpm rust:audit

semver_rust:
name: Check semver Rust
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-semver

- name: Install cargo-audit
uses: taiki-e/install-action@v2
with:
tool: cargo-semver-checks

- name: Run semver checks
run: pnpm rust:semver

spellcheck_rust:
name: Spellcheck Rust
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-spellcheck

- name: Install cargo-spellcheck
uses: taiki-e/install-action@v2
with:
tool: cargo-spellcheck

- name: Run cargo-spellcheck
run: pnpm rust:spellcheck

generate_clients:
name: Check Client Generation
runs-on: ubuntu-latest
Expand All @@ -63,10 +142,40 @@ jobs:
git status --porcelain
test -z "$(git status --porcelain)"
build_program:
name: Build Program
runs-on: ubuntu-latest
needs: format_and_lint_program
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-build-program
solana: true

- name: Build
run: pnpm programs:build

- name: Upload Program Builds
uses: actions/upload-artifact@v4
with:
name: program-builds
path: ./target/deploy/*.so
if-no-files-found: error

- name: Save Program Builds For Client Jobs
uses: actions/cache/save@v4
with:
path: ./**/*.so
key: ${{ runner.os }}-builds-${{ github.sha }}

test_client_js:
name: Test Client JS
runs-on: ubuntu-latest
needs: format_and_lint_client_js
needs: [format_and_lint_client_js, build_program]
steps:
- name: Git Checkout
uses: actions/checkout@v4
Expand All @@ -76,6 +185,12 @@ jobs:
with:
solana: true

- name: Restore Program Builds
uses: actions/cache/restore@v4
with:
path: ./**/*.so
key: ${{ runner.os }}-builds-${{ github.sha }}

- name: Test Client JS
run: pnpm clients:js:test

Expand All @@ -96,3 +211,20 @@ jobs:

- name: Test Client Rust
run: pnpm clients:rust:test

test_program:
name: Test Program
runs-on: ubuntu-latest
needs: format_and_lint_program
steps:
- name: Git Checkout
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup
with:
cargo-cache-key: cargo-test-program
solana: true

- name: Test
run: pnpm programs:test
Loading

0 comments on commit f8bbbb7

Please sign in to comment.