-
Notifications
You must be signed in to change notification settings - Fork 6
118 lines (93 loc) · 3.17 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
111
112
113
114
115
116
117
118
name: Main
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: [self-hosted]
env:
COMPOSE_PROJECT_NAME: ci_${{ github.run_id }}
COMPOSE_FILE: ./test/integration/util/docker-compose.yml
COMPOSE_ENV: ./test/integration/util/.env
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: Start docker containers (voconed, blind-csp, vocfaucet)
run: |
docker-compose pull -q
docker-compose up -d
docker-compose images # check logs to see version used
voconed_hostport=$(docker-compose port voconed 9095)
blindcsp_hostport=$(docker-compose port blind-csp 5000)
vocfaucet_hostport=$(docker-compose port vocfaucet 8080)
cat << EOF >> $GITHUB_ENV
API_URL=http://$voconed_hostport/v2
BLINDCSP_URL=http://$blindcsp_hostport/v1
FAUCET_URL=http://$vocfaucet_hostport/v2
EOF
# source all env vars in ${{ env.COMPOSE_ENV }}
# and merge them into GHA environment, some are needed in the following steps
env -i sh -o allexport -c '. ${{ env.COMPOSE_ENV }} ; env' >> $GITHUB_ENV
- name: Wait until voconed is ready
run: |
for i in {1..20}; do
if curl -s --fail ${{ env.API_URL }}/chain/info 2>/dev/null ; then
exit 0
fi
date
sleep 1
done
echo "timed out waiting"
exit 1
- name: Integration tests
run: yarn test:integration --ci --coverage --maxWorkers=2
- name: Service tests
run: yarn test:service --ci --coverage --maxWorkers=2
- name: API tests
run: yarn test:api --ci --coverage --maxWorkers=2
- name: Anonymous integration tests
run: yarn test:integration:zk --ci --coverage
- name: Debug docker logs in case of failure
if: failure()
run: docker-compose logs
- name: Stop and cleanup docker containers
if: always()
run: docker-compose down -v