-
Notifications
You must be signed in to change notification settings - Fork 2
120 lines (112 loc) · 4.19 KB
/
run_test.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
name: run-test
on:
pull_request:
branches:
- main
jobs:
test-gnoswap:
runs-on: ubuntu-latest
# fail-fast: false ensures that if one matrix entry fails,
# it doesn't cancel the others.
strategy:
fail-fast: false
matrix:
include:
- name: "p/uint256"
folder: "gno/examples/gno.land/p/gnoswap/uint256"
- name: "p/int256"
folder: "gno/examples/gno.land/p/gnoswap/int256"
- name: "p/gnsmath"
folder: "gno/examples/gno.land/p/gnoswap/gnsmath"
- name: "r/common"
folder: "gno/examples/gno.land/r/gnoswap/v1/common"
- name: "r/gns"
folder: "gno/examples/gno.land/r/gnoswap/v1/gns"
- name: "r/gnft"
folder: "gno/examples/gno.land/r/gnoswap/v1/gnft"
- name: "r/gov/xgns"
folder: "gno/examples/gno.land/r/gnoswap/v1/gov/xgns"
- name: "r/emission"
folder: "gno/examples/gno.land/r/gnoswap/v1/emission"
- name: "r/protocol_fee"
folder: "gno/examples/gno.land/r/gnoswap/v1/protocol_fee"
- name: "r/pool"
folder: "gno/examples/gno.land/r/gnoswap/v1/pool"
- name: "r/position"
folder: "gno/examples/gno.land/r/gnoswap/v1/position"
- name: "r/router"
folder: "gno/examples/gno.land/r/gnoswap/v1/router"
- name: "r/staker"
folder: "gno/examples/gno.land/r/gnoswap/v1/staker"
- name: "r/community_pool"
folder: "gno/examples/gno.land/r/gnoswap/v1/community_pool"
- name: "r/gov/staker"
folder: "gno/examples/gno.land/r/gnoswap/v1/gov/staker"
- name: "r/gov/governance"
folder: "gno/examples/gno.land/r/gnoswap/v1/gov/governance"
- name: "r/launchpad"
folder: "gno/examples/gno.land/r/gnoswap/v1/launchpad"
steps:
# 1. Check out gnoswap repository (with your workflow file, etc.)
- name: Check out gnoswap repo
uses: actions/checkout@v4
# 2. Check out gno(master) into ./gno
- name: Check out gno(master)
uses: actions/checkout@v4
with:
repository: gnolang/gno
ref: master # can be used with tag also (e.g `chain/test5.0`)
path: ./gno
# 3. Install Go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
# 4. Configure gnovm
- name: Config gnovm
run: |
sed -i 's/ctx.Timestamp += (count \* 5)/ctx.Timestamp += (count \* 2)/g' ./gno/gnovm/tests/stdlibs/std/std.go
# 5. Build/install `gno` CLI
- name: Install gno
run: |
cd gno
make install.gno
# 6. Set up Python
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.12
# 7. Check out your gnoswap repo into ./tmp/gnoswap
- name: Checkout gnoswap(main)
uses: actions/checkout@v4
with:
path: ./tmp/gnoswap
# 8. Run setup.py (copy contracts into gno)
- name: Run setup.py
run: |
cd tmp/gnoswap
python3 setup.py -w /home/runner/work/gnoswap/gnoswap
# 9. Now run the tests in parallel via the matrix.
# Each job will handle ONE contract from the matrix.
- name: "Run tests for ${{ matrix.name }}"
# if any test fails, we keep going to test all contracts:
# continue-on-error: true
run: |
FOLDER="${{ matrix.folder }}"
# 1) Run unit tests first
gno test ./"$FOLDER" \
-root-dir /home/runner/work/gnoswap/gnoswap/gno -v
# 2) Remove all _test.gno except _helper_test.gno
find ./"$FOLDER" -type f -name "*_test.gno" \
! -name "_helper_test.gno" \
-exec rm -f {} +
# 3) One-by-one gnoA tests: rename *.gnoA => *.gno, run, revert
cd ./"$FOLDER"
TESTFILES=$(ls | grep '_test.gnoA$' || true)
for f in $TESTFILES; do
base="${f%.gnoA}"
mv "$f" "$base.gno"
gno test . \
-root-dir /home/runner/work/gnoswap/gnoswap/gno -v
mv "$base.gno" "$f"
done