-
Notifications
You must be signed in to change notification settings - Fork 75
215 lines (207 loc) · 6.63 KB
/
test-and-deploy.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
name: Test and Deploy
on:
pull_request:
push:
branches:
- main
# Remaining circleci jobs to port
# - build-aarch64:
# - test-alpine:
# - test-alpine-proxy:
# - test-alpine-without-git:
# - test-aarch64:
# - test-aarch64-without-git:
# - test-linux-without-git:
# - test-macos-without-git:
# - test-windows-without-git:
# - review:
# - deploy:
# - release:
jobs:
build-linux-and-osx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install deps
run: npm ci
- name: Test
run: make test
- name: Build
run: make build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
path: |
coverage/
out/
package.json
vendor/
build-alpine:
runs-on: ubuntu-latest
container: alpine:3.18.4@sha256:eece025e432126ce23f223450a0326fbebde39cdf496a85d8c016293fc851978
needs: build-linux-and-osx
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download prebuilt static node binary
run: |
apk add wget coreutils make
NODE_RELEASE=node.v16.2.0_b57a0d7c9ecba551879997ac44bba3c9d9443df5
wget https://github.com/codecov/node-static-alpine/releases/download/$NODE_RELEASE/node
wget https://github.com/codecov/node-static-alpine/releases/download/$NODE_RELEASE/SHA1SUM
wget https://github.com/codecov/node-static-alpine/releases/download/$NODE_RELEASE/SHA256SUM
wget https://github.com/codecov/node-static-alpine/releases/download/$NODE_RELEASE/SHA512SUM
for i in 1 256 512; do "sha${i}sum" -c "SHA${i}SUM"; done
- name: Confirm that alpine node binary is static
run: |
apk add file
(file node | grep 'static') || exit ${?}
- name: Create pkg-cache directory and copy static NodeJS binary
run: |
mkdir -p ~/.pkg-cache/v2.6
cp node ~/.pkg-cache/v2.6/fetched-v14.0.0-alpine-x64
- name: Remove downloaded binary and run tests
run: |
rm -rf node
apk add npm git
npm ci
npm test
mkdir -p coverage-alpine
cp -r coverage/* coverage-alpine/
- name: Build uploader binary on alpine
run: make build_alpine
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
path: |
coverage-alpine
out/codecov-alpine
build-windows:
runs-on: windows-latest
needs: build-linux-and-osx
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install deps
run: |
$ErrorActionPreference="Stop"
node --version
npm ci; npm test
- name: Build
run: |
$ErrorActionPreference="Stop"
npm run build; npm run build-windows
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
path: |
coverage/
out/codecov.exe
test-linux:
runs-on: ubuntu-latest
needs: build-linux-and-osx
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/download-artifact@v3
with:
name: artifact
- name: Confirm that linux uploader binary is static
run: (file out/codecov-linux | grep 'static') || exit ${?}
- name: Remove test coverage files
run: rm -rf *.coverage.txt coverage-report-test.json test/fixtures || echo
- name: Update exec permission
run: chmod u+x out/codecov-linux
- name: Run Linux binary -f (dry run)
run: |
out/codecov-linux -f coverage/cobertura-coverage.xml -F linux -d -Z -v | tee output_linux.txt
- name: Run Linux binary auto-detect (dry run)
run: |
out/codecov-linux -F linux -d -Z | tee -a output_linux.txt
- name: Run Linux binary (upload)
run: |
out/codecov-linux -F linux -Z
out/codecov-linux -F "-linux" -Z
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
path: |
output_linux.txt
test-macos:
runs-on: macos-latest
needs: build-linux-and-osx
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: artifact
- name: Remove test coverage files
run: rm -rf *.coverage.txt coverage-report-test.json test/fixtures || echo
- name: Update exec permission
run: chmod u+x out/codecov-macos
- name: Run MacOS binary -f (dry-run)
run: |
out/codecov-macos -f coverage/cobertura-coverage.xml -F macos -d -Z -v | tee output_osx.txt
- name: Run MacOS binary auto-detect (dry-run)
run: |
out/codecov-macos -F macos -v -d -Z | tee -a output_osx.txt
- name: Run MacOS binary (upload)
run: |
out/codecov-macos -F macos -v -Z
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
path: |
output_osx.txt
test-windows:
runs-on: windows-latest
needs: build-windows
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: artifact
- name: Remove test coverage files
run: |
Remove-Item -Recurse -Force *.coverage.txt; echo "ok"
Remove-Item -Recurse -Force coverage-report-test.json; echo "ok"
Remove-Item -Recurse -Force test/fixtures; echo "ok"
- name: Run Windows binary -f (dry-run)
run: |
dir .
attrib .\coverage\cobertura-coveage.xml
.\out\codecov.exe -f .\coverage\cobertura-coverage.xml -F windows -d -Z -v | tee output_win.txt
shell: cmd.exe
- name: Run Windows binary auto-detect (dry-run)
run: |
.\out\codecov.exe -F windows -v -d -Z | tee -a output_win.txt
shell: cmd.exe
- name: Run Windows binary (upload)
run: |
.\out\codecov.exe -F windows -v -Z
shell: cmd.exe
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
path: |
output_win.txt