-
-
Notifications
You must be signed in to change notification settings - Fork 9
238 lines (194 loc) · 6.6 KB
/
lint-and-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
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
name: Test Matrix
on:
push:
branches:
- '*'
- '!gh-pages'
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-and-test:
name: Test Node.js ${{ matrix.node-version }} on ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
node-version: [18, 20]
runs-on: ubuntu-latest
env:
SSH_PATH: ${{ github.workspace }}/.ssh
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: /etc/hosts
run: |
sudo echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts
shell: bash
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Install pcap
run: sudo apt-get install -y libpcap-dev
- name: Clone Mainchain
run: |
git clone --depth 1 -b napi-bindings https://github.com/argonprotocol/mainchain.git
cp mainchain/localchain/npm/**/*.node mainchain/localchain
working-directory: ..
- name: Install mainchain
run: yarn
working-directory: ../mainchain
- name: Install Mainchain client
run: yarn tsc
working-directory: ../mainchain/client/nodejs
- name: Clone Hero
run: |
git clone -n --recurse-submodules https://github.com/ulixee/hero.git
cd hero
(git fetch --depth 1 origin $GITHUB_REF_NAME && git checkout $GITHUB_REF_NAME) || (git fetch --depth 1 origin main && git checkout main)
git submodule update --init --recursive --depth 1
working-directory: ..
- name: Install Hero
run: yarn build
working-directory: ../hero
- name: Set yarn config
run: yarn config set ignore-engines true && yarn config set frozen-lockfile true
- name: Yarn build
run: yarn build
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
- name: Redo mainchain deps
run: yarn
working-directory: ../mainchain/client/nodejs
- name: Linux - Apt Install Chrome(s)
working-directory: ./build
run: sudo $(npx install-browser-deps)
- name: Run Lint
if: ${{ matrix.node-version == 18 }}
run: NODE_OPTIONS=--max-old-space-size=4096 yarn lint
- name: Run tests
run: yarn test --testTimeout=60000 --maxWorkers=2
env:
ADD_DOCKER_HOST: true
ULX_USE_DOCKER_BINS: 1
CI: true
- name: 'Tar files'
if: ${{ failure() }}
run: tar -cvf test-dbs.tar build/.data-test
- name: Upload Databases
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-dbs-${{matrix.os}}-${{ matrix.node-version }}
path: test-dbs.tar
retention-days: 1
test:
name: Test Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
node-version: [18, 20]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- uses: actions/setup-go@v5
with:
go-version: '1.23'
- uses: actions/setup-python@v5
if: ${{ matrix.os != 'windows-latest' }}
with:
python-version: '3.10'
- name: Chocolatey Install Action
if: ${{ matrix.os == 'windows-latest' }}
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install python2 visualcpp-build-tools -y
- name: Add msbuild to PATH
if: ${{ matrix.os == 'windows-latest' }}
uses: microsoft/setup-msbuild@v2
- name: Clear space
if: ${{ matrix.os == 'macos-latest' }}
run: |
sudo rm -rf /Users/runner/Library/Android/sdk
sudo rm -rf /Users/runner/hostedtoolcache/CodeQL
sudo rm -rf /Users/runner/Library/Developer/CoreSimulator
sudo rm -rf /Users/runner/Library/Developer/Xcode/DerivedData
sudo rm -rf /Users/runner/Library/Developer/Xcode/iOS DeviceSupport
sudo rm -rf /Users/runner/Library/Developer/Xcode/watchOS DeviceSupport
- name: Clone Mainchain
shell: bash
run: |
git clone -b napi-bindings https://github.com/argonprotocol/mainchain.git
cp mainchain/localchain/npm/**/*.node mainchain/localchain
working-directory: ..
- name: Install mainchain
run: yarn
working-directory: ../mainchain
- name: Install Mainchain client
run: yarn tsc
working-directory: ../mainchain/client/nodejs
- name: Clone Hero
run: |
git clone -n --recurse-submodules https://github.com/ulixee/hero.git
cd hero
(git fetch --depth 1 origin $GITHUB_REF_NAME && git checkout $GITHUB_REF_NAME) || (git fetch --depth 1 origin main && git checkout main)
git submodule update --init --recursive --depth 1
working-directory: ..
- name: Install Hero
run: yarn build
working-directory: ../hero
- name: Install Deps
run: yarn config set ignore-engines true
- name: Yarn build
run: yarn build
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
ULX_MITM_REBUILD_SOCKET: 0
NODE_OPTIONS: --max_old_space_size=4096
- name: Redo mainchain deps
run: yarn
working-directory: ../mainchain/client/nodejs
- name: Run tests
run: yarn test --testTimeout=60000 --maxWorkers=2
env:
SKIP_E2E: true
CI: true
ULX_DATASTORE_TMP_DIR: ${{ github.workspace }}/build/.data-test-tmp
- name: 'Tar files'
if: ${{ failure() }}
run: tar -cvf test-dbs.tar build/.data-test
- name: Upload Databases
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-dbs-${{matrix.os}}-${{ matrix.node-version }}
path: test-dbs.tar
retention-days: 1