Skip to content

Commit 697fc17

Browse files
committed
ci: shared build for all the tests - rewrite the CI workflow
1 parent 0b79280 commit 697fc17

17 files changed

+178
-104
lines changed

.github/workflows/CI.yml

Lines changed: 144 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,21 @@ on:
1010
- "*"
1111

1212
jobs:
13-
Test:
14-
name: ${{ matrix.os }}
13+
Build:
14+
runs-on: ubuntu-22.04
15+
name: Build
1516
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
16-
runs-on: ${{ matrix.os }}
1717
strategy:
1818
fail-fast: false
1919
matrix:
2020
os:
21-
- windows-2022
22-
- windows-2019
2321
- ubuntu-22.04
24-
- ubuntu-20.04
25-
- macos-12
26-
- macos-11
2722
node:
2823
- 20
2924
pnpm:
3025
- 8
3126
steps:
3227
- uses: actions/checkout@v3
33-
with:
34-
submodules: true
3528

3629
- name: Cache
3730
uses: actions/cache@v3
@@ -40,6 +33,7 @@ jobs:
4033
~/.pnpm-store
4134
D:\.pnpm-store
4235
./node_modules
36+
./.parcel-cache
4337
key: "setupcpp-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
4438
restore-keys: |
4539
"setupcpp-cache-OS:${{ matrix.os }}-"
@@ -57,30 +51,122 @@ jobs:
5751
- name: Install and build
5852
run: |
5953
pnpm install
54+
pnpm build.docker_tests
6055
61-
# - name: Setup SSH debugging session
62-
# uses: mxschmitt/action-tmate@v3
56+
- name: Upload Dist
57+
uses: actions/upload-artifact@v3
58+
with:
59+
name: dist
60+
path: |
61+
./dist
62+
./dev/docker/__tests__/
63+
retention-days: 1
6364

