-
Notifications
You must be signed in to change notification settings - Fork 9
99 lines (85 loc) · 2.95 KB
/
tests.yaml
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
# From https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs#using-the-nodejs-starter-workflow
name: Node.js CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: metadaoproject/[email protected]
with:
# Install Solana CLI (beta, required to fix 'ahash' issue)
solana-cli-version: "1.18.4"
# Remove '--force Force overwriting existing crates or binaries'
# As we want to use the cache if possible
- name: Install Anchor
run: |
cargo install --git https://github.com/coral-xyz/anchor avm --locked
avm install latest
avm use latest
echo "/home/runner/.avm/bin" >> $GITHUB_PATH
# git will keep outputting:
# hint: Using 'master' as the name for the initial branch. This default branch name
# hint: is subject to change.
# Unless we set this.
- name: Set a default branch name for git
run: |
git config --global init.defaultBranch main
- name: Print versions and debugging info
run: |
echo Linux version:
lsb_release -a
echo Solana version:
solana -V
echo Anchor version:
anchor -V
echo build-sbf version:
cargo build-sbf --version
echo Path:
echo $PATH | tr ':' '\n' | sort
- name: Create a blank Anchor project
run: |
anchor init project
# TODO: fixes the following warning:
# warning: package `project v0.1.0 (/home/runner/work/project/project)` does not have a license
# should not be necessary
- name: Fix missing license warning
run: |
cd project
jq '.LICENSE = "UNLICENSED"' package.json > fixed-package.json
mv fixed-package.json package.json
# TODO: fixes:
# Error: Unable to read keypair file
# during 'anchor test'
# should not be necessary
- name: Make a default keypair
run: |
solana-keygen new --no-bip39-passphrase
- name: Fix unused variable warning
run: |
cd project
sed -i 's/ctx/_context/' programs/project/src/lib.rs
# TODO: fixes:
# error: package `solana-program v1.18.11` cannot be built because it requires rustc 1.75.0 or newer, while the currently active rustc version is 1.72.0-dev
# should not be necessary
- name: Fix 'cannot be built' warning
run: |
cd project
cargo add solana-program@"=1.17"
- name: Run anchor build
run: |
cd project
anchor build >> log.txt
- name: Run anchor test
run: |
cd project
anchor test >> log.txt
- name: Check log for errors
run: |
cd project
cat log.txt
cat log.txt | grep -qEv 'error|warn'