Skip to content

Commit d8aa0c7

Browse files
authored
Test and build in separate jobs (#351)
* Move dev/bundle tests to another folder * Separate test:tooling * Test and build in separate jobs * Upload webpack dist * Move artifacts one by one
1 parent 7b362ed commit d8aa0c7

19 files changed

+57
-10
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,71 @@ env:
77
THREADS_WORKER_INIT_TIMEOUT: 15000
88

99
jobs:
10-
Test:
10+
# Building threads library from source
11+
Build:
1112
if: "!contains(github.event.head_commit.message, '[skip ci]')"
1213
runs-on: ${{ matrix.os }}
1314
strategy:
1415
fail-fast: false
1516
matrix:
16-
node_version: [ '10', '12', '14' ]
17+
node_version: ['15']
1718
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
1819
steps:
1920
- uses: actions/checkout@v2
2021
- name: Setup node
21-
uses: actions/setup-node@v2-beta
22+
uses: actions/setup-node@v2
2223
with:
2324
node-version: ${{ matrix.node }}
2425

2526
- name: install dependencies and build
2627
run: npm install
2728

29+
- name: Dev test
30+
run: npm run test:tooling
31+
32+
- name: Upload artifacts
33+
if: contains(matrix.os, 'ubuntu')
34+
uses: actions/upload-artifact@v2
35+
with:
36+
path: |
37+
./bundle
38+
./dist
39+
./dist-esm
40+
./test-tooling/webpack/dist
41+
42+
# Testing the built files
43+
Test:
44+
needs: Build
45+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
46+
runs-on: ${{ matrix.os }}
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
node_version: [ '10', '12', '14' ]
51+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
52+
steps:
53+
- uses: actions/checkout@v2
54+
- name: Setup node
55+
uses: actions/setup-node@v2
56+
with:
57+
node-version: ${{ matrix.node }}
58+
59+
- name: install dependencies
60+
run: npm install --ignore-scripts
61+
62+
- name: Download articats
63+
uses: actions/download-artifact@v2
64+
65+
- name: Place built files
66+
shell: bash
67+
run: |
68+
mkdir dist && mv artifact/dist/* ./dist
69+
mkdir dist-esm && mv artifact/dist-esm/* ./dist-esm
70+
mkdir bundle && mv artifact/bundle/* ./bundle
71+
mkdir -p test-tooling/webpack/dist/ && mv artifact/test-tooling/webpack/dist/* ./test-tooling/webpack/dist/
72+
2873
- name: run the tests
29-
run: npm test
74+
run: npm run test:library && npm run test:puppeteer:basic && npm run test:puppeteer:webpack
3075

3176
Skip:
3277
if: contains(github.event.head_commit.message, '[skip ci]')

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ docs/vendor
66
dist/*
77
dist-*/*
88
node_modules/
9-
test/rollup/dist/
10-
test/webpack/dist/
9+
test-tooling/rollup/dist/
10+
test-tooling/webpack/dist/
1111
test/workers/*.js
1212
.DS_Store
1313
Thumbs.db

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
"build:es": "tsc -p tsconfig-esm.json",
1414
"postbuild": "npm run bundle",
1515
"bundle": "rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js",
16-
"test": "npm run test:ava && npm run test:puppeteer:basic && npm run test:puppeteer:webpack",
17-
"test:ava": "cross-env TS_NODE_FILES=true ava",
16+
"test": "npm run test:library && npm run test:tooling && npm run test:puppeteer:basic && npm run test:puppeteer:webpack",
17+
"test:library": "cross-env TS_NODE_FILES=true ava ./test/**/*.test.ts",
18+
"test:tooling": "cross-env TS_NODE_FILES=true ava ./test-tooling/**/*.test.ts",
1819
"test:puppeteer:basic": "puppet-run --plugin=mocha --bundle=./test/workers/:workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts",
19-
"test:puppeteer:webpack": "puppet-run --serve ./test/webpack/dist/app.web/0.worker.js --serve ./test/webpack/dist/app.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts",
20+
"test:puppeteer:webpack": "puppet-run --serve ./test-tooling/webpack/dist/app.web/0.worker.js --serve ./test-tooling/webpack/dist/app.web/1.worker.js --plugin=mocha ./test-tooling/webpack/webpack.chromium.mocha.ts",
2021
"posttest": "tslint --project .",
2122
"prepare": "npm run build"
2223
},
@@ -108,7 +109,8 @@
108109
"ts"
109110
],
110111
"files": [
111-
"./test/**/*.test.ts"
112+
"./test/**/*.test.ts",
113+
"./test-tooling/**/*.test.ts"
112114
],
113115
"require": [
114116
"ts-node/register"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)