From 49734f0fbd6f5aa2a52ab865a1a3ea7269a10580 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 27 Mar 2021 11:31:57 -0500 Subject: [PATCH 1/6] Move dev/bundle tests to another folder --- {test => test-dev}/rollup/app.js | 0 {test => test-dev}/rollup/rollup.config.ts | 0 {test => test-dev}/rollup/rollup.test.ts | 0 {test => test-dev}/rollup/worker.js | 0 {test => test-dev}/tsconfig/minimal-tsconfig.json | 0 {test => test-dev}/tsconfig/minimal-tsconfig.test.ts | 0 {test => test-dev}/tsconfig/minimal.ts | 0 {test => test-dev}/webpack/addition-worker.ts | 0 {test => test-dev}/webpack/app-with-inlined-worker.ts | 0 {test => test-dev}/webpack/app.ts | 0 {test => test-dev}/webpack/pool-worker.ts | 0 {test => test-dev}/webpack/raw-loader.d.ts | 0 {test => test-dev}/webpack/webpack.chromium.mocha.ts | 0 {test => test-dev}/webpack/webpack.node.config.js | 0 {test => test-dev}/webpack/webpack.test.ts | 0 {test => test-dev}/webpack/webpack.web.config.js | 0 16 files changed, 0 insertions(+), 0 deletions(-) rename {test => test-dev}/rollup/app.js (100%) rename {test => test-dev}/rollup/rollup.config.ts (100%) rename {test => test-dev}/rollup/rollup.test.ts (100%) rename {test => test-dev}/rollup/worker.js (100%) rename {test => test-dev}/tsconfig/minimal-tsconfig.json (100%) rename {test => test-dev}/tsconfig/minimal-tsconfig.test.ts (100%) rename {test => test-dev}/tsconfig/minimal.ts (100%) rename {test => test-dev}/webpack/addition-worker.ts (100%) rename {test => test-dev}/webpack/app-with-inlined-worker.ts (100%) rename {test => test-dev}/webpack/app.ts (100%) rename {test => test-dev}/webpack/pool-worker.ts (100%) rename {test => test-dev}/webpack/raw-loader.d.ts (100%) rename {test => test-dev}/webpack/webpack.chromium.mocha.ts (100%) rename {test => test-dev}/webpack/webpack.node.config.js (100%) rename {test => test-dev}/webpack/webpack.test.ts (100%) rename {test => test-dev}/webpack/webpack.web.config.js (100%) diff --git a/test/rollup/app.js b/test-dev/rollup/app.js similarity index 100% rename from test/rollup/app.js rename to test-dev/rollup/app.js diff --git a/test/rollup/rollup.config.ts b/test-dev/rollup/rollup.config.ts similarity index 100% rename from test/rollup/rollup.config.ts rename to test-dev/rollup/rollup.config.ts diff --git a/test/rollup/rollup.test.ts b/test-dev/rollup/rollup.test.ts similarity index 100% rename from test/rollup/rollup.test.ts rename to test-dev/rollup/rollup.test.ts diff --git a/test/rollup/worker.js b/test-dev/rollup/worker.js similarity index 100% rename from test/rollup/worker.js rename to test-dev/rollup/worker.js diff --git a/test/tsconfig/minimal-tsconfig.json b/test-dev/tsconfig/minimal-tsconfig.json similarity index 100% rename from test/tsconfig/minimal-tsconfig.json rename to test-dev/tsconfig/minimal-tsconfig.json diff --git a/test/tsconfig/minimal-tsconfig.test.ts b/test-dev/tsconfig/minimal-tsconfig.test.ts similarity index 100% rename from test/tsconfig/minimal-tsconfig.test.ts rename to test-dev/tsconfig/minimal-tsconfig.test.ts diff --git a/test/tsconfig/minimal.ts b/test-dev/tsconfig/minimal.ts similarity index 100% rename from test/tsconfig/minimal.ts rename to test-dev/tsconfig/minimal.ts diff --git a/test/webpack/addition-worker.ts b/test-dev/webpack/addition-worker.ts similarity index 100% rename from test/webpack/addition-worker.ts rename to test-dev/webpack/addition-worker.ts diff --git a/test/webpack/app-with-inlined-worker.ts b/test-dev/webpack/app-with-inlined-worker.ts similarity index 100% rename from test/webpack/app-with-inlined-worker.ts rename to test-dev/webpack/app-with-inlined-worker.ts diff --git a/test/webpack/app.ts b/test-dev/webpack/app.ts similarity index 100% rename from test/webpack/app.ts rename to test-dev/webpack/app.ts diff --git a/test/webpack/pool-worker.ts b/test-dev/webpack/pool-worker.ts similarity index 100% rename from test/webpack/pool-worker.ts rename to test-dev/webpack/pool-worker.ts diff --git a/test/webpack/raw-loader.d.ts b/test-dev/webpack/raw-loader.d.ts similarity index 100% rename from test/webpack/raw-loader.d.ts rename to test-dev/webpack/raw-loader.d.ts diff --git a/test/webpack/webpack.chromium.mocha.ts b/test-dev/webpack/webpack.chromium.mocha.ts similarity index 100% rename from test/webpack/webpack.chromium.mocha.ts rename to test-dev/webpack/webpack.chromium.mocha.ts diff --git a/test/webpack/webpack.node.config.js b/test-dev/webpack/webpack.node.config.js similarity index 100% rename from test/webpack/webpack.node.config.js rename to test-dev/webpack/webpack.node.config.js diff --git a/test/webpack/webpack.test.ts b/test-dev/webpack/webpack.test.ts similarity index 100% rename from test/webpack/webpack.test.ts rename to test-dev/webpack/webpack.test.ts diff --git a/test/webpack/webpack.web.config.js b/test-dev/webpack/webpack.web.config.js similarity index 100% rename from test/webpack/webpack.web.config.js rename to test-dev/webpack/webpack.web.config.js From 6dc8ad7f74bdfa2400ada28d92eb61585ca61146 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 27 Mar 2021 11:32:25 -0500 Subject: [PATCH 2/6] Separate test:dev --- .gitignore | 4 ++-- package.json | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index a341f355..21be2ac2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,8 @@ docs/vendor dist/* dist-*/* node_modules/ -test/rollup/dist/ -test/webpack/dist/ +test-dev/rollup/dist/ +test-dev/webpack/dist/ test/workers/*.js .DS_Store Thumbs.db diff --git a/package.json b/package.json index d99b82a7..88d6d5b1 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,9 @@ "build:es": "tsc -p tsconfig-esm.json", "postbuild": "npm run bundle", "bundle": "rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js", - "test": "npm run test:ava && npm run test:puppeteer:basic && npm run test:puppeteer:webpack", - "test:ava": "cross-env TS_NODE_FILES=true ava", + "test": "npm run test:ava && npm run test:dev && npm run test:puppeteer:basic && npm run test:puppeteer:webpack", + "test:ava": "cross-env TS_NODE_FILES=true ava ./test/**/*.test.ts", + "test:dev": "cross-env TS_NODE_FILES=true ava ./test-dev/**/*.test.ts", "test:puppeteer:basic": "puppet-run --plugin=mocha --bundle=./test/workers/:workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts", "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", "posttest": "tslint --project .", @@ -108,7 +109,8 @@ "ts" ], "files": [ - "./test/**/*.test.ts" + "./test/**/*.test.ts", + "./test-dev/**/*.test.ts" ], "require": [ "ts-node/register" From 53e4a40911853e7b5c361a8395209edca88a2d43 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 27 Mar 2021 13:24:17 -0500 Subject: [PATCH 3/6] Test and build in separate jobs --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4257bca..fb2a8505 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,26 +7,66 @@ env: THREADS_WORKER_INIT_TIMEOUT: 15000 jobs: - Test: + # Building threads library from source + Build: if: "!contains(github.event.head_commit.message, '[skip ci]')" runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - node_version: [ '10', '12', '14' ] + node_version: ['15'] os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] steps: - uses: actions/checkout@v2 - name: Setup node - uses: actions/setup-node@v2-beta + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node }} - name: install dependencies and build run: npm install + - name: Dev test + run: npm run test:dev + + - name: Upload artifacts + if: contains(matrix.os, 'ubuntu') + uses: actions/upload-artifact@v2 + with: + path: | + ./bundle + ./dist + ./dist-esm + + # Testing the built files + Test: + needs: Build + if: "!contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + node_version: [ '10', '12', '14' ] + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - name: install dependencies + run: npm install --ignore-scripts + + - name: Download articats + uses: actions/download-artifact@v2 + + - name: Place built files + shell: bash + run: mv artifact/* . + - name: run the tests - run: npm test + run: npm run test:ava && npm run test:puppeteer:basic && npm run test:puppeteer:webpack Skip: if: contains(github.event.head_commit.message, '[skip ci]') From 87b5391e9bc41a00c44544445bce436f964eee28 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 27 Mar 2021 13:37:20 -0500 Subject: [PATCH 4/6] Upload webpack dist --- .github/workflows/ci.yml | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb2a8505..72de7e60 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,7 @@ jobs: ./bundle ./dist ./dist-esm + ./test-dev/webpack/dist # Testing the built files Test: diff --git a/package.json b/package.json index 88d6d5b1..d08dcc1d 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "test:ava": "cross-env TS_NODE_FILES=true ava ./test/**/*.test.ts", "test:dev": "cross-env TS_NODE_FILES=true ava ./test-dev/**/*.test.ts", "test:puppeteer:basic": "puppet-run --plugin=mocha --bundle=./test/workers/:workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts", - "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", + "test:puppeteer:webpack": "puppet-run --serve ./test-dev/webpack/dist/app.web/0.worker.js --serve ./test-dev/webpack/dist/app.web/1.worker.js --plugin=mocha ./test-dev/webpack/webpack.chromium.mocha.ts", "posttest": "tslint --project .", "prepare": "npm run build" }, From f1a7c9b3f37f1395a8f14deff9808a0a58901979 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 27 Mar 2021 14:13:26 -0500 Subject: [PATCH 5/6] Move artifacts one by one --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72de7e60..d88a418e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,11 @@ jobs: - name: Place built files shell: bash - run: mv artifact/* . + run: | + mkdir dist && mv artifact/dist/* ./dist + mkdir dist-esm && mv artifact/dist-esm/* ./dist-esm + mkdir bundle && mv artifact/bundle/* ./bundle + mkdir -p test-dev/webpack/dist/ && mv artifact/test-dev/webpack/dist/* ./test-dev/webpack/dist/ - name: run the tests run: npm run test:ava && npm run test:puppeteer:basic && npm run test:puppeteer:webpack From 453c66c013f0d743abe24533b0775add5589a019 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 28 Mar 2021 15:27:31 -0500 Subject: [PATCH 6/6] Rename to test:library and test:tooling --- .github/workflows/ci.yml | 8 ++++---- .gitignore | 4 ++-- package.json | 10 +++++----- {test-dev => test-tooling}/rollup/app.js | 0 {test-dev => test-tooling}/rollup/rollup.config.ts | 0 {test-dev => test-tooling}/rollup/rollup.test.ts | 0 {test-dev => test-tooling}/rollup/worker.js | 0 .../tsconfig/minimal-tsconfig.json | 0 .../tsconfig/minimal-tsconfig.test.ts | 0 {test-dev => test-tooling}/tsconfig/minimal.ts | 0 {test-dev => test-tooling}/webpack/addition-worker.ts | 0 .../webpack/app-with-inlined-worker.ts | 0 {test-dev => test-tooling}/webpack/app.ts | 0 {test-dev => test-tooling}/webpack/pool-worker.ts | 0 {test-dev => test-tooling}/webpack/raw-loader.d.ts | 0 .../webpack/webpack.chromium.mocha.ts | 0 .../webpack/webpack.node.config.js | 0 {test-dev => test-tooling}/webpack/webpack.test.ts | 0 .../webpack/webpack.web.config.js | 0 19 files changed, 11 insertions(+), 11 deletions(-) rename {test-dev => test-tooling}/rollup/app.js (100%) rename {test-dev => test-tooling}/rollup/rollup.config.ts (100%) rename {test-dev => test-tooling}/rollup/rollup.test.ts (100%) rename {test-dev => test-tooling}/rollup/worker.js (100%) rename {test-dev => test-tooling}/tsconfig/minimal-tsconfig.json (100%) rename {test-dev => test-tooling}/tsconfig/minimal-tsconfig.test.ts (100%) rename {test-dev => test-tooling}/tsconfig/minimal.ts (100%) rename {test-dev => test-tooling}/webpack/addition-worker.ts (100%) rename {test-dev => test-tooling}/webpack/app-with-inlined-worker.ts (100%) rename {test-dev => test-tooling}/webpack/app.ts (100%) rename {test-dev => test-tooling}/webpack/pool-worker.ts (100%) rename {test-dev => test-tooling}/webpack/raw-loader.d.ts (100%) rename {test-dev => test-tooling}/webpack/webpack.chromium.mocha.ts (100%) rename {test-dev => test-tooling}/webpack/webpack.node.config.js (100%) rename {test-dev => test-tooling}/webpack/webpack.test.ts (100%) rename {test-dev => test-tooling}/webpack/webpack.web.config.js (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d88a418e..80126f25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: run: npm install - name: Dev test - run: npm run test:dev + run: npm run test:tooling - name: Upload artifacts if: contains(matrix.os, 'ubuntu') @@ -37,7 +37,7 @@ jobs: ./bundle ./dist ./dist-esm - ./test-dev/webpack/dist + ./test-tooling/webpack/dist # Testing the built files Test: @@ -68,10 +68,10 @@ jobs: mkdir dist && mv artifact/dist/* ./dist mkdir dist-esm && mv artifact/dist-esm/* ./dist-esm mkdir bundle && mv artifact/bundle/* ./bundle - mkdir -p test-dev/webpack/dist/ && mv artifact/test-dev/webpack/dist/* ./test-dev/webpack/dist/ + mkdir -p test-tooling/webpack/dist/ && mv artifact/test-tooling/webpack/dist/* ./test-tooling/webpack/dist/ - name: run the tests - run: npm run test:ava && npm run test:puppeteer:basic && npm run test:puppeteer:webpack + run: npm run test:library && npm run test:puppeteer:basic && npm run test:puppeteer:webpack Skip: if: contains(github.event.head_commit.message, '[skip ci]') diff --git a/.gitignore b/.gitignore index 21be2ac2..12395f63 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,8 @@ docs/vendor dist/* dist-*/* node_modules/ -test-dev/rollup/dist/ -test-dev/webpack/dist/ +test-tooling/rollup/dist/ +test-tooling/webpack/dist/ test/workers/*.js .DS_Store Thumbs.db diff --git a/package.json b/package.json index d08dcc1d..804bee97 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,11 @@ "build:es": "tsc -p tsconfig-esm.json", "postbuild": "npm run bundle", "bundle": "rollup -c -f umd --file=bundle/worker.js --name=threads --silent -- dist-esm/worker/bundle-entry.js", - "test": "npm run test:ava && npm run test:dev && npm run test:puppeteer:basic && npm run test:puppeteer:webpack", - "test:ava": "cross-env TS_NODE_FILES=true ava ./test/**/*.test.ts", - "test:dev": "cross-env TS_NODE_FILES=true ava ./test-dev/**/*.test.ts", + "test": "npm run test:library && npm run test:tooling && npm run test:puppeteer:basic && npm run test:puppeteer:webpack", + "test:library": "cross-env TS_NODE_FILES=true ava ./test/**/*.test.ts", + "test:tooling": "cross-env TS_NODE_FILES=true ava ./test-tooling/**/*.test.ts", "test:puppeteer:basic": "puppet-run --plugin=mocha --bundle=./test/workers/:workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts", - "test:puppeteer:webpack": "puppet-run --serve ./test-dev/webpack/dist/app.web/0.worker.js --serve ./test-dev/webpack/dist/app.web/1.worker.js --plugin=mocha ./test-dev/webpack/webpack.chromium.mocha.ts", + "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", "posttest": "tslint --project .", "prepare": "npm run build" }, @@ -110,7 +110,7 @@ ], "files": [ "./test/**/*.test.ts", - "./test-dev/**/*.test.ts" + "./test-tooling/**/*.test.ts" ], "require": [ "ts-node/register" diff --git a/test-dev/rollup/app.js b/test-tooling/rollup/app.js similarity index 100% rename from test-dev/rollup/app.js rename to test-tooling/rollup/app.js diff --git a/test-dev/rollup/rollup.config.ts b/test-tooling/rollup/rollup.config.ts similarity index 100% rename from test-dev/rollup/rollup.config.ts rename to test-tooling/rollup/rollup.config.ts diff --git a/test-dev/rollup/rollup.test.ts b/test-tooling/rollup/rollup.test.ts similarity index 100% rename from test-dev/rollup/rollup.test.ts rename to test-tooling/rollup/rollup.test.ts diff --git a/test-dev/rollup/worker.js b/test-tooling/rollup/worker.js similarity index 100% rename from test-dev/rollup/worker.js rename to test-tooling/rollup/worker.js diff --git a/test-dev/tsconfig/minimal-tsconfig.json b/test-tooling/tsconfig/minimal-tsconfig.json similarity index 100% rename from test-dev/tsconfig/minimal-tsconfig.json rename to test-tooling/tsconfig/minimal-tsconfig.json diff --git a/test-dev/tsconfig/minimal-tsconfig.test.ts b/test-tooling/tsconfig/minimal-tsconfig.test.ts similarity index 100% rename from test-dev/tsconfig/minimal-tsconfig.test.ts rename to test-tooling/tsconfig/minimal-tsconfig.test.ts diff --git a/test-dev/tsconfig/minimal.ts b/test-tooling/tsconfig/minimal.ts similarity index 100% rename from test-dev/tsconfig/minimal.ts rename to test-tooling/tsconfig/minimal.ts diff --git a/test-dev/webpack/addition-worker.ts b/test-tooling/webpack/addition-worker.ts similarity index 100% rename from test-dev/webpack/addition-worker.ts rename to test-tooling/webpack/addition-worker.ts diff --git a/test-dev/webpack/app-with-inlined-worker.ts b/test-tooling/webpack/app-with-inlined-worker.ts similarity index 100% rename from test-dev/webpack/app-with-inlined-worker.ts rename to test-tooling/webpack/app-with-inlined-worker.ts diff --git a/test-dev/webpack/app.ts b/test-tooling/webpack/app.ts similarity index 100% rename from test-dev/webpack/app.ts rename to test-tooling/webpack/app.ts diff --git a/test-dev/webpack/pool-worker.ts b/test-tooling/webpack/pool-worker.ts similarity index 100% rename from test-dev/webpack/pool-worker.ts rename to test-tooling/webpack/pool-worker.ts diff --git a/test-dev/webpack/raw-loader.d.ts b/test-tooling/webpack/raw-loader.d.ts similarity index 100% rename from test-dev/webpack/raw-loader.d.ts rename to test-tooling/webpack/raw-loader.d.ts diff --git a/test-dev/webpack/webpack.chromium.mocha.ts b/test-tooling/webpack/webpack.chromium.mocha.ts similarity index 100% rename from test-dev/webpack/webpack.chromium.mocha.ts rename to test-tooling/webpack/webpack.chromium.mocha.ts diff --git a/test-dev/webpack/webpack.node.config.js b/test-tooling/webpack/webpack.node.config.js similarity index 100% rename from test-dev/webpack/webpack.node.config.js rename to test-tooling/webpack/webpack.node.config.js diff --git a/test-dev/webpack/webpack.test.ts b/test-tooling/webpack/webpack.test.ts similarity index 100% rename from test-dev/webpack/webpack.test.ts rename to test-tooling/webpack/webpack.test.ts diff --git a/test-dev/webpack/webpack.web.config.js b/test-tooling/webpack/webpack.web.config.js similarity index 100% rename from test-dev/webpack/webpack.web.config.js rename to test-tooling/webpack/webpack.web.config.js