-
Notifications
You must be signed in to change notification settings - Fork 5
87 lines (76 loc) · 2.55 KB
/
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
name: test CI
on: [push]
env:
BATCH_GATEWAY_URLS: '["https://universal-offchain-unwrapper.ens-cf.workers.dev/"]'
DOH_GATEWAY_URL: 'https://cloudflare-dns.com/dns-query'
HARDHAT_DISABLE_TELEMETRY_PROMPT: true
REGISTRAR_ADDRESS: ${{ vars.REGISTRAR_ADDRESS }}
REGISTRY_ADDRESS: ${{ vars.REGISTRY_ADDRESS }}
RESOLVER_ADDRESS: ${{ vars.RESOLVER_ADDRESS }}
WRAPPER_ADDRESS: ${{ vars.WRAPPER_ADDRESS }}
jobs:
e2e:
name: Run tests on Node ${{ matrix.node }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['18.x', '20.x']
os: [ubuntu-latest, macOS-latest]
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
- name: Check out ENS contracts
uses: actions/checkout@v3
with:
repository: ensdomains/ens-contracts
path: './contracts'
ref: '6b9aaae963f71792ab1a75de61d5151ff1d1b7e3'
- name: Run local node
run: |
cd ./contracts
yarn
npx hardhat node --hostname 127.0.0.1 > hardhat_output.log 2>&1 &
echo $! > hardhat_pid.txt
env:
BATCH_GATEWAY_URLS: '["https://universal-offchain-unwrapper.ens-cf.workers.dev/"]'
DOH_GATEWAY_URL: 'https://cloudflare-dns.com/dns-query'
- name: Wait for local node
run: |
timeout=300
while true; do
if [ $timeout -le 0 ]; then
echo "Timeout waiting for Hardhat node"
cat hardhat_output.log
exit 1
fi
if nc -z localhost 8545 2>/dev/null; then
echo "Hardhat node is up and running"
break
fi
echo "Waiting for Hardhat node... ($timeout seconds left)"
sleep 5
timeout=$((timeout - 5))
done
shell: bash
- name: Test
run: yarn test --ci --coverage --maxWorkers=2
- name: Upload Hardhat logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: hardhat-logs
path: ./contracts/hardhat_output.log
- name: Cleanup Hardhat process
if: always()
run: |
if [ -f ./contracts/hardhat_pid.txt ]; then
pid=$(cat ./contracts/hardhat_pid.txt)
kill $pid 2>/dev/null || true
fi
shell: bash