mirror of
https://github.com/emn178/js-sha3.git
synced 2026-08-12 19:41:36 +08:00
### Added
- GitHub Actions CI across Node.js 18, 20, 22, and 24 against the packed npm artifact - GitHub Actions publish workflow on release with npm trusted publishing - `prepack` script to build distributions before `npm pack` / `npm publish` ### Changed - Replace Travis CI with GitHub Actions - Update README badges to GitHub Actions, npm, and jsDelivr - Upgrade mocha and pin vulnerable transitive dependencies via npm overrides
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node 24
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24.x
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Pack npm package
|
||||
run: |
|
||||
mkdir -p package-artifact
|
||||
npm pack --pack-destination package-artifact
|
||||
|
||||
- name: Upload package artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: package-node-24
|
||||
path: package-artifact/*.tgz
|
||||
if-no-files-found: error
|
||||
|
||||
runtime-test:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18.x, 20.x, 22.x, 24.x]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Download package artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: package-node-24
|
||||
path: package-artifact
|
||||
|
||||
- name: Extract package artifact
|
||||
run: tar -xzf package-artifact/*.tgz --strip-components=1 -C .
|
||||
|
||||
- name: Run runtime tests
|
||||
if: matrix.node-version != '24.x'
|
||||
run: npm run test:runtime
|
||||
|
||||
- name: Run runtime tests with coverage
|
||||
if: matrix.node-version == '24.x'
|
||||
run: npm run test:coverage
|
||||
|
||||
- name: Upload to coveralls
|
||||
if: matrix.node-version == '24.x'
|
||||
uses: coverallsapp/github-action@v2
|
||||
with:
|
||||
file: ./coverage/lcov.info
|
||||
@@ -0,0 +1,32 @@
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24.x
|
||||
registry-url: https://registry.npmjs.org
|
||||
package-manager-cache: false
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- name: Verify release version
|
||||
run: |
|
||||
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
||||
test "$GITHUB_REF_NAME" = "v$PACKAGE_VERSION"
|
||||
|
||||
- run: npm run build
|
||||
- run: npm test
|
||||
- run: npm publish
|
||||
Reference in New Issue
Block a user