Skip to content

Commit da0f1e7

Browse files
committed
chore: setup github actions build
Signed-off-by: BRIAN GLEESON <Brian.Gleeson@ie.ibm.com>
1 parent af2068c commit da0f1e7

File tree

4 files changed

+179
-27
lines changed

4 files changed

+179
-27
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: build and test pull-request
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
# Allow workflow to be triggered manually.
9+
10+
jobs:
11+
detect-secrets:
12+
name: detect-secrets
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: 3.12
23+
24+
- name: Install detect-secrets
25+
run: |
26+
pip install --upgrade "git+https://github.com/ibm/detect-secrets.git@master#egg=detect-secrets"
27+
28+
- name: Run detect-secrets
29+
run: |
30+
detect-secrets scan --update .secrets.baseline
31+
detect-secrets -v audit --report --fail-on-unaudited --fail-on-live --fail-on-audited-real .secrets.baseline
32+
33+
build:
34+
name: Test on Node.js ${{ matrix.node-version }}
35+
needs: detect-secrets
36+
runs-on: ubuntu-latest
37+
38+
strategy:
39+
matrix:
40+
node-version: [20, 22, 24]
41+
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
46+
- name: Setup Node.js ${{ matrix.node-version }}
47+
uses: actions/setup-node@v4
48+
with:
49+
node-version: ${{ matrix.node-version }}
50+
cache: 'npm'
51+
52+
- name: Display Node.js and npm versions
53+
run: |
54+
node --version
55+
npm --version
56+
57+
- name: Install dependencies
58+
run: npm ci
59+
60+
- name: Build
61+
run: npm run build
62+
63+
- name: Run unit tests
64+
run: npm run test-unit
65+
66+
- name: Run linter
67+
run: npm run lint
68+
69+
- name: Check packages
70+
run: npm run check-packages
71+
72+
# - name: Upload coverage to Codecov
73+
# if: matrix.node-version == 22
74+
# uses: codecov/codecov-action@v4
75+
# with:
76+
# files: ./coverage/lcov.info
77+
# flags: unittests
78+
# name: codecov-umbrella
79+
# fail_ci_if_error: false

.github/workflows/release.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
dry_run:
10+
description: 'Run semantic-release in dry-run mode'
11+
required: false
12+
type: boolean
13+
default: true
14+
15+
jobs:
16+
build:
17+
name: Build and Test (node v${{ matrix.node-version }})
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
node-version: [20, 22, 24]
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
persist-credentials: false
29+
30+
- name: Setup Node.js ${{ matrix.node-version }}
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: ${{ matrix.node-version }}
34+
cache: 'npm'
35+
36+
- name: Display Node.js and npm versions
37+
run: |
38+
node --version
39+
npm --version
40+
41+
- name: Install dependencies
42+
run: npm ci
43+
44+
- name: Build
45+
run: npm run build
46+
47+
- name: Run unit tests
48+
run: npm run test-unit
49+
50+
- name: Run linter
51+
run: npm run lint
52+
53+
- name: Check packages
54+
run: npm run check-packages
55+
56+
release:
57+
name: Semantic Release
58+
runs-on: ubuntu-latest
59+
needs: build
60+
permissions:
61+
contents: write
62+
issues: write
63+
pull-requests: write
64+
id-token: write
65+
66+
steps:
67+
- name: Checkout code
68+
uses: actions/checkout@v4
69+
with:
70+
fetch-depth: 0
71+
persist-credentials: false
72+
73+
- name: Setup Node.js 22
74+
uses: actions/setup-node@v4
75+
with:
76+
node-version: 22
77+
cache: 'npm'
78+
79+
- name: Install dependencies
80+
run: npm ci
81+
82+
- name: Build
83+
run: npm run build
84+
85+
- name: Semantic Release (Dry Run)
86+
if: github.event_name == 'workflow_dispatch' && inputs.dry_run
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
90+
run: npx semantic-release --dry-run
91+
92+
- name: Semantic Release
93+
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.dry_run)
94+
env:
95+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
97+
run: npx semantic-release

.travis.yml

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,2 @@
1-
dist: focal
2-
3-
language: node_js
4-
5-
node_js:
6-
- 20
7-
- 22
8-
9-
before_install:
10-
- node --version
11-
- npm --version
12-
13-
script:
14-
- npm run build
15-
- npm run test-unit-travis || travis_terminate 1
16-
- npm run lint
17-
- npm run check-packages
18-
19-
deploy:
20-
- provider: script
21-
skip_cleanup: true
22-
script: npx semantic-release
23-
on:
24-
node: 22
25-
branch: main
1+
# CI/CD has been migrated to GitHub Actions.
2+
# See .github/workflows/ci.yml and .github/workflows/release.yml

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
"postversion": "publisher --no-checks --dry-run",
2626
"semVerDryRun": "npx semantic-release -d",
2727
"test": "npm run build && npm run lint && jest test/",
28-
"test-unit": "npm run build && jest test/unit/",
28+
"test-unit": "npm run build && jest --runInBand test/unit/",
2929
"test-integration": "npm run build && jest test/integration",
3030
"test-examples": "npm run build && jest examples/",
3131
"test-travis": "jest --runInBand --testNamePattern='^((?!@slow).)*$' test/",
32-
"test-unit-travis": "jest --runInBand test/unit/",
3332
"test-integration-travis": "jest --runInBand --no-colors --testNamePattern='^((?!@slow).)*$' --json test/integration > test-output.log"
3433
},
3534
"license": "Apache-2.0",

0 commit comments

Comments
 (0)