Skip to content

Commit 243ee2d

Browse files
committed
chore(ci): modernize
1 parent b550a70 commit 243ee2d

File tree

7 files changed

+152
-182
lines changed

7 files changed

+152
-182
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,14 @@ updates:
1212
dependencies:
1313
patterns:
1414
- "*"
15+
- package-ecosystem: github-actions
16+
directory: "/"
17+
schedule:
18+
interval: weekly
19+
time: "04:00"
20+
timezone: Europe/Berlin
21+
open-pull-requests-limit: 3
22+
groups:
23+
dependencies:
24+
patterns:
25+
- "*"

.github/workflows/ci.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- next
8+
pull_request:
9+
branches:
10+
- main
11+
- next
12+
13+
concurrency:
14+
group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
15+
cancel-in-progress: true
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
lint:
22+
name: Lint & Check Types
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
31+
with:
32+
node-version: "lts/*"
33+
cache: "npm"
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Lint
39+
run: npm run lint
40+
41+
- name: Build types
42+
run: npm run build:types
43+
44+
- name: Check types
45+
run: |
46+
if [ -n "$(git status types --porcelain)" ]; then
47+
echo "Missing types. Update types by running 'npm run build:types'";
48+
exit 1;
49+
fi
50+
test:
51+
name: Test - ${{ matrix.os }} (Node.js ${{ matrix.node-version }})
52+
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
os: [ubuntu-latest, windows-latest, macos-latest]
57+
node-version: [18.x, 20.x, 22.x, 24.x]
58+
59+
runs-on: ${{ matrix.os }}
60+
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
64+
65+
- name: Setup Node.js ${{ matrix.node-version }}
66+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
67+
with:
68+
node-version: ${{ matrix.node-version }}
69+
cache: "npm"
70+
71+
- name: Install dependencies
72+
run: npm ci
73+
74+
- name: Link webpack-dev-server
75+
run: |
76+
cp -R client tmp-client
77+
npm link --ignore-scripts
78+
npm link webpack-dev-server --ignore-scripts
79+
rm -r client
80+
cp -R tmp-client client
81+
82+
- name: Run tests
83+
run: npm run test:coverage -- --ci
84+
85+
- name: Upload coverage to Codecov
86+
if: always()
87+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2

.github/workflows/commitlint.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Validate PR
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- edited
9+
10+
concurrency:
11+
group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
commitlint:
19+
name: Lint Commit Messages
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
23+
with:
24+
fetch-depth: 0
25+
26+
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
27+
with:
28+
node-version: "lts/*"
29+
cache: "npm"
30+
31+
- run: npm ci
32+
33+
- name: Validate PR commits with commitlint
34+
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
name: "Dependency Review"
2-
on: [pull_request]
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required,
6+
# PRs introducing known-vulnerable packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
name: Review Dependencies
10+
11+
on: pull_request
312

413
permissions:
514
contents: read
@@ -8,7 +17,8 @@ jobs:
817
dependency-review:
918
runs-on: ubuntu-latest
1019
steps:
11-
- name: "Checkout Repository"
12-
uses: actions/checkout@v4
13-
- name: "Dependency Review"
14-
uses: actions/dependency-review-action@v4
20+
- name: Git Checkout
21+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
22+
23+
- name: Review Dependencies
24+
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2

.github/workflows/nodejs.yml

Lines changed: 0 additions & 125 deletions
This file was deleted.

scripts/prepare-test-for-old-node.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

test/server/open-option.test.js

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,17 @@ const internalIPv4 = Server.internalIPSync("v4");
99

1010
let open;
1111

12-
const needRequireMock =
13-
process.version.startsWith("v18") || process.version.startsWith("v19");
14-
15-
if (needRequireMock) {
16-
open = require("open");
17-
18-
jest.mock("open");
19-
20-
open.mockImplementation(() => ({
21-
catch: jest.fn(),
22-
}));
23-
}
24-
2512
describe('"open" option', () => {
2613
let compiler;
2714

2815
beforeEach(async () => {
2916
compiler = webpack(config);
3017

31-
if (!needRequireMock) {
32-
jest.unstable_mockModule("open", () => ({
33-
default: jest.fn(() => Promise.resolve()),
34-
}));
18+
jest.unstable_mockModule("open", () => ({
19+
default: jest.fn(() => Promise.resolve()),
20+
}));
3521

36-
open = (await import("open")).default;
37-
}
22+
open = (await import("open")).default;
3823
});
3924

4025
afterEach(async () => {

0 commit comments

Comments
 (0)