Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: build and test pull-request

on:
pull_request:
branches:
- main
workflow_dispatch:
# Allow workflow to be triggered manually.

jobs:
detect-secrets:
name: detect-secrets
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install detect-secrets
run: |
pip install --upgrade "git+https://github.com/ibm/detect-secrets.git@master#egg=detect-secrets"

- name: Run detect-secrets
run: |
detect-secrets scan --update .secrets.baseline
detect-secrets -v audit --report --fail-on-unaudited --fail-on-live --fail-on-audited-real .secrets.baseline

build:
name: Test on Node.js ${{ matrix.node-version }}
needs: detect-secrets
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20, 22, 24]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Display Node.js and npm versions
run: |
node --version
npm --version

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Run unit tests
run: npm run test-unit

- name: Run linter
run: npm run lint

- name: Check packages
run: npm run check-packages

# - name: Upload coverage to Codecov
# if: matrix.node-version == 22
# uses: codecov/codecov-action@v4
# with:
# files: ./coverage/lcov.info
# flags: unittests
# name: codecov-umbrella
# fail_ci_if_error: false
97 changes: 97 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: release

on:
push:
branches:
- main
workflow_dispatch:
inputs:
dry_run:
description: 'Run semantic-release in dry-run mode'
required: false
type: boolean
default: true

jobs:
build:
name: Build and Test (node v${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22, 24]

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Display Node.js and npm versions
run: |
node --version
npm --version

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Run unit tests
run: npm run test-unit

- name: Run linter
run: npm run lint

- name: Check packages
run: npm run check-packages

release:
name: Semantic Release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
issues: write
pull-requests: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Semantic Release (Dry Run)
if: github.event_name == 'workflow_dispatch' && inputs.dry_run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release --dry-run

- name: Semantic Release
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.dry_run)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
27 changes: 2 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,2 @@
dist: focal

language: node_js

node_js:
- 20
- 22

before_install:
- node --version
- npm --version

script:
- npm run build
- npm run test-unit-travis || travis_terminate 1
- npm run lint
- npm run check-packages

deploy:
- provider: script
skip_cleanup: true
script: npx semantic-release
on:
node: 22
branch: main
# CI/CD has been migrated to GitHub Actions.
# See .github/workflows/ci.yml and .github/workflows/release.yml
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@
"postversion": "publisher --no-checks --dry-run",
"semVerDryRun": "npx semantic-release -d",
"test": "npm run build && npm run lint && jest test/",
"test-unit": "npm run build && jest test/unit/",
"test-unit": "npm run build && jest --runInBand test/unit/",
"test-integration": "npm run build && jest test/integration",
"test-examples": "npm run build && jest examples/",
"test-travis": "jest --runInBand --testNamePattern='^((?!@slow).)*$' test/",
"test-unit-travis": "jest --runInBand test/unit/",
"test-integration-travis": "jest --runInBand --no-colors --testNamePattern='^((?!@slow).)*$' --json test/integration > test-output.log"
},
"license": "Apache-2.0",
Expand Down