diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4257bca..80126f25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,26 +7,71 @@ 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:tooling + + - name: Upload artifacts + if: contains(matrix.os, 'ubuntu') + uses: actions/upload-artifact@v2 + with: + path: | + ./bundle + ./dist + ./dist-esm + ./test-tooling/webpack/dist + + # 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: | + mkdir dist && mv artifact/dist/* ./dist + mkdir dist-esm && mv artifact/dist-esm/* ./dist-esm + mkdir bundle && mv artifact/bundle/* ./bundle + mkdir -p test-tooling/webpack/dist/ && mv artifact/test-tooling/webpack/dist/* ./test-tooling/webpack/dist/ + - name: run the tests - run: npm test + 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 a341f355..12395f63 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,8 @@ docs/vendor dist/* dist-*/* node_modules/ -test/rollup/dist/ -test/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 d99b82a7..804bee97 100644 --- a/package.json +++ b/package.json @@ -13,10 +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:puppeteer:basic && npm run test:puppeteer:webpack", - "test:ava": "cross-env TS_NODE_FILES=true ava", + "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/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-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" }, @@ -108,7 +109,8 @@ "ts" ], "files": [ - "./test/**/*.test.ts" + "./test/**/*.test.ts", + "./test-tooling/**/*.test.ts" ], "require": [ "ts-node/register" diff --git a/test/rollup/app.js b/test-tooling/rollup/app.js similarity index 100% rename from test/rollup/app.js rename to test-tooling/rollup/app.js diff --git a/test/rollup/rollup.config.ts b/test-tooling/rollup/rollup.config.ts similarity index 100% rename from test/rollup/rollup.config.ts rename to test-tooling/rollup/rollup.config.ts diff --git a/test/rollup/rollup.test.ts b/test-tooling/rollup/rollup.test.ts similarity index 100% rename from test/rollup/rollup.test.ts rename to test-tooling/rollup/rollup.test.ts diff --git a/test/rollup/worker.js b/test-tooling/rollup/worker.js similarity index 100% rename from test/rollup/worker.js rename to test-tooling/rollup/worker.js diff --git a/test/tsconfig/minimal-tsconfig.json b/test-tooling/tsconfig/minimal-tsconfig.json similarity index 100% rename from test/tsconfig/minimal-tsconfig.json rename to test-tooling/tsconfig/minimal-tsconfig.json diff --git a/test/tsconfig/minimal-tsconfig.test.ts b/test-tooling/tsconfig/minimal-tsconfig.test.ts similarity index 100% rename from test/tsconfig/minimal-tsconfig.test.ts rename to test-tooling/tsconfig/minimal-tsconfig.test.ts diff --git a/test/tsconfig/minimal.ts b/test-tooling/tsconfig/minimal.ts similarity index 100% rename from test/tsconfig/minimal.ts rename to test-tooling/tsconfig/minimal.ts diff --git a/test/webpack/addition-worker.ts b/test-tooling/webpack/addition-worker.ts similarity index 100% rename from test/webpack/addition-worker.ts rename to test-tooling/webpack/addition-worker.ts diff --git a/test/webpack/app-with-inlined-worker.ts b/test-tooling/webpack/app-with-inlined-worker.ts similarity index 100% rename from test/webpack/app-with-inlined-worker.ts rename to test-tooling/webpack/app-with-inlined-worker.ts diff --git a/test/webpack/app.ts b/test-tooling/webpack/app.ts similarity index 100% rename from test/webpack/app.ts rename to test-tooling/webpack/app.ts diff --git a/test/webpack/pool-worker.ts b/test-tooling/webpack/pool-worker.ts similarity index 100% rename from test/webpack/pool-worker.ts rename to test-tooling/webpack/pool-worker.ts diff --git a/test/webpack/raw-loader.d.ts b/test-tooling/webpack/raw-loader.d.ts similarity index 100% rename from test/webpack/raw-loader.d.ts rename to test-tooling/webpack/raw-loader.d.ts diff --git a/test/webpack/webpack.chromium.mocha.ts b/test-tooling/webpack/webpack.chromium.mocha.ts similarity index 100% rename from test/webpack/webpack.chromium.mocha.ts rename to test-tooling/webpack/webpack.chromium.mocha.ts diff --git a/test/webpack/webpack.node.config.js b/test-tooling/webpack/webpack.node.config.js similarity index 100% rename from test/webpack/webpack.node.config.js rename to test-tooling/webpack/webpack.node.config.js diff --git a/test/webpack/webpack.test.ts b/test-tooling/webpack/webpack.test.ts similarity index 100% rename from test/webpack/webpack.test.ts rename to test-tooling/webpack/webpack.test.ts diff --git a/test/webpack/webpack.web.config.js b/test-tooling/webpack/webpack.web.config.js similarity index 100% rename from test/webpack/webpack.web.config.js rename to test-tooling/webpack/webpack.web.config.js