64-
- name: Test
65-
if: "${{ !contains(github.event.head_commit.message, '[skip test]') }}"
65+
Build_Executable:
66+
name: Build_Executable-${{ matrix.os }}
67+
needs: [Build]
68+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
69+
runs-on: ${{ matrix.os }}
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
os:
74+
- windows-2022
75+
- ubuntu-22.04
76+
- macos-12
77+
node:
78+
- 20
79+
pnpm:
80+
- 8
81+
steps:
82+
- uses: actions/checkout@v3
83+
84+
- name: Download Artifacts
85+
uses: actions/download-artifact@v3
86+
with:
87+
name: dist
88+
- name: Place Artifacts
89+
shell: bash
6690
run: |
67-
pnpm run test
91+
mv -v artifact/* ./
92+
93+
- name: Setup Node
94+
uses: actions/setup-node@v3
95+
with:
96+
node-version: ${{ matrix.node }}
97+
98+
- name: Setup Pnpm
99+
uses: pnpm/action-setup@v2
100+
with:
101+
version: ${{ matrix.pnpm }}
68102

69103
# Create self-contained executable that bundles Nodejs
70104
- name: Create Executable
71-
if: "${{ contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-22.04') || contains(matrix.os, 'macos-12') }}"
72105
run: |
73106
pnpm run pack.exe
74107
75-
- name: Upload Artifacts
76-
if: ${{ (startsWith(github.ref, 'refs/tags/')) && contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-22.04') || contains(matrix.os, 'macos-12') }}
108+
- name: Upload Executables
77109
uses: actions/upload-artifact@v3
78110
with:
111+
name: exe
79112
path: |
80113
./exe
81-
./dist
82114
retention-days: 1
83115

116+
Test:
117+
name: ${{ matrix.os }}
118+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') || !contains(github.event.head_commit.message, '[skip test]') }}
119+
needs: [Build]
120+
runs-on: ${{ matrix.os }}
121+
strategy:
122+
fail-fast: false
123+
matrix:
124+
os:
125+
- windows-2022
126+
- windows-2019
127+
- ubuntu-22.04
128+
- ubuntu-20.04
129+
- macos-12
130+
- macos-11
131+
node:
132+
- 20
133+
pnpm:
134+
- 8
135+
steps:
136+
- uses: actions/checkout@v3
137+
with:
138+
submodules: true
139+
140+
- name: Download Dist
141+
uses: actions/download-artifact@v3
142+
with:
143+
name: dist
144+
- name: Place Dist
145+
shell: bash
146+
run: |
147+
mv -v artifact/* ./
148+
149+
- name: Setup Node
150+
uses: actions/setup-node@v3
151+
with:
152+
node-version: ${{ matrix.node }}
153+
154+
- name: Setup Pnpm
155+
uses: pnpm/action-setup@v2
156+
with:
157+
version: ${{ matrix.pnpm }}
158+
159+
# - name: Setup SSH debugging session
160+
# uses: mxschmitt/action-tmate@v3
161+
162+
- name: Install
163+
run: |
164+
pnpm install
165+
166+
- name: Test
167+
run: |
168+
pnpm run test
169+
84170
- name: Setup Node 12
85171
uses: actions/setup-node@v3
86172
with:
@@ -97,38 +183,10 @@ jobs:
97183
run: |
98184
node ./dist/actions/setup-cpp.js --help
99185
100-
Release:
101-
needs: Test
102-
if: startsWith(github.ref, 'refs/tags/')
103-
runs-on: ubuntu-22.04
104-
steps:
105-
- name: Download Artifacts
106-
uses: actions/download-artifact@v3
107-
108-
- name: Place Artifacts
109-
run: |
110-
mv -v artifact/* ./
111-
chmod +x -R ./exe/
112-
113-
- name: Draft the release
114-
uses: meeDamian/github-release@2.0
115-
with:
116-
token: ${{ secrets.GITHUB_TOKEN }}
117-
gzip: folders
118-
draft: true
119-
files: >
120-
./exe/setup-cpp-x64-windows.exe
121-
./exe/setup-cpp-x64-linux
122-
./exe/setup-cpp-x64-macos
123-
./dist/legacy/setup-cpp.js
124-
./dist/legacy/setup-cpp.js.map
125-
./dist/legacy/
126-
./dist/actions/
127-
./dist/modern/
128-
129186
Docker:
130187
name: ${{ matrix.container }}
131188
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip test]') }}
189+
needs: [Build]
132190
runs-on: ${{ matrix.os }}
133191
strategy:
134192
fail-fast: false
@@ -151,33 +209,48 @@ jobs:
151209
with:
152210
submodules: true
153211

154-
- name: Cache
155-
uses: actions/cache@v3
156-
with:
157-
path: |
158-
~/.pnpm-store
159-
D:\.pnpm-store
160-
./node_modules
161-
key: "setupcpp-docker-cache-OS:${{ matrix.os }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
162-
restore-keys: |
163-
"setupcpp-docker-cache-OS:${{ matrix.os }}"
164-
165-
- name: Setup Node
166-
uses: actions/setup-node@v3
167-
with:
168-
node-version: ${{ matrix.node }}
169-
170-
- name: Setup Pnpm
171-
uses: pnpm/action-setup@v2
212+
- name: Download Dist
213+
uses: actions/download-artifact@v3
172214
with:
173-
version: ${{ matrix.pnpm }}
174-
175-
- name: Install and build
215+
name: dist
216+
- name: Place Dist
217+
shell: bash
176218
run: |
177-
pnpm install
178-
pnpm build.docker_tests
219+
mv -v artifact/* ./
179220
180221
- name: Build
181222
id: docker_build
182223
run: |
183224
docker build -f ./dev/docker/__tests__/${{ matrix.container }} -t setup-cpp .
225+
226+
227+
Release:
228+
if: startsWith(github.ref, 'refs/tags/')
229+
needs: [Build, Build_Executable, Test, Docker]
230+
runs-on: ubuntu-22.04
231+
steps:
232+
- name: Download All Artifacts
233+
uses: actions/download-artifact@v3
234+
235+
- name: Place Artifacts
236+
shell: bash
237+
run: |
238+
mv -v artifact/dist/* ./
239+
mv -v artifact/exe/* ./
240+
chmod +x -R ./exe/
241+
242+
- name: Draft the release
243+
uses: meeDamian/github-release@2.0
244+
with:
245+
token: ${{ secrets.GITHUB_TOKEN }}
246+
gzip: folders
247+
draft: true
248+
files: >
249+
./exe/setup-cpp-x64-windows.exe
250+
./exe/setup-cpp-x64-linux
251+
./exe/setup-cpp-x64-macos
252+
./dist/legacy/setup-cpp.js
253+
./dist/legacy/setup-cpp.js.map
254+
./dist/legacy/
255+
./dist/actions/
256+
./dist/modern/

dist/actions/actions_python.485876e4.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

dist/actions/actions_python.dac7d648.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions/actions_python.485876e4.js.map renamed to dist/actions/actions_python.dac7d648.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/actions_python.30df6221.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/actions_python.9b84a41a.js.map renamed to dist/legacy/actions_python.30df6221.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/actions_python.9b84a41a.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

dist/legacy/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)