From 0b373b8a39db8475bcf2967039bd3b2ddf9b6d40 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Fri, 17 Jan 2025 07:07:38 +0000 Subject: [PATCH] ci: reuse workflows --- .github/workflows/release.yml | 54 +++---------------------- .github/workflows/test-js.yml | 74 +++-------------------------------- 2 files changed, 11 insertions(+), 117 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2bf740a..e232f7a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,56 +2,12 @@ name: Publish release on: release: types: [created] - workflow_dispatch: jobs: - publish-jsr: - name: Publish to JSR.io - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 - - run: npm install -g jsr - - run: jsr publish - publish-npm: - name: Publish to NPM - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 - with: - node-version: 22 - registry-url: 'https://registry.npmjs.org' - cache: npm - - run: npm ci - - run: npm run build - - run: npm publish --provenance --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} - standalone: - name: Upload files to GitHub Releases - runs-on: ubuntu-latest + test-js: + name: 'JS v0.2.2' # v0.2.2 == commit below + uses: paulmillr/jsbt/.github/workflows/release.yml@8db14713888c4c7dc1b031d480213cd67f5c422d + secrets: + NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} permissions: contents: write id-token: write - steps: - - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 - with: - node-version: 22 - registry-url: 'https://registry.npmjs.org' - cache: npm - - run: npm ci - - run: npm run build - - run: | - cd build - npm ci - npm run build:release - cd .. - - run: gh release upload ${{ github.event.release.tag_name }} build/`npx jsbt outfile` - env: - GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/test-js.yml b/.github/workflows/test-js.yml index 8c6effb..d2bfc2c 100644 --- a/.github/workflows/test-js.yml +++ b/.github/workflows/test-js.yml @@ -1,72 +1,10 @@ -name: Run JS tests +name: Run tests on: - push - pull_request jobs: - bun: - name: Bun - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 - with: - submodules: recursive - - uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2.0.1 - - run: bun install - - run: bun run build - - run: bun test/index.js - deno: - name: Deno - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 - with: - submodules: recursive - - 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 - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 - with: - 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: [18, 20, 22] - steps: - - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 - with: - submodules: recursive - - 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 - coverage: - name: Measure coverage on Node - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 - with: - submodules: recursive - - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 - with: - registry-url: 'https://registry.npmjs.org' - cache: npm - - run: npm install - - run: npm run build --if-present - - run: npm run test:coverage --if-present + test-js: + name: 'JS v0.2.2' # v0.2.2 == commit below + uses: paulmillr/jsbt/.github/workflows/test-js.yml@8db14713888c4c7dc1b031d480213cd67f5c422d + with: + clone-submodules: true