Skip to content

Commit f8bbbb7

Browse files
authored
CI: Add program and all extra steps (#13)
* 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
1 parent 30521a1 commit f8bbbb7

25 files changed

+2519
-2167
lines changed

Diff for: .github/workflows/main.yml

+133-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,85 @@ jobs:
4343
- name: Lint Client Rust
4444
run: pnpm clients:rust:lint
4545

46+
format_and_lint_program:
47+
name: Format & Lint Program
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Git Checkout
51+
uses: actions/checkout@v4
52+
53+
- name: Setup Environment
54+
uses: ./.github/actions/setup
55+
with:
56+
clippy: true
57+
rustfmt: true
58+
59+
- name: Format
60+
run: pnpm programs:format
61+
62+
- name: Lint
63+
run: pnpm programs:lint
64+
65+
audit_rust:
66+
name: Audit Rust
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Git Checkout
70+
uses: actions/checkout@v4
71+
72+
- name: Setup Environment
73+
uses: ./.github/actions/setup
74+
with:
75+
cargo-cache-key: cargo-audit
76+
77+
- name: Install cargo-audit
78+
uses: taiki-e/install-action@v2
79+
with:
80+
tool: cargo-audit
81+
82+
- name: Run cargo-audit
83+
run: pnpm rust:audit
84+
85+
semver_rust:
86+
name: Check semver Rust
87+
runs-on: ubuntu-latest
88+
steps:
89+
- name: Git Checkout
90+
uses: actions/checkout@v4
91+
92+
- name: Setup Environment
93+
uses: ./.github/actions/setup
94+
with:
95+
cargo-cache-key: cargo-semver
96+
97+
- name: Install cargo-audit
98+
uses: taiki-e/install-action@v2
99+
with:
100+
tool: cargo-semver-checks
101+
102+
- name: Run semver checks
103+
run: pnpm rust:semver
104+
105+
spellcheck_rust:
106+
name: Spellcheck Rust
107+
runs-on: ubuntu-latest
108+
steps:
109+
- name: Git Checkout
110+
uses: actions/checkout@v4
111+
112+
- name: Setup Environment
113+
uses: ./.github/actions/setup
114+
with:
115+
cargo-cache-key: cargo-spellcheck
116+
117+
- name: Install cargo-spellcheck
118+
uses: taiki-e/install-action@v2
119+
with:
120+
tool: cargo-spellcheck
121+
122+
- name: Run cargo-spellcheck
123+
run: pnpm rust:spellcheck
124+
46125
generate_clients:
47126
name: Check Client Generation
48127
runs-on: ubuntu-latest
@@ -63,10 +142,40 @@ jobs:
63142
git status --porcelain
64143
test -z "$(git status --porcelain)"
65144
145+
build_program:
146+
name: Build Program
147+
runs-on: ubuntu-latest
148+
needs: format_and_lint_program
149+
steps:
150+
- name: Git Checkout
151+
uses: actions/checkout@v4
152+
153+
- name: Setup Environment
154+
uses: ./.github/actions/setup
155+
with:
156+
cargo-cache-key: cargo-build-program
157+
solana: true
158+
159+
- name: Build
160+
run: pnpm programs:build
161+
162+
- name: Upload Program Builds
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: program-builds
166+
path: ./target/deploy/*.so
167+
if-no-files-found: error
168+
169+
- name: Save Program Builds For Client Jobs
170+
uses: actions/cache/save@v4
171+
with:
172+
path: ./**/*.so
173+
key: ${{ runner.os }}-builds-${{ github.sha }}
174+
66175
test_client_js:
67176
name: Test Client JS
68177
runs-on: ubuntu-latest
69-
needs: format_and_lint_client_js
178+
needs: [format_and_lint_client_js, build_program]
70179
steps:
71180
- name: Git Checkout
72181
uses: actions/checkout@v4
@@ -76,6 +185,12 @@ jobs:
76185
with:
77186
solana: true
78187

188+
- name: Restore Program Builds
189+
uses: actions/cache/restore@v4
190+
with:
191+
path: ./**/*.so
192+
key: ${{ runner.os }}-builds-${{ github.sha }}
193+
79194
- name: Test Client JS
80195
run: pnpm clients:js:test
81196

@@ -96,3 +211,20 @@ jobs:
96211

97212
- name: Test Client Rust
98213
run: pnpm clients:rust:test
214+
215+
test_program:
216+
name: Test Program
217+
runs-on: ubuntu-latest
218+
needs: format_and_lint_program
219+
steps:
220+
- name: Git Checkout
221+
uses: actions/checkout@v4
222+
223+
- name: Setup Environment
224+
uses: ./.github/actions/setup
225+
with:
226+
cargo-cache-key: cargo-test-program
227+
solana: true
228+
229+
- name: Test
230+
run: pnpm programs:test

0 commit comments

Comments
 (0)