-
Notifications
You must be signed in to change notification settings - Fork 1
149 lines (145 loc) · 5.01 KB
/
ci.yaml
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
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
lint-build-test:
name: Lint, build and test
runs-on: ubuntu-latest
outputs:
JOB_LINT: ${{ steps.lint.outcome }}
JOB_TEST: ${{ steps.test.outcome }}
JOB_BUILD: ${{ steps.build.outcome }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: "npm"
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ runner.os }}-${{ github.sha }}
restore-keys: |
turbo-${{ runner.os }}
- run: npm ci
- id: lint
run: npm run lint -- --cache-dir=".turbo"
- id: build
run: npm run build -- --cache-dir=".turbo"
- id: test
run: npm run test -- --cache-dir=".turbo"
e2e-tests:
name: Run e2e tests
runs-on: ubuntu-22.04
needs: [lint-build-test]
steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
token: ${{ secrets.BSNORG_ACTIONS_SECRET }}
- uses: actions/setup-node@v3
with:
node-version: "16"
# NOTE: Disabled until https://github.com/actions/setup-node/issues/516 is resolved
# cache: "npm"
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ runner.os }}-${{ github.sha }}
restore-keys: |
turbo-${{ runner.os }}
- run: npm ci
- name: Build
run: |
npm run build -- --cache-dir=".turbo"
- run: cd e2e && docker compose build && cd ..
# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
# Rerun the test to be able to publish all coverage reports in the same flow
- name: Run packages test
run: npm run test -- --force
- name: Run e2e tests
run: npm run e2e:suite
- name: Upload common package coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/common/coverage/coverage-final.json
flags: unittests,common
- name: Upload core-sdk package coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/core-sdk/coverage/coverage-final.json
flags: unittests,core-sdk
- name: Upload eth-connect-sdk package coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/eth-connect-sdk/coverage/coverage-final.json
flags: unittests,eth-connect-sdk
- name: Upload ethers-sdk package coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/ethers-sdk/coverage/coverage-final.json
flags: unittests,ethers-sdk
- name: Upload ipfs-storage package coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/ipfs-storage/coverage/coverage-final.json
flags: unittests,ipfs-storage
- name: Upload metadata package coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/metadata/coverage/coverage-final.json
flags: unittests,metadata
- name: Upload e2e tests coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./e2e/coverage/coverage-final.json
flags: e2e
job-summary:
name: Create Job Summary
runs-on: ubuntu-latest
if: always()
needs: [lint-build-test]
env:
JOB_LINT: ${{ needs.lint-build-test.outputs.JOB_LINT }}
JOB_TEST: ${{ needs.lint-build-test.outputs.JOB_TEST }}
JOB_BUILD: ${{ needs.lint-build-test.outputs.JOB_BUILD }}
steps:
- uses: actions/checkout@v3
- name: Adding Job Summary
run: |
echo "| Command | Status |" >> $GITHUB_STEP_SUMMARY
echo "| ---- | ---- |" >> $GITHUB_STEP_SUMMARY
if [ ${{ env.JOB_LINT }} == success ]; then
echo "| Lint | ✅ |" >> $GITHUB_STEP_SUMMARY
else
echo "| Lint | ❌ |" >> $GITHUB_STEP_SUMMARY
fi
if [ ${{ env.JOB_TEST }} == success ]; then
echo "| Test | ✅ |" >> $GITHUB_STEP_SUMMARY
else
echo "| Test | ❌ |" >> $GITHUB_STEP_SUMMARY
fi
if [ ${{ env.JOB_BUILD }} == success ]; then
echo "| Build | ✅ |" >> $GITHUB_STEP_SUMMARY
else
echo "| Build | ❌ |" >> $GITHUB_STEP_SUMMARY
fi