diff --git a/.github/workflows/test-js.yml b/.github/workflows/test-js.yml index 75bd17b..a42caa7 100644 --- a/.github/workflows/test-js.yml +++ b/.github/workflows/test-js.yml @@ -1,82 +1,86 @@ name: Run JS tests on: - - push - - pull_request + push: jobs: + node: + name: Node v${{ matrix.node }} + runs-on: ubuntu-24.04-arm + env: + MSHOULD_FAST: 1 + strategy: + matrix: # LTS on Jan 2025. Hardcoded is more secure + node: [20, 22] + steps: + - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 + with: + submodules: ${{ inputs.submodules || false }} + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 + with: + registry-url: "https://registry.npmjs.org" + cache: npm + node-version: ${{ matrix.node }} + - run: npm install + - run: npm run build --if-present + - run: npm test bun: name: Bun - runs-on: ubuntu-latest + runs-on: ubuntu-24.04-arm + env: + MSHOULD_FAST: 1 steps: - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 + with: + submodules: ${{ inputs.submodules || false }} - uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2.0.1 + with: + bun-version: latest - run: bun install - - run: bun run build - - run: bun test/index.js + - run: bun run --if-present build + - run: bun run --if-present test:bun + name: Run test:bun if present deno: name: Deno - runs-on: ubuntu-latest + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 + with: + submodules: ${{ inputs.submodules || false }} - uses: denoland/setup-deno@909cc5acb0fdd60627fb858598759246509fa755 # v2.0.2 - - run: deno install - - run: deno task build - - run: deno --allow-env --allow-read --allow-write test/index.js + with: + deno-version: v2.x + - run: grep -q 'test:deno' package.json && deno install || exit 0 + name: Run deno install if test:deno is present + - run: grep -q 'build' package.json && deno task build || exit 0 + name: Run build if present + - run: grep -q 'test:deno' package.json && deno task test:deno || exit 0 + name: Run test:deno if present lint: name: Lint - runs-on: ubuntu-latest + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 with: - registry-url: 'https://registry.npmjs.org' + registry-url: "https://registry.npmjs.org" cache: npm - run: npm install - run: npm run build --if-present - run: npm run lint --if-present - node: - name: Node v${{ matrix.node }} - runs-on: ubuntu-latest - strategy: - matrix: - node: [20, 22] - steps: - - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 - - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 - with: - node-version: ${{ matrix.node }} - registry-url: 'https://registry.npmjs.org' - cache: npm - - run: npm install - - run: npm run build --if-present - - run: npm test - node_polyfill: - name: Node v${{ matrix.node }} with polyfill - runs-on: ubuntu-latest - strategy: - matrix: - node: - - 18 - - 20 - - 22 - steps: - - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 - - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 - with: - node-version: ${{ matrix.node }} - - run: npm install - - run: npm run build --if-present - - run: npm run test:webcrypto coverage: - name: Measure coverage on Node - runs-on: ubuntu-latest + name: Measure coverage + runs-on: ubuntu-24.04-arm + env: + MSHOULD_FAST: 0 steps: - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 + with: + submodules: ${{ inputs.submodules || false }} - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 with: - registry-url: 'https://registry.npmjs.org' + registry-url: "https://registry.npmjs.org" cache: npm - run: npm install - run: npm run build --if-present - - run: npm run test:coverage --if-present + - run: npm install --no-save c8@10.1.2 + - run: npx c8 npm test