-
Notifications
You must be signed in to change notification settings - Fork 229
200 lines (172 loc) · 6.34 KB
/
test-unit.yml
File metadata and controls
200 lines (172 loc) · 6.34 KB
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: Unit Tests
on:
pull_request:
# Allow concurrent runs on main/release branches but isolates other branches
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }}
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Check for Go-related changes"
id: check_nibiru_go
uses: dorny/paths-filter@v3
with:
filters: |
nibiru-go:
- "app/**/*.go"
- "cmd/**/*.go"
- "eth/**/*.go"
- "gosdk/**/*.go"
- "x/**/*.go"
- "**/*.proto"
- "go.mod"
- "go.sum"
- "contrib/docker-compose/*"
- name: skip-tests
if: steps.check_nibiru_go.outputs.nibiru-go == 'false'
run: |
echo "job: unit-tests was skipped since Nibiru Golang files were not changed."
- name: "Set up Go"
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
uses: actions/setup-go@v5
with:
go-version: 1.24
# cache: "The action has a built-in functionality for caching and
# restoring go modules and build outputs. It uses [actions/cache@v4]."
# - Handles go module cache (go env GOMODCACHE).
# - Handles go build cache (go env GOCACHE).
cache: true
- name: "Install just"
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
# casey/just: https://just.systems/man/en/chapter_6.html
# taiki-e/install-action: https://github.com/taiki-e/install-action
uses: taiki-e/install-action@just
- name: Run all unit tests.
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
run: just test-unit
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Check for Go-related changes"
id: check_nibiru_go
uses: dorny/paths-filter@v3
with:
filters: |
nibiru-go:
- "app/**/*.go"
- "cmd/**/*.go"
- "eth/**/*.go"
- "gosdk/**/*.go"
- "x/**/*.go"
- "**/*.proto"
- "go.mod"
- "go.sum"
- "contrib/docker-compose/*"
- name: "Set up Go"
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
uses: actions/setup-go@v5
with:
go-version: 1.24
- name: "Install just"
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
# casey/just: https://just.systems/man/en/chapter_6.html
# taiki-e/install-action: https://github.com/taiki-e/install-action
uses: taiki-e/install-action@just
- name: "Build the nibid binary"
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
run: |
just install
- name: "Run scripts/chaosnet.sh (Used in Docker image)"
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
run: |
just test-chaosnet
- name: "Run scripts/localnet.sh"
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
run: |
just test-localnet
# proto-gen-rs: Tests the script that generates protobuf bindings in Rust
proto-gen-rs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Check for Go-related changes"
id: check_nibiru_go
uses: dorny/paths-filter@v3
with:
filters: |
nibiru-go:
- "app/**/*.go"
- "cmd/**/*.go"
- "eth/**/*.go"
- "gosdk/**/*.go"
- "x/**/*.go"
- "**/*.proto"
- "go.mod"
- "go.sum"
- "contrib/docker-compose/*"
- name: skip-tests
if: steps.check_nibiru_go.outputs.nibiru-go == 'false'
run: |
echo "job: proto-gen-rs was skipped since Nibiru Golang files were not changed."
- name: "Set up Go"
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
uses: actions/setup-go@v5
with:
go-version: 1.24
cache: false # Repo go code is not used in this job.
- name: "Install buf CLI"
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
run: |
go install github.com/bufbuild/buf/cmd/buf@latest
- name: "Setup Node & npm (for npx)"
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
uses: actions/setup-node@v4
with:
node-version: "lts/jod" # Node v20
- name: "Generate Rust proto bindings"
if: steps.check_nibiru_go.outputs.nibiru-go == 'true'
run: |
bash proto/buf.gen.rs.sh
cosmos-sdk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Check for Go-related changes"
id: check_changes
uses: dorny/paths-filter@v3
with:
filters: |
check_changes:
- "internal/cosmos-sdk/**/*.go"
- "internal/cosmos-sdk/go.mod"
- "internal/cosmos-sdk/go.sum"
- "internal/cosmos-sdk/**/*.proto"
- "internal/cosmos-sdk/justfile"
- name: skip-tests
if: steps.check_changes.outputs.check_changes == 'false'
run: |
echo "job \"cosmos-sdk\" was skipped since relevant files were not changed."
- name: "Set up Go"
if: steps.check_changes.outputs.check_changes == 'true'
uses: actions/setup-go@v5
with:
go-version: 1.24
# cache: "The action has a built-in functionality for caching and
# restoring go modules and build outputs. It uses [actions/cache@v4]."
# - Handles go module cache (go env GOMODCACHE).
# - Handles go build cache (go env GOCACHE).
cache: true
- name: "Install just"
if: steps.check_changes.outputs.check_changes == 'true'
# casey/just: https://just.systems/man/en/chapter_6.html
# taiki-e/install-action: https://github.com/taiki-e/install-action
uses: taiki-e/install-action@just
- name: Run tests for internal/cosmos-sdk
if: steps.check_changes.outputs.check_changes == 'true'
working-directory: "internal/cosmos-sdk"
run: |
just test