Skip to content

chore: unify build jobs #111

chore: unify build jobs

chore: unify build jobs #111

Workflow file for this run

name: release
on:
pull_request:
branches:
- master
- 1.10.x
- 1.9.x
- 1.8.x
- 1.7.x
- 1.6.x
- 1.5.x
- 1.4.x
- 1.3.x
- 1.2.x
- 1.1.x
- 1.0.x
push:
branches:
- master
- 1.10.x
- 1.9.x
- 1.8.x
- 1.7.x
- 1.6.x
- 1.5.x
- 1.4.x
- 1.3.x
- 1.2.x
- 1.1.x
- 1.0.x
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Run actions/setup-node@v4
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: https://registry.npmjs.org/
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: installing
run: npm ci
- name: setup
run: npm run setup
- name: testing wasm
run: npm run test:rs -- --node
- name: building
run: npm run build
- uses: actions/upload-artifact@master
with:
name: lib
path: lib/
test_node:
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
version: ["20", "22", "23"]
steps:
- uses: actions/checkout@v4
- name: Run actions/setup-node@v4 (${{ matrix.version }})
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
registry-url: https://registry.npmjs.org/
- uses: actions/download-artifact@v4
with:
name: lib
path: lib
- run: node lib/commonjs.cjs
- run: node lib/esm.mjs
- run: node --test test/node.test.cjs
- run: node --test test/node.test.mjs
test_bun:
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
version: ["1.0", "1.1"]
steps:
- uses: actions/checkout@v4
- name: Run oven-sh/setup-bun@v1 (${{ matrix.version }})
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ matrix.version }}
- uses: actions/download-artifact@v4
with:
name: lib
path: lib
- run: bun lib/commonjs.cjs
- run: bun lib/esm.mjs
- run: bun test test/bun.test.cjs
- run: bun test test/bun.test.mjs
test_deno:
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
version: ["1.x", "2.x"]
steps:
- uses: actions/checkout@v4
- name: Run denoland/setup-deno@v2 (${{ matrix.version }})
uses: denoland/setup-deno@v2
with:
deno-version: "v${{ matrix.version }}"
- uses: actions/download-artifact@v4
with:
name: lib
path: lib
- run: deno run --allow-read=lib/rregex.wasm lib/esm.mjs
- run: deno test --allow-read=lib/rregex.wasm test/deno.test.mjs
test_cf:
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
version: ["3.x"]
steps:
- uses: actions/checkout@v4
- name: Run actions/setup-node@v4
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: https://registry.npmjs.org/
- uses: actions/download-artifact@v4
with:
name: lib
path: lib
- run: npm ci
working-directory: ./test/cf
- run: npm test
working-directory: ./test/cf
publish:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-24.04
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
needs:
- test_node
- test_bun
- test_deno
- test_cf
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- uses: actions/download-artifact@v4
with:
name: lib
path: lib
- run: npm ci
- run: npm run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}