-
Notifications
You must be signed in to change notification settings - Fork 1
200 lines (190 loc) · 5.8 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: Main
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
NODE_VERSION: 18
SOLANA_VERSION: 1.18.12
ANCHOR_VERSION: 0.30.0
CARGO_CACHE: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
jobs:
build_programs:
name: Build programs
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup
with:
node: ${{ env.NODE_VERSION }}
solana: ${{ env.SOLANA_VERSION }}
anchor: ${{ env.ANCHOR_VERSION }}
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: ${{ env.CARGO_CACHE }}
key: ${{ runner.os }}-cargo-programs-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-programs
- name: Build programs
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 all builds for clients
uses: actions/cache/save@v4
with:
path: ./**/*.so
key: ${{ runner.os }}-builds-${{ github.sha }}
test_programs:
name: Test programs
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup
with:
node: ${{ env.NODE_VERSION }}
solana: ${{ env.SOLANA_VERSION }}
anchor: ${{ env.ANCHOR_VERSION }}
- name: Cache test cargo dependencies
uses: actions/cache@v4
with:
path: ${{ env.CARGO_CACHE }}
key: ${{ runner.os }}-cargo-program-tests-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-program-tests
${{ runner.os }}-cargo-programs-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-programs
- name: Test programs
run: pnpm programs:test
generate_idls:
name: Check IDL generation
needs: build_programs
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup
with:
node: ${{ env.NODE_VERSION }}
solana: ${{ env.SOLANA_VERSION }}
anchor: ${{ env.ANCHOR_VERSION }}
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: ${{ env.CARGO_CACHE }}
key: ${{ runner.os }}-cargo-programs-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-programs
- name: Cache local cargo dependencies
uses: actions/cache@v4
with:
path: |
.cargo/bin/
.cargo/registry/index/
.cargo/registry/cache/
.cargo/git/db/
key: ${{ runner.os }}-cargo-local-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-local
- name: Generate IDLs
run: pnpm generate:idls
- name: Ensure working directory is clean
run: test -z "$(git status --porcelain)"
generate_clients:
name: Check client generation
needs: build_programs
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup
with:
node: ${{ env.NODE_VERSION }}
solana: ${{ env.SOLANA_VERSION }}
- name: Generate clients
run: pnpm generate:clients
- name: Ensure working directory is clean
run: test -z "$(git status --porcelain)"
test_js:
name: Test JS client
needs: build_programs
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup
with:
node: ${{ env.NODE_VERSION }}
solana: ${{ env.SOLANA_VERSION }}
- name: Restore all builds
uses: actions/cache/restore@v4
with:
path: ./**/*.so
key: ${{ runner.os }}-builds-${{ github.sha }}
- name: Test JS client
run: pnpm clients:js:test
lint_js:
name: Lint JS client
needs: build_programs
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup
with:
node: ${{ env.NODE_VERSION }}
- name: Lint JS client
run: pnpm clients:js:lint
test_rust:
name: Test Rust client
needs: build_programs
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup
with:
node: ${{ env.NODE_VERSION }}
solana: ${{ env.SOLANA_VERSION }}
- name: Cache Rust client dependencies
uses: actions/cache@v4
with:
path: ${{ env.CARGO_CACHE }}
key: ${{ runner.os }}-cargo-rust-client-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-rust-client
- name: Restore all builds
uses: actions/cache/restore@v4
with:
path: ./**/*.so
key: ${{ runner.os }}-builds-${{ github.sha }}
- name: Test Rust client
run: pnpm clients:rust:test
lint_rust:
name: Lint Rust client
needs: build_programs
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup
with:
node: ${{ env.NODE_VERSION }}
- name: Lint Rust client
run: pnpm clients:rust:lint