Skip to content

Commit 54b0d82

Browse files
committed
ci(action): update workflows
1 parent a0cbd86 commit 54b0d82

File tree

4 files changed

+60
-19
lines changed

4 files changed

+60
-19
lines changed

.commitlintrc

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
{"extends": ["@insurgentlab/commitlint-config"]}
1+
{
2+
"extends": [
3+
"@insurgentlab/commitlint-config"
4+
]
5+
}

.github/workflows/release.yml

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
name: Test & Release
1+
name: Release
22

33
on:
44
push:
55
branches:
66
- main
77

88
jobs:
9-
lint-and-test:
9+
test:
1010
uses: ./.github/workflows/test.yml
11-
secrets: inherit
11+
secrets:
12+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1213

1314
release:
14-
needs: lint-and-test
15+
needs: test
1516

1617
runs-on: ubuntu-latest
1718

@@ -20,14 +21,21 @@ jobs:
2021
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
2122
with:
2223
persist-credentials: false
23-
- name: Use Node.js
24+
25+
- name: Use Node.js LTS
2426
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
2527
with:
2628
node-version: 'lts/*'
29+
cache: npm
30+
2731
- name: Install packages
2832
run: npm ci
33+
34+
- name: Audit npm signatures
35+
run: npm audit signatures
36+
2937
- name: Run Semantic Release
30-
run: npm run release
38+
run: npx semantic-release
3139
env:
3240
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
3341
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

+40-10
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,76 @@
1-
name: Lint & Test
1+
name: Test
22

33
on:
4-
workflow_call:
4+
push:
5+
branches:
6+
- isn-renovate/** # branches generated by https://github.com/apps/isn-renovate
57
pull_request:
68
branches:
79
- main
10+
workflow_call:
11+
secrets:
12+
CODECOV_TOKEN:
13+
required: true
814

915
jobs:
10-
lint-and-test:
11-
runs-on: ${{ matrix.os }}
16+
test_matrix:
1217
strategy:
1318
matrix:
1419
os: [ubuntu-latest, windows-latest, macos-latest]
20+
node-version: [18, 20, 21]
21+
22+
runs-on: ${{ matrix.os }}
23+
timeout-minutes: 5
1524

1625
steps:
1726
- name: Checkout project
1827
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
1928
with:
2029
fetch-depth: 0
21-
- name: Use Node.js
30+
31+
- name: Use Node.js ${{ matrix.node-version }}
2232
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
2333
with:
24-
node-version: 'lts/*'
34+
node-version: ${{ matrix.node-version }}
35+
cache: npm
36+
2537
- name: Install packages
2638
run: npm ci
39+
40+
- name: Audit npm signatures
41+
run: npm audit signatures
42+
2743
- name: Check codestyle compliance
2844
run: npm run lint
45+
2946
- name: Run tests
3047
run: npm run test
3148

32-
# Ensure commitlint is working with HEAD version of our preset
33-
- name: Validate current commit (last commit) with commitlint
49+
- name: Ensure commitlint works with our current config (push event)
3450
if: github.event_name == 'push'
3551
run: npx commitlint --from HEAD~1 --to HEAD --verbose
36-
- name: Validate PR commits with commitlint
52+
- name: Ensure commitlint works with our current config (pull_request event)
3753
if: github.event_name == 'pull_request'
3854
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
3955

4056
- name: Upload coverage reports to Codecov
41-
if: ${{ matrix.os == 'ubuntu-latest' }}
57+
if: strategy.job-index == 0
4258
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3
4359
with:
4460
token: ${{ secrets.CODECOV_TOKEN }}
4561
files: coverage/coverage-final.json
4662
fail_ci_if_error: true
63+
64+
# separate job to set as required status check in branch protection
65+
required_check:
66+
runs-on: ubuntu-latest
67+
needs:
68+
- test_matrix
69+
if: always()
70+
steps:
71+
- name: All required jobs and matrix versions passed
72+
if: ${{ !(contains(needs.*.result, 'failure')) }}
73+
run: exit 0
74+
- name: Some required jobs or matrix versions failed
75+
if: ${{ contains(needs.*.result, 'failure') }}
76+
run: exit 1

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
"lint": "npm run lint:eslint && npm run lint:prettier",
1414
"lint:fix": "npm run lint:eslint -- --fix && npm run lint:prettier -- --write",
1515
"test": "jest --coverage",
16-
"test:commitlint": "commitlint --from HEAD~1 --to HEAD --verbose",
17-
"release": "semantic-release"
16+
"test:commitlint": "commitlint --from HEAD~1 --to HEAD --verbose"
1817
},
1918
"engines": {
2019
"node": ">=v16"

0 commit comments

Comments
 (0)