-
Notifications
You must be signed in to change notification settings - Fork 6
110 lines (91 loc) · 3.94 KB
/
main.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
name: Main-CI
on:
push:
branches:
- main
pull_request: ~
jobs:
build:
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['18.x']
os: [ubuntu-latest, windows-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
run: yarn
- name: Lint
run: yarn lint
- name: Unit tests
run: yarn test:unit --ci --coverage
integration:
name: Integration tests on self-hosted
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['18.x']
os: [ci1]
steps:
# TODO: somehow reuse artifact from ubuntu-latest 'build' job?
# instead of building from scratch on self-hosted
- name: Checkout repo
uses: actions/checkout@v3
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
# self-hosted runners do not have yarn installed 😕
- name: Install yarn
run: npm i -g yarn
- name: Install deps
run: yarn
- name: Set COMPOSE_PROJECT_NAME for voconed
run: echo COMPOSE_PROJECT_NAME=${RANDOM}${RANDOM}_ci >> $GITHUB_ENV
- name: Start voconed (ephemeral vochain for integration test)
run: |
docker-compose -f test/integration/util/docker-compose.yml pull -q
docker-compose -f test/integration/util/docker-compose.yml up -d
docker-compose -f test/integration/util/docker-compose.yml images # check logs to see version used
echo -n "voconed_hostport=" >> $GITHUB_ENV
docker-compose -f test/integration/util/docker-compose.yml port voconed 9095 >> $GITHUB_ENV
echo -n "blindcsp_hostport=" >> $GITHUB_ENV
docker-compose -f test/integration/util/docker-compose.yml port blind-csp 5000 >> $GITHUB_ENV
- name: Integration tests
run: yarn test:integration --ci --coverage --maxWorkers=2
env:
API_URL: http://${{ env.voconed_hostport }}/v2
BLINDCSP_URL: http://${{ env.blindcsp_hostport }}/v1
BLINDCSP_PRIVKEY: f6e530882cde11e2050989d04c3fc523412b2fc2723c0a6155932a62ffafc2b6
# that privkey is hardcoded in docker-compose.yml and corresponds to:
# address 0xc3E925C7D971601c85eB042032F415852E56A038
# CSP root key 039d3ea0d911f4497903e3701b19b9c2efa2b7c3c646f3fc63d46d0a684b781b82
BLINDCSP_PUBKEY: 039d3ea0d911f4497903e3701b19b9c2efa2b7c3c646f3fc63d46d0a684b781b82
FAUCET_URL: ${{ secrets.FAUCET_URL }}
FAUCET_AUTH_TOKEN: ${{ secrets.FAUCET_AUTH_TOKEN }}
FAUCET_TOKEN_LIMIT: 100
- name: Anonymous integration tests
run: yarn test:integration:zk --ci --coverage
env:
API_URL: http://${{ env.voconed_hostport }}/v2
BLINDCSP_URL: http://${{ env.blindcsp_hostport }}/v1
BLINDCSP_PRIVKEY: f6e530882cde11e2050989d04c3fc523412b2fc2723c0a6155932a62ffafc2b6
# that privkey is hardcoded in docker-compose.yml and corresponds to:
# address 0xc3E925C7D971601c85eB042032F415852E56A038
# CSP root key 039d3ea0d911f4497903e3701b19b9c2efa2b7c3c646f3fc63d46d0a684b781b82
BLINDCSP_PUBKEY: 039d3ea0d911f4497903e3701b19b9c2efa2b7c3c646f3fc63d46d0a684b781b82
FAUCET_URL: ${{ secrets.FAUCET_URL }}
FAUCET_AUTH_TOKEN: ${{ secrets.FAUCET_AUTH_TOKEN }}
FAUCET_TOKEN_LIMIT: 100
- name: Debug voconed logs on failure
if: failure()
run: docker-compose -f test/integration/util/docker-compose.yml logs
- name: Stop voconed (ephemeral vochain for integration test)
if: success() || failure()
run: docker-compose -f test/integration/util/docker-compose.yml down -v