-
Notifications
You must be signed in to change notification settings - Fork 2.1k
332 lines (283 loc) · 9.76 KB
/
pull-request-token.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
name: Token Pull Request
on:
pull_request:
paths:
- 'associated-token-account/**'
- 'token/**'
- 'ci/*-version.sh'
- '.github/workflows/pull-request-token.yml'
push:
branches: [master]
paths:
- 'associated-token-account/**'
- 'token/**'
- 'ci/*-version.sh'
- '.github/workflows/pull-request-token.yml'
jobs:
cargo-test-sbf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Clear disk space
run: |
# if we need more: `sudo apt-get install -y wajig && wajig large`
for p in ant mono-complete lldb-14 google-cloud-sdk azure-cli microsoft-edge-stable \
google-chrome-stable firefox powershell mono-devel dotnet-sdk-6.0 dotnet-sdk-7.0 \
temurin-8-jdk temurin-11-jdk temurin-17-jdk llvm-12-dev llvm-13-dev llvm-14-dev \
fake-canary-package; do sudo apt-get remove -y $p || true; done
sudo apt-get autoremove -y
sudo rm -rf /imagegeneration
- name: Set env vars
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
source ci/solana-version.sh
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
override: true
profile: minimal
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/rustfilt
key: cargo-sbf-bins-${{ runner.os }}
- uses: actions/cache@v2
with:
path: ~/.cache/solana
key: solana-${{ env.SOLANA_VERSION }}
- name: Install dependencies
run: |
./ci/install-build-deps.sh
./ci/install-program-deps.sh
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Build and test token
run: ./ci/cargo-test-sbf.sh token
- name: Upload programs
uses: actions/upload-artifact@v2
with:
name: token-programs
path: "target/deploy/*.so"
if-no-files-found: error
cargo-test-token-2022-serde:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set env vars
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
source ci/solana-version.sh
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
override: true
profile: minimal
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
- name: Test token-2022 with "serde" activated
run: |
cargo test \
--manifest-path=token/program-2022/Cargo.toml \
--features serde-traits \
-- --nocapture
cargo-test-sbf-transfer-hook:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set env vars
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
source ci/solana-version.sh
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
override: true
profile: minimal
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/rustfilt
key: cargo-sbf-bins-${{ runner.os }}
- uses: actions/cache@v2
with:
path: ~/.cache/solana
key: solana-${{ env.SOLANA_VERSION }}
- name: Install dependencies
run: |
./ci/install-build-deps.sh
./ci/install-program-deps.sh
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Build and test transfer hook example
run: ./ci/cargo-test-sbf.sh token/transfer-hook-example
- name: Upload program
uses: actions/upload-artifact@v2
with:
name: spl-transfer-hook-example
path: "target/deploy/*.so"
if-no-files-found: error
cargo-test-sbf-associated-token-account:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set env vars
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
source ci/solana-version.sh
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
override: true
profile: minimal
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}
- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/rustfilt
key: cargo-sbf-bins-${{ runner.os }}
- uses: actions/cache@v2
with:
path: ~/.cache/solana
key: solana-${{ env.SOLANA_VERSION }}
- name: Install dependencies
run: |
./ci/install-build-deps.sh
./ci/install-program-deps.sh
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Build and test ATA
run: ./ci/cargo-test-sbf.sh associated-token-account
- name: Upload program
uses: actions/upload-artifact@v2
with:
name: associated-token-account-program
path: "target/deploy/*.so"
if-no-files-found: error
cargo-test-sbf-twoxtx:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Remove unneeded packages for more space
run: bash ./ci/warning/purge-ubuntu-runner.sh
- name: Set env vars
run: |
echo "RUST_STABLE_VERSION=1.72.0" >> $GITHUB_ENV
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
source ci/solana-version.sh
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE_VERSION }}
override: true
profile: minimal
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE_VERSION }}
- name: Install dependencies
run: |
./ci/install-build-deps.sh
./ci/install-program-deps.sh
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Build and test token-2022 twoxtx (TEMPORARY)
run: |
cargo build-sbf --manifest-path token/program-2022/Cargo.toml
cargo build-sbf --manifest-path instruction-padding/program/Cargo.toml
./token/twoxtx-setup.sh
./token/twoxtx-solana/cargo-test-sbf --manifest-path token/program-2022-test/Cargo.toml -- --nocapture
js-test:
runs-on: ubuntu-latest
env:
NODE_VERSION: 16.x
needs: [cargo-test-sbf, cargo-test-sbf-associated-token-account]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: node-${{ hashFiles('token/js/package-lock.json') }}
restore-keys: |
node-
- name: Download programs
uses: actions/download-artifact@v2
with:
name: token-programs
path: target/deploy
- name: Download associated-token-account program
uses: actions/download-artifact@v2
with:
name: associated-token-account-program
path: target/deploy
- name: Download spl-transfer-hook-example program
uses: actions/download-artifact@v2
with:
name: spl-transfer-hook-example
path: target/deploy
- run: ./ci/js-test-token.sh
cargo-build-test-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set env vars
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
source ci/solana-version.sh
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
override: true
profile: minimal
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE }}
- uses: actions/cache@v2
with:
path: ~/.cache/solana
key: solana-${{ env.SOLANA_VERSION }}
- name: Install dependencies
run: |
./ci/install-build-deps.sh
./ci/install-program-deps.sh
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Build and test
run: |
BUILD_DEPENDENT_PROGRAMS=1 cargo build --manifest-path ./token/cli/Cargo.toml
cargo test --manifest-path ./token/cli/Cargo.toml