mirror of
https://github.com/emn178/js-sha1.git
synced 2026-11-17 22:28:43 +08:00
- ESM builds and package `exports`. ### Fixed - Incorrect hash for strings with unpaired UTF-16 surrogates; they are now encoded as U+FFFD, the same as `TextEncoder`. - Detect browsers with a `process` polyfill (e.g. BrowserFS) and Electron renderers as non-Node.js environments. ### Changed - Replace Travis CI with GitHub Actions. - Update dev dependencies and fix security issues. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
1.8 KiB
YAML
78 lines
1.8 KiB
YAML
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: [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
|