Skip to content

Commit e52c868

Browse files
authored
Merge pull request #186 from aminya/test-timeout [skip ci]
2 parents 5d4f610 + 5a673f1 commit e52c868

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+669
-507
lines changed

.github/workflows/CI.yml

Lines changed: 169 additions & 74 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 }}-"
@@ -54,33 +48,152 @@ jobs:
5448
with:
5549
version: ${{ matrix.pnpm }}
5650

57-
- name: Install and build
51+
- name: Install
5852
run: |
5953
pnpm install
6054
61-
# - name: Setup SSH debugging session
62-
# uses: mxschmitt/action-tmate@v3
55+
- name: Build
56+
run: |
57+
pnpm build
58+
pnpm build.docker_tests
6359
64-
- name: Test
65-
if: "${{ !contains(github.event.head_commit.message, '[skip test]') }}"
60+
- name: Lint
6661
run: |
67-
pnpm run test
62+
pnpm run test.lint
63+
64+
- name: Upload Dist
65+
uses: actions/upload-artifact@v3
66+
with:
67+
name: dist
68+
path: |
69+
./dist
70+
./packages/*/dist
71+
./dev/docker/__tests__/
72+
retention-days: 1
73+
74+
BuildExecutable:
75+
name: Build-Executable-${{ matrix.os }}
76+
needs: [Build]
77+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
78+
runs-on: ${{ matrix.os }}
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
os:
83+
- windows-2022
84+
- ubuntu-22.04
85+
- macos-12
86+
node:
87+
- 20
88+
pnpm:
89+
- 8
90+
steps:
91+
- uses: actions/checkout@v3
92+
93+
- name: Download Artifacts
94+
uses: actions/download-artifact@v3
95+
with:
96+
name: dist
97+
98+
- name: Setup Node
99+
uses: actions/setup-node@v3
100+
with:
101+
node-version: ${{ matrix.node }}
102+
103+
- name: Setup Pnpm
104+
uses: pnpm/action-setup@v2
105+
with:
106+
version: ${{ matrix.pnpm }}
107+
108+
- name: Cache node_modules
109+
uses: actions/cache@v3
110+
with:
111+
path: |
112+
~/.pnpm-store
113+
D:\.pnpm-store
114+
./node_modules
115+
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
116+
restore-keys: |
117+
"setupcpp-node_modules-cache-OS:${{ matrix.os }}-"
118+
119+
- name: Install
120+
run: |
121+
pnpm install
68122
69123
# Create self-contained executable that bundles Nodejs
70124
- name: Create Executable
71-
if: "${{ contains(matrix.os, 'windows-2022') || contains(matrix.os, 'ubuntu-22.04') || contains(matrix.os, 'macos-12') }}"
72125
run: |
73126
pnpm run pack.exe
74127
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') }}
128+
- name: Upload Executables
77129
uses: actions/upload-artifact@v3
78130
with:
131+
name: exe
79132
path: |
80133
./exe
81-
./dist
82134
retention-days: 1
83135

136+
Test:
137+
name: Test-${{ matrix.os }}
138+
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') || !contains(github.event.head_commit.message, '[skip test]') }}
139+
needs: [Build]
140+
runs-on: ${{ matrix.os }}
141+
strategy:
142+
fail-fast: false
143+
matrix:
144+
os:
145+
- windows-2022
146+
- windows-2019
147+
- ubuntu-22.04
148+
- ubuntu-20.04
149+
- macos-12
150+
- macos-11
151+
node:
152+
- 20
153+
pnpm:
154+
- 8
155+
steps:
156+
- uses: actions/checkout@v3
157+
with:
158+
submodules: true
159+
160+
- name: Download Dist
161+
uses: actions/download-artifact@v3
162+
with:
163+
name: dist
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
172+
with:
173+
version: ${{ matrix.pnpm }}
174+
175+
- name: Cache node_modules
176+
uses: actions/cache@v3
177+
with:
178+
path: |
179+
~/.pnpm-store
180+
D:\.pnpm-store
181+
./node_modules
182+
key: "setupcpp-node_modules-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}"
183+
restore-keys: |
184+
"setupcpp-node_modules-cache-OS:${{ matrix.os }}-"
185+
186+
- name: Install
187+
run: |
188+
pnpm install
189+
190+
# - name: Setup SSH debugging session
191+
# uses: mxschmitt/action-tmate@v3
192+
193+
- name: Tests
194+
run: |
195+
pnpm run test
196+
84197
- name: Setup Node 12
85198
uses: actions/setup-node@v3
86199
with:
@@ -97,38 +210,10 @@ jobs:
97210
run: |
98211
node ./dist/actions/setup-cpp.js --help
99212
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-
129213
Docker:
130-
name: ${{ matrix.container }}
214+
name: Test-${{ matrix.container }}
131215
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip test]') }}
216+
needs: [Build]
132217
runs-on: ${{ matrix.os }}
133218
strategy:
134219
fail-fast: false
@@ -151,33 +236,43 @@ jobs:
151236
with:
152237
submodules: true
153238

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
239+
- name: Download Dist
240+
uses: actions/download-artifact@v3
172241
with:
173-
version: ${{ matrix.pnpm }}
174-
175-
- name: Install and build
176-
run: |
177-
pnpm install
178-
pnpm build.docker_tests
242+
name: dist
179243

180244
- name: Build
181245
id: docker_build
182246
run: |
183247
docker build -f ./dev/docker/__tests__/${{ matrix.container }} -t setup-cpp .
248+
249+
Release:
250+
if: startsWith(github.ref, 'refs/tags/')
251+
needs: [Build, BuildExecutable, Test, Docker]
252+
runs-on: ubuntu-22.04
253+
steps:
254+
- name: Download All Artifacts
255+
uses: actions/download-artifact@v3
256+
257+
- name: Place Artifacts
258+
shell: bash
259+
run: |
260+
mv -v ./dist/* ./
261+
mv -v ./exe/* ./
262+
chmod +x -R ./exe/
263+
264+
- name: Draft the release
265+
uses: meeDamian/github-release@2.0
266+
with:
267+
token: ${{ secrets.GITHUB_TOKEN }}
268+
gzip: folders
269+
draft: true
270+
files: >
271+
./exe/setup-cpp-x64-windows.exe
272+
./exe/setup-cpp-x64-linux
273+
./exe/setup-cpp-x64-macos
274+
./dist/legacy/setup-cpp.js
275+
./dist/legacy/setup-cpp.js.map
276+
./dist/legacy/
277+
./dist/actions/
278+
./dist/modern/

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ You will need [`pnpm`](https://pnpm.io/installation) to build and test `setup-cp
66
pnpm install
77
```
88

9+
To avoid permenant changes to your system, you can use the test docker images under `./dev/docker/__tests__`.
10+
911
Before running the tests locally, backup your environment variables because faulty code might corrupt the environment.
1012

1113
<https://stackoverflow.com/a/5147185/7910299>

dev/docker/__tests__/generate-docker-tests.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async function main() {
1919

2020
// write the new file in dev/docker/__tests__
2121
await writeFile(`./dev/docker/__tests__/${dockerFile}.dockerfile`, newDockerFileContent)
22-
})
22+
}),
2323
)
2424
}
2525

dev/scripts/pack-exe.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ function main() {
3535
"--",
3636
`{{caxa}}/node_modules/.bin/node${exe}`,
3737
`{{caxa}}/setup-cpp.js`,
38-
])
39-
)
38+
]),
39+
),
4040
)
4141
}
4242

dist/actions/actions_python.72dce301.js

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

dist/actions/actions_python.72dce301.js.map

Lines changed: 0 additions & 1 deletion
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.dac7d648.js.map

Lines changed: 1 addition & 0 deletions
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: 10 additions & 10 deletions
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.

0 commit comments

Comments
 (0)