Skip to content

Split Build and Test steps in CI. #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
workflow_call:
inputs:
node-version-for-testing:
required: false
default: 18.x
type: string
build-cmd:
required: false
default: npm run build
type: string
test-cmd:
required: true
type: string
jobs:
reusable_workflow_job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v17.x for build
uses: actions/setup-node@v1
with:
node-version: 18.x
- run: npm ci --no-optional
- run: ${{ inputs.build-cmd }}
- name: use node.js for test execution
uses: actions/setup-node@v1
with:
node-version: ${{ inputs.node-version-for-testing }}
- run: npm ci --no-optional
- run: ${{ inputs.test-cmd }}
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v15.x
- name: use node.js v17.x
uses: actions/setup-node@v1
with:
node-version: 15.x
node-version: 17.x
- run: npm ci --no-optional
- run: npm run lint
lint-unused-code: # look for unused functions and unused exports
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v16.x
- name: use node.js v17.x
uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 17.x
- run: npm ci --no-optional
- run: npm run prune
159 changes: 72 additions & 87 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,90 +5,75 @@ on:
branches:
- main
jobs:
test-node17:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v17.x
uses: actions/setup-node@v1
with:
node-version: 17.x
- run: npm ci --no-optional
- run: npm test
test-node16:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- run: npm ci --no-optional
- run: npm test
test-node14:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm ci --no-optional
- run: npm test
test-test262:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: use node.js v17.x
uses: actions/setup-node@v1
with:
node-version: 17.x
- run: npm ci
- run: npm run test262
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
test-test262-opt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: use node.js v17.x
uses: actions/setup-node@v1
with:
node-version: 17.x
- run: npm ci
- run: npm run test262
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
NODE_ENV: production
test-test262-es5:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: use node.js v17.x
uses: actions/setup-node@v1
with:
node-version: 17.x
- run: npm ci
- run: npm run test262
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
NODE_ENV: production
TRANSPILE: '1'
test-validstrings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node.js v16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- run: npm ci
- run: |
npm ci
npm run testValidStrings
test_demitasse_matrix:
strategy:
matrix:
version:
- 17.x
- 16.x
- 14.x
uses: ./.github/workflows/build_and_test.yml
with:
node-version-for-testing: ${{ matrix.version }}
test-cmd: npm run test_nobuild
test_validstrings:
uses: ./.github/workflows/build_and_test.yml
with:
test-cmd: npm run testValidStrings_nobuild
# test-test262:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: true
# - name: use node.js v17.x
# uses: actions/setup-node@v1
# with:
# node-version: 17.x
# - run: npm ci
# - run: npm run test262
# env:
# HEAD_SHA: ${{ github.event.pull_request.head.sha }}
# test-test262-opt:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: true
# - name: use node.js v17.x
# uses: actions/setup-node@v1
# with:
# node-version: 17.x
# - run: npm ci
# - run: npm run test262
# env:
# HEAD_SHA: ${{ github.event.pull_request.head.sha }}
# NODE_ENV: production
# test-test262-es5:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: true
# - name: use node.js v17.x
# uses: actions/setup-node@v1
# with:
# node-version: 17.x
# - run: npm ci
# - run: npm run test262
# env:
# HEAD_SHA: ${{ github.event.pull_request.head.sha }}
# NODE_ENV: production
# TRANSPILE: "1"
# test-validstrings:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: use node.js v16.x
# uses: actions/setup-node@v1
# with:
# node-version: 16.x
# - run: npm ci
# - run: |
# npm ci
# npm run testValidStrings
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
},
"types": "./index.d.ts",
"scripts": {
"test": "npm run build && node --no-warnings --experimental-modules --experimental-specifier-resolution=node --icu-data-dir node_modules/full-icu --loader ./test/resolve.source.mjs ./test/all.mjs",
"test262": "TEST262=1 npm run build && ./test/test262.sh",
"testValidStrings": "npm run build && node --experimental-modules --experimental-specifier-resolution=node --no-warnings --icu-data-dir ./node_modules/full-icu/ --loader ./test/resolve.source.mjs test/validStrings.mjs",
"test": "npm run build && npm run test_nobuild",
"test_nobuild": "node --no-warnings --experimental-modules --experimental-specifier-resolution=node --icu-data-dir node_modules/full-icu --loader ./test/resolve.source.mjs ./test/all.mjs",
"test262": "TEST262=1 npm run build && npm run test262_nobuild",
"test262_nobuild": "./test/test262.sh",
"testValidStrings": "npm run build && npm run testValidStrings_nobuild",
"testValidStrings_nobuild": "node --experimental-modules --experimental-specifier-resolution=node --no-warnings --icu-data-dir ./node_modules/full-icu/ --loader ./test/resolve.source.mjs test/validStrings.mjs",
"build": "rm -rf dist/* tsc-out/* && tsc && rollup -c rollup.config.js",
"prepare": "npm run build",
"prepublishOnly": "node copy-types.mjs && npm run build",
Expand Down