Skip to content

Commit 48ecc0b

Browse files
authored
ci: simplify main CI workflow matrix configuration (#393)
1 parent 75a3f38 commit 48ecc0b

File tree

3 files changed

+36
-51
lines changed

3 files changed

+36
-51
lines changed

.eslintrc.cjs

+2-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,8 @@ module.exports = {
33
env: {
44
browser: true,
55
es6: true,
6-
'vitest-globals/env': true,
76
},
8-
extends: [
9-
'standard',
10-
'plugin:vitest-globals/recommended',
11-
'plugin:svelte/recommended',
12-
'prettier',
13-
],
7+
extends: ['standard', 'plugin:svelte/recommended', 'prettier'],
148
plugins: ['svelte', 'simple-import-sort', 'json-files'],
159
rules: {
1610
'simple-import-sort/imports': 'error',
@@ -51,6 +45,6 @@ module.exports = {
5145
ecmaVersion: 2022,
5246
sourceType: 'module',
5347
},
54-
globals: { $state: 'readonly', $props: 'readonly' },
48+
globals: { afterEach: 'readonly', $state: 'readonly', $props: 'readonly' },
5549
ignorePatterns: ['!/.*'],
5650
}

.github/workflows/release.yml

+14-23
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ jobs:
1717
main:
1818
# ignore all-contributors PRs
1919
if: ${{ !contains(github.head_ref, 'all-contributors') }}
20-
name: Node ${{ matrix.node }}, Svelte ${{ matrix.svelte }}, ${{ matrix.test-runner }}
20+
name: Node ${{ matrix.node }}, Svelte ${{ matrix.svelte }}, ${{ matrix.check }}
2121
runs-on: ubuntu-latest
22-
continue-on-error: ${{ matrix.experimental }}
2322

2423
# enable OIDC for codecov uploads
2524
permissions:
@@ -30,21 +29,17 @@ jobs:
3029
matrix:
3130
node: ['16', '18', '20']
3231
svelte: ['3', '4']
33-
test-runner: ['vitest:jsdom', 'vitest:happy-dom', 'jest']
34-
experimental: [false]
32+
check: ['test:vitest:jsdom', 'test:vitest:happy-dom', 'test:jest']
3533
include:
36-
- node: '20'
37-
svelte: 'next'
38-
test-runner: 'vitest:jsdom'
39-
experimental: true
40-
- node: '20'
41-
svelte: 'next'
42-
test-runner: 'vitest:happy-dom'
43-
experimental: true
44-
- node: '20'
45-
svelte: 'next'
46-
test-runner: 'jest'
47-
experimental: true
34+
# We only need to lint once, so do it on latest Node and Svelte
35+
- { node: '20', svelte: '4', check: 'lint' }
36+
# `SvelteComponent` is not generic in Svelte 3, so type-checking only passes in >= 4
37+
- { node: '20', svelte: '4', check: 'types' }
38+
- { node: '20', svelte: 'next', check: 'types' }
39+
# Only run Svelte 5 checks on latest Node
40+
- { node: '20', svelte: 'next', check: 'test:vitest:jsdom' }
41+
- { node: '20', svelte: 'next', check: 'test:vitest:happy-dom' }
42+
- { node: '20', svelte: 'next', check: 'test:jest' }
4843

4944
steps:
5045
- name: ⬇️ Checkout repo
@@ -60,15 +55,11 @@ jobs:
6055
npm install --no-package-lock
6156
npm install --no-save svelte@${{ matrix.svelte }}
6257
63-
- name: ▶️ Run tests
64-
run: npm run test:${{ matrix.test-runner }}
65-
66-
- name: ▶️ Run type-checks
67-
# NOTE: `SvelteComponent` is not generic in Svelte v3, so type-checking will not pass
68-
if: ${{ matrix.node == '20' && matrix.svelte != '3' && matrix.test-runner == 'vitest:jsdom' }}
69-
run: npm run types
58+
- name: ▶️ Run ${{ matrix.check }}
59+
run: npm run ${{ matrix.check }}
7060

7161
- name: ⬆️ Upload coverage report
62+
if: ${{ startsWith(matrix.check, 'test:') }}
7263
uses: codecov/codecov-action@v4
7364
with:
7465
use_oidc: true

package.json

+20-20
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"!__tests__"
5454
],
5555
"scripts": {
56+
"all": "npm-run-all contributors:generate toc format types build test:vitest:* test:jest",
5657
"toc": "doctoc README.md",
5758
"lint": "prettier . --check && eslint .",
5859
"lint:delta": "npm-run-all -p prettier:delta eslint:delta",
@@ -62,7 +63,7 @@
6263
"format:delta": "npm-run-all format:prettier:delta format:eslint:delta",
6364
"format:prettier:delta": "prettier --write `./scripts/changed-files`",
6465
"format:eslint:delta": "eslint --fix `./scripts/changed-files`",
65-
"setup": "npm install && npm run validate",
66+
"setup": "npm install && npm run all",
6667
"test": "vitest run --coverage",
6768
"test:watch": "vitest",
6869
"test:vitest:jsdom": "vitest run --coverage --environment jsdom",
@@ -96,34 +97,33 @@
9697
"@sveltejs/vite-plugin-svelte": "^3.1.1",
9798
"@testing-library/jest-dom": "^6.3.0",
9899
"@testing-library/user-event": "^14.5.2",
99-
"@typescript-eslint/eslint-plugin": "7.15.0",
100-
"@typescript-eslint/parser": "7.15.0",
101-
"@vitest/coverage-v8": "^1.5.2",
100+
"@typescript-eslint/eslint-plugin": "^7.16.0",
101+
"@typescript-eslint/parser": "^7.16.0",
102+
"@vitest/coverage-v8": "^2.0.2",
102103
"all-contributors-cli": "^6.26.1",
103104
"doctoc": "^2.2.1",
104-
"eslint": "8.57.0",
105-
"eslint-config-prettier": "9.1.0",
106-
"eslint-config-standard": "17.1.0",
107-
"eslint-plugin-import": "2.29.1",
105+
"eslint": "^8.57.0",
106+
"eslint-config-prettier": "^9.1.0",
107+
"eslint-config-standard": "^17.1.0",
108+
"eslint-plugin-import": "^2.29.1",
108109
"eslint-plugin-json-files": "^4.1.0",
109-
"eslint-plugin-n": "16.6.2",
110-
"eslint-plugin-promise": "6.4.0",
111-
"eslint-plugin-simple-import-sort": "12.1.0",
112-
"eslint-plugin-svelte": "2.41.0",
113-
"eslint-plugin-vitest-globals": "1.5.0",
110+
"eslint-plugin-n": "^16.6.2",
111+
"eslint-plugin-promise": "^6.4.0",
112+
"eslint-plugin-simple-import-sort": "^12.1.1",
113+
"eslint-plugin-svelte": "^2.42.0",
114114
"expect-type": "^0.19.0",
115-
"happy-dom": "^14.7.1",
115+
"happy-dom": "^14.12.3",
116116
"jest": "^29.7.0",
117117
"jest-environment-jsdom": "^29.7.0",
118118
"jsdom": "^24.0.0",
119119
"npm-run-all": "^4.1.5",
120-
"prettier": "3.3.2",
121-
"prettier-plugin-svelte": "3.2.5",
120+
"prettier": "^3.3.3",
121+
"prettier-plugin-svelte": "^3.2.5",
122122
"svelte": "^3 || ^4 || ^5 || ^5.0.0-next.0",
123-
"svelte-check": "^3.6.3",
123+
"svelte-check": "^3.8.4",
124124
"svelte-jester": "^5.0.0",
125-
"typescript": "^5.3.3",
126-
"vite": "^5.1.1",
127-
"vitest": "^1.5.2"
125+
"typescript": "^5.5.3",
126+
"vite": "^5.3.3",
127+
"vitest": "^2.0.2"
128128
}
129129
}

0 commit comments

Comments
 (0)