Skip to content

Commit af7b6ee

Browse files
authored
chore: GitHub CI improvements (#262)
Github Actions Workflow: - Use Node 22 and the latest checkout github action for code coverage job - Replace HUSKY_SKIP_INSTALL with HUSKY=0 for Husky v9 compatibility - Set HUSKY env variable once for entire workflow - Use built-in npm module caching instead of manual cache setup - Add TypeScript build step to static analysis - Use codecov's official action for uploading coverage reports - Remove redundant npm test execution from test-check-coverage - Add automerge job for Dependabot Dependabot Config: - Set npm updates to weekly on Wednesdays at 00:00 UTC - Batch npm update PRs by semver into separate major, minor, and patch groups - Set monthly GitHub Actions updates on Wednesdays at 01:00 UTC
1 parent 3fbe355 commit af7b6ee

File tree

3 files changed

+62
-39
lines changed

3 files changed

+62
-39
lines changed

.github/dependabot.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,33 @@
1-
# To get started with Dependabot version updates, you'll need to specify which
2-
# package ecosystems to update and where the package manifests are located.
3-
# Please see the documentation for all configuration options:
4-
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5-
61
version: 2
72
updates:
8-
- package-ecosystem: "npm" # See documentation for possible values
9-
directory: "/" # Location of package manifests
3+
# Dependency updates weekly batched by semver
4+
- package-ecosystem: "npm"
5+
directory: "/"
106
schedule:
117
interval: "weekly"
8+
day: "wednesday"
9+
time: "00:00" # UTC
10+
open-pull-requests-limit: 10
11+
commit-message:
12+
prefix: "chore"
13+
include: "scope"
14+
groups:
15+
major-updates:
16+
update-types: ["major"]
17+
minor-updates:
18+
update-types: ["minor"]
19+
patch-updates:
20+
update-types: ["patch"]
21+
22+
# GitHub Actions updates monthly
23+
- package-ecosystem: "github-actions"
24+
directory: "/"
25+
schedule:
26+
interval: "monthly"
27+
day: "wednesday"
28+
time: "01:00"
29+
open-pull-requests-limit: 10
30+
31+
commit-message:
32+
prefix: "chore"
33+
include: "scope"

.github/workflows/main.yml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on: [push, pull_request]
55
permissions:
66
contents: read
77

8+
env:
9+
HUSKY: 0
10+
811
jobs:
912
static-analysis:
1013
runs-on: ubuntu-latest
@@ -16,18 +19,13 @@ jobs:
1619
- uses: actions/setup-node@v4
1720
with:
1821
node-version: "22"
19-
- name: Cache modules
20-
uses: actions/cache@v4
21-
with:
22-
path: ~/.npm
23-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
24-
restore-keys: |
25-
${{ runner.os }}-node-
22+
cache: 'npm'
2623
- name: Install dependencies
2724
run: |
2825
npm ci
29-
env:
30-
HUSKY_SKIP_INSTALL: 1
26+
- name: Build TypeScript types
27+
run: |
28+
npm run build
3129
- name: Prettier
3230
run: |
3331
npm run prettier:check
@@ -41,24 +39,19 @@ jobs:
4139
- uses: actions/checkout@v4
4240
- uses: actions/setup-node@v4
4341
with:
44-
node-version: "16"
45-
- name: Cache npm
46-
uses: actions/cache@v4
47-
with:
48-
path: ~/.npm
49-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
50-
restore-keys: |
51-
${{ runner.os }}-node-
42+
node-version: "22"
43+
cache: 'npm'
5244
- name: Install dependencies
5345
run: |
5446
npm ci
55-
env:
56-
HUSKY_SKIP_INSTALL: 1
5747
- name: Integration
5848
run: |
5949
npm run test-check-coverage
6050
- name: Upload coverage report
61-
run: bash <(curl -s https://codecov.io/bash) -F unit -s coverage/lcov.info
51+
uses: codecov/codecov-action@v5
52+
with:
53+
files: ./coverage/lcov.info
54+
fail_ci_if_error: true
6255

6356
test:
6457
runs-on: ubuntu-latest
@@ -68,23 +61,15 @@ jobs:
6861
node-version: [20, 22, 24]
6962

7063
steps:
71-
- uses: actions/checkout@v2
64+
- uses: actions/checkout@v4
7265
- name: Use Node.js ${{ matrix.node-version }}
7366
uses: actions/setup-node@v4
7467
with:
7568
node-version: ${{ matrix.node-version }}
76-
- name: Cache modules
77-
uses: actions/cache@v4
78-
with:
79-
path: ~/.npm
80-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
81-
restore-keys: |
82-
${{ runner.os }}-node-
69+
cache: 'npm'
8370
- name: Install dependencies
8471
run: |
8572
npm ci
86-
env:
87-
HUSKY_SKIP_INSTALL: 1
8873
- name: npm test
8974
run: npm test
9075

@@ -109,4 +94,20 @@ jobs:
10994
run: |
11095
npm run test-cloud
11196
112-
97+
dependabot-automerge:
98+
needs: [static-analysis, coverage, test, saucelabs-test]
99+
if: >
100+
github.event_name == 'pull_request' &&
101+
github.event.pull_request.user.login == 'dependabot[bot]'
102+
runs-on: ubuntu-latest
103+
permissions:
104+
contents: read
105+
pull-requests: write
106+
issues: write
107+
steps:
108+
- name: Automerge Dependabot PRs if all checks have passed
109+
shell: bash
110+
env:
111+
GH_TOKEN: ${{ github.token }}
112+
run: |
113+
gh pr merge --squash --auto ${{ github.event.pull_request.number }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"prepublishOnly": "npm run build && mkdocs gh-deploy -r upstream || mkdocs gh-deploy -r origin",
2929
"test": "mocha ./lib/*.test.js",
3030
"test-cloud": "./test-cloud.sh",
31-
"test-check-coverage": "npm run test-coverage && c8 check-coverage --branches 100 --functions 100 --lines 100",
31+
"test-check-coverage": "c8 --all --reporter text --reporter html --reporter lcovonly --check-coverage --branches 100 --functions 100 --lines 100 npm run test",
3232
"test-coverage": "c8 --all --reporter text --reporter html --reporter lcovonly npm run test",
3333
"test-headless": "mochify --driver puppeteer",
3434
"prettier:check": "prettier --check '**/*.{js,css,md}'",

0 commit comments

Comments
 (0)