Skip to content

Commit 66a697b

Browse files
committed
Build: Separate Node.js & Browser Tests, update tested Node.js versions
Separate Browser Tests to its own workflow, simplifying the test matrix. This also makes the lint only runs once; when it's running in multiple jobs, inline lint comments on PRs are posted for every one of them, causing lots of duplication.
1 parent 13bbc77 commit 66a697b

File tree

2 files changed

+118
-84
lines changed

2 files changed

+118
-84
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Browser Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches-ignore: "dependabot/**"
7+
# Once a week every Monday
8+
schedule:
9+
- cron: "42 1 * * 1"
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
NODE_VERSION: 22.x
16+
17+
jobs:
18+
build-and-test:
19+
runs-on: ubuntu-latest
20+
name: |
21+
${{ matrix.BROWSER }} | ${{ matrix.CONFIGS.name }}
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
BROWSER: [chrome, firefox]
26+
CONFIGS:
27+
- config: jtr-git.yml
28+
name: jQuery git
29+
- config: jtr-stable.yml
30+
name: jQuery stable
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
35+
36+
- name: Use Node.js ${{ env.NODE_VERSION }}
37+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
38+
with:
39+
node-version: ${{ env.NODE_VERSION }}
40+
cache: npm
41+
cache-dependency-path: '**/package-lock.json'
42+
43+
- name: Install npm dependencies
44+
run: npm ci
45+
46+
- name: Build
47+
run: npm run build
48+
49+
- name: Test
50+
run: |
51+
npm run test:unit -- \
52+
--headless -b ${{ matrix.BROWSER }} \
53+
-c ${{ matrix.CONFIGS.config }}
54+
55+
edge:
56+
runs-on: windows-latest
57+
name: |
58+
edge | ${{ matrix.CONFIGS.name }}
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
CONFIGS:
63+
- config: jtr-git.yml
64+
name: jQuery git
65+
- config: jtr-stable.yml
66+
name: jQuery stable
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
70+
71+
- name: Use Node.js ${{ env.NODE_VERSION }}
72+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
73+
with:
74+
node-version: ${{ env.NODE_VERSION }}
75+
cache: npm
76+
cache-dependency-path: '**/package-lock.json'
77+
78+
- name: Install dependencies
79+
run: npm ci
80+
81+
- name: Build
82+
run: npm run build
83+
84+
- name: Test
85+
run: npm run test:unit -- --headless -b edge -c ${{ matrix.CONFIGS.config }}
86+
87+
safari:
88+
runs-on: macos-latest
89+
name: |
90+
safari | ${{ matrix.CONFIGS.name }}
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
CONFIGS:
95+
- config: jtr-git.yml
96+
name: jQuery git
97+
- config: jtr-stable.yml
98+
name: jQuery stable
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
102+
103+
- name: Use Node.js ${{ env.NODE_VERSION }}
104+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
105+
with:
106+
node-version: ${{ env.NODE_VERSION }}
107+
cache: npm
108+
cache-dependency-path: '**/package-lock.json'
109+
110+
- name: Install dependencies
111+
run: npm ci
112+
113+
- name: Build
114+
run: npm run build
115+
116+
- name: Test
117+
run: npm run test:unit -- -b safari -c ${{ matrix.CONFIGS.config }}

.github/workflows/node.js.yml

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
pull_request:
55
push:
66
branches-ignore: "dependabot/**"
7-
# Once a week every Monday
8-
schedule:
9-
- cron: "42 1 * * 1"
107

118
permissions:
129
contents: read
@@ -17,17 +14,7 @@ env:
1714
jobs:
1815
build-and-test:
1916
runs-on: ubuntu-latest
20-
name: |
21-
${{ matrix.BROWSER }} | ${{ matrix.CONFIGS.name }}
22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
BROWSER: [chrome, firefox]
26-
CONFIGS:
27-
- config: jtr-git.yml
28-
name: jQuery git
29-
- config: jtr-stable.yml
30-
name: jQuery stable
17+
name: Build & lint (${{ env.NODE_VERSION }})
3118

3219
steps:
3320
- name: Checkout
@@ -49,73 +36,3 @@ jobs:
4936
# Lint must happen after build as we lint generated files.
5037
- name: Lint
5138
run: npm run lint
52-
53-
- name: Test
54-
run: |
55-
npm run test:unit -- \
56-
--headless -b ${{ matrix.BROWSER }} \
57-
-c ${{ matrix.CONFIGS.config }}
58-
59-
edge:
60-
runs-on: windows-latest
61-
name: |
62-
edge | ${{ matrix.CONFIGS.name }}
63-
strategy:
64-
fail-fast: false
65-
matrix:
66-
CONFIGS:
67-
- config: jtr-git.yml
68-
name: jQuery git
69-
- config: jtr-stable.yml
70-
name: jQuery stable
71-
steps:
72-
- name: Checkout
73-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
74-
75-
- name: Use Node.js ${{ env.NODE_VERSION }}
76-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
77-
with:
78-
node-version: ${{ env.NODE_VERSION }}
79-
cache: npm
80-
cache-dependency-path: '**/package-lock.json'
81-
82-
- name: Install dependencies
83-
run: npm ci
84-
85-
- name: Build
86-
run: npm run build
87-
88-
- name: Test
89-
run: npm run test:unit -- --headless -b edge -c ${{ matrix.CONFIGS.config }}
90-
91-
safari:
92-
runs-on: macos-latest
93-
name: |
94-
safari | ${{ matrix.CONFIGS.name }}
95-
strategy:
96-
fail-fast: false
97-
matrix:
98-
CONFIGS:
99-
- config: jtr-git.yml
100-
name: jQuery git
101-
- config: jtr-stable.yml
102-
name: jQuery stable
103-
steps:
104-
- name: Checkout
105-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
106-
107-
- name: Use Node.js ${{ env.NODE_VERSION }}
108-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
109-
with:
110-
node-version: ${{ env.NODE_VERSION }}
111-
cache: npm
112-
cache-dependency-path: '**/package-lock.json'
113-
114-
- name: Install dependencies
115-
run: npm ci
116-
117-
- name: Build
118-
run: npm run build
119-
120-
- name: Test
121-
run: npm run test:unit -- -b safari -c ${{ matrix.CONFIGS.config }}

0 commit comments

Comments
 (0)