diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 00000000..76d41f7d --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -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 }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3342e8bd..e7ee73b8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2536e79b..0a0a7363 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/package.json b/package.json index aed9a264..87a5c3c6 100644 --- a/package.json +++ b/package.json @@ -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",