name: test on: pull_request: workflow_call: permissions: contents: read jobs: compile: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false # Build with a modern Node.js: pnpm does not run on old versions. - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: 24 cache: pnpm - run: pnpm install --frozen-lockfile - run: pnpm run compile - run: pnpm run declaration - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: compiled path: | **/*.js !node_modules/** if-no-files-found: error retention-days: 1 # Tarball as published to npm, consumed by the `types` job. - run: pnpm pack --out package.tgz - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: package path: package.tgz if-no-files-found: error retention-days: 1 types: name: types (typescript ${{ matrix.typescript }}, ${{ matrix.tsconfig }}) needs: compile runs-on: ubuntu-latest strategy: fail-fast: false matrix: # tsconfig.json: legacy options (es5, node), TypeScript 2.0 to 5.x # tsconfig.modern.json: nodenext + strict, TypeScript 4.7 and later include: - { typescript: '2.0', tsconfig: tsconfig.json } - { typescript: '2.4', tsconfig: tsconfig.json } - { typescript: '2.9', tsconfig: tsconfig.json } - { typescript: '3.9', tsconfig: tsconfig.json } - { typescript: '4.9', tsconfig: tsconfig.json } - { typescript: '5', tsconfig: tsconfig.json } - { typescript: '5', tsconfig: tsconfig.modern.json } - { typescript: '6', tsconfig: tsconfig.modern.json } - { typescript: 'latest', tsconfig: tsconfig.modern.json } steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: 24 - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: package - run: pnpm --dir compat install --no-frozen-lockfile - run: pnpm dlx --package typescript@${{ matrix.typescript }} tsc -v - run: pnpm dlx --package typescript@${{ matrix.typescript }} tsc -p compat/${{ matrix.tsconfig }} test: name: test (node ${{ matrix.node }}) needs: compile runs-on: ubuntu-latest strategy: fail-fast: false matrix: # Every Node.js major release line from 0.12 to the latest node: [ '0.12', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', ] steps: - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: compiled - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: ${{ matrix.node }} - run: node --version - run: node test/index.js