Skip to content

Commit 3151f4a

Browse files
committed
chore: update ci to match current vite-plugin-svelte setup
1 parent c038b25 commit 3151f4a

File tree

6 files changed

+246
-262
lines changed

6 files changed

+246
-262
lines changed

.changeset/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config@1.6.0/schema.json",
3-
"changelog": ["./changelog-github-custom.js", { "repo": "rixo/svelte-hmr" }],
3+
"changelog": ["@svitejs/changesets-changelog-github-compact", { "repo": "sveltejs/svelte-hmr" }],
44
"commit": false,
55
"linked": [],
66
"access": "public",
77
"baseBranch": "master",
88
"updateInternalDependencies": "patch",
9-
"ignore": ["test**"]
9+
"ignore": ["playground**","test**"]
1010
}

.github/workflows/ci.yml

Lines changed: 37 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
# build and test on linux, windows, mac with node 12, 14, 16
1+
# build and test
22
name: CI
33

4-
env:
5-
pnpm_store_path: ${{github.workspace}}/.pnpm-store
6-
CI: true
7-
84
on:
95
push:
106
branches:
@@ -14,148 +10,65 @@ on:
1410
- master
1511

1612
jobs:
17-
pnpmstore:
13+
# "checks" job runs on linux + 16 only and checks that install, build, lint and audit work
14+
# it also primes the pnpm store cache for linux, important for downstream tests
15+
checks:
16+
timeout-minutes: 5
1817
runs-on: ${{ matrix.os }}
19-
2018
strategy:
21-
fail-fast: false
2219
matrix:
23-
# os: [ ubuntu-latest, windows-latest, macos-latest ]
24-
os: [ ubuntu-latest, macos-latest ]
25-
node: [ 12, 14, 16 ]
26-
20+
# pseudo-matrix for convenience, NEVER use more than a single combination
21+
node: [16]
22+
os: [ubuntu-latest]
23+
outputs:
24+
build_successful: ${{ steps.build.outcome == 'success' }}
2725
steps:
28-
- uses: actions/setup-node@v2
26+
- uses: actions/checkout@v3
27+
- uses: actions/setup-node@v3
2928
with:
3029
node-version: ${{ matrix.node }}
31-
32-
- name: checkout
33-
uses: actions/checkout@v2
34-
35-
- name: install pnpm
36-
run: npm i -g pnpm@6
37-
- name: set pnpm store-dir
38-
run: pnpm config set store-dir ${{ env.pnpm_store_path }}
39-
- name: pnpm-store
40-
uses: actions/cache@v2
41-
id: pnpm-store
42-
with:
43-
path: ${{ env.pnpm_store_path }}
44-
key: ${{ matrix.os }}-node-v${{ matrix.node }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
45-
46-
- name: pnpm-store-fallback
47-
if: steps.pnpm-store.outputs.cache-hit != 'true'
48-
uses: actions/cache@v2
49-
id: pnpm-store-fallback
50-
with:
51-
path: ${{ env.pnpm_store_path }}
52-
key: ${{ matrix.os }}-node-v${{ matrix.node }}-pnpm-store-fallback-${{ hashFiles('**/pnpm-lock.yaml') }}
53-
restore-keys: |
54-
${{ matrix.os }}-node-v${{ matrix.node }}-pnpm-store-fallback-
55-
${{ matrix.os }}-node-v${{ matrix.node }}-pnpm-store-
56-
57-
- name: install
58-
if: steps.pnpm-store.outputs.cache-hit != 'true'
59-
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
60-
- name: prune store
61-
if: steps.pnpm-store.outputs.cache-hit != 'true'
62-
run: pnpm store prune
63-
- name: check store
64-
if: steps.pnpm-store.outputs.cache-hit != 'true'
65-
run: pnpm store status
66-
67-
lint:
68-
needs: pnpmstore
69-
70-
runs-on: ${{ matrix.os }}
71-
strategy:
72-
matrix:
73-
os: [ ubuntu-latest ]
74-
node: [ 14 ]
75-
steps:
76-
- uses: actions/setup-node@v2
30+
- run: npm i -g pnpm@6
31+
- uses: actions/setup-node@v3
7732
with:
7833
node-version: ${{ matrix.node }}
79-
80-
- name: checkout
81-
uses: actions/checkout@v2
82-
83-
- name: pnpm-store
84-
uses: actions/cache@v2
85-
id: pnpm-store
86-
with:
87-
path: ${{ env.pnpm_store_path }}
88-
key: ${{ matrix.os }}-node-v${{ matrix.node }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
89-
- name: install pnpm
90-
run: npm i -g pnpm@6
91-
- name: set pnpm store-dir
92-
run: pnpm config set store-dir ${{ env.pnpm_store_path }}
34+
cache: 'pnpm'
35+
cache-dependency-path: '**/pnpm-lock.yaml'
9336
- name: install
94-
run: pnpm install --frozen-lockfile --offline --ignore-scripts
37+
run: pnpm install --frozen-lockfile --prefer-offline
38+
- name: build
39+
id: build
40+
run: pnpm run build
9541
- name: lint
96-
run: pnpm lint
97-
98-
audit:
99-
needs: pnpmstore
100-
101-
runs-on: ${{ matrix.os }}
102-
strategy:
103-
matrix:
104-
os: [ ubuntu-latest ]
105-
node: [ 14 ]
106-
steps:
107-
- uses: actions/setup-node@v2
108-
with:
109-
node-version: ${{ matrix.node }}
110-
111-
- name: checkout
112-
uses: actions/checkout@v2
113-
114-
- name: pnpm-store
115-
uses: actions/cache@v2
116-
id: pnpm-store
117-
with:
118-
path: ${{ env.pnpm_store_path }}
119-
key: ${{ matrix.os }}-node-v${{ matrix.node }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
120-
- name: install pnpm
121-
run: npm i -g pnpm@6
122-
- name: set pnpm store-dir
123-
run: pnpm config set store-dir ${{ env.pnpm_store_path }}
124-
- name: install
125-
run: pnpm install --frozen-lockfile --offline --ignore-scripts
42+
if: (${{ success() }} || ${{ failure() }})
43+
run: pnpm run lint
12644
- name: audit
45+
if: (${{ success() }} || ${{ failure() }})
12746
run: pnpm audit
12847

48+
# this is the test matrix
49+
# it is skipped if the build step of the checks job wasn't successful (still runs if lint or audit fail)
12950
test:
130-
needs: pnpmstore
131-
51+
needs: checks
52+
if: (${{ success() }} || ${{ failure() }}) && (${{ needs.checks.output.build_successful }})
53+
timeout-minutes: 10
13254
runs-on: ${{ matrix.os }}
133-
timeout-minutes: 5
13455
strategy:
13556
fail-fast: false
13657
matrix:
13758
os: [ ubuntu-latest, macos-latest ]
138-
node: [ 12, 14, 16 ]
59+
node: [ 14, 16 ]
13960
steps:
140-
- uses: actions/setup-node@v2
61+
- uses: actions/checkout@v2
62+
- uses: actions/setup-node@v3
14163
with:
14264
node-version: ${{ matrix.node }}
143-
144-
- name: checkout
145-
uses: actions/checkout@v2
146-
147-
- name: pnpm-store
148-
uses: actions/cache@v2
149-
id: pnpm-store
65+
- run: npm i -g pnpm@6
66+
- uses: actions/setup-node@v3
15067
with:
151-
path: ${{ env.pnpm_store_path }}
152-
key: ${{ matrix.os }}-node-v${{ matrix.node }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
153-
154-
- name: install pnpm
155-
run: npm i -g pnpm@6
156-
- name: set pnpm store-dir
157-
run: pnpm config set store-dir ${{ env.pnpm_store_path }}
68+
node-version: ${{ matrix.node }}
69+
cache: 'pnpm'
70+
cache-dependency-path: '**/pnpm-lock.yaml'
15871
- name: install
159-
run: pnpm install --frozen-lockfile --offline
72+
run: pnpm install --frozen-lockfile --prefer-offline
16073
- name: run tests
16174
run: pnpm test

.github/workflows/release.yml

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: Release
22

3-
env:
4-
pnpm_store_path: ${{github.workspace}}/.pnpm-store
5-
63
on:
74
push:
85
branches:
@@ -11,47 +8,31 @@ on:
118
jobs:
129
release:
1310
# prevents this action from running on forks
14-
if: github.repository == 'rixo/svelte-hmr'
11+
if: github.repository == 'sveltejs/svelte-hmr'
1512
name: Release
16-
runs-on: ubuntu-latest
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
# pseudo-matrix for convenience, NEVER use more than a single combination
17+
node: [16]
18+
os: [ubuntu-latest]
1719
steps:
1820
- name: checkout
1921
uses: actions/checkout@v2
2022
with:
2123
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
2224
fetch-depth: 0
23-
- name: setup node
24-
uses: actions/setup-node@v2
25-
with:
26-
node-version: 14
27-
# install pnpm and try to reuse cache from ci action by using same cache keys
28-
- name: install pnpm
29-
run: npm i -g pnpm@6
30-
- name: set pnpm store-dir
31-
run: pnpm config set store-dir ${{ env.pnpm_store_path }}
32-
- name: pnpm-store
33-
uses: actions/cache@v2
34-
id: pnpm-store
25+
- uses: actions/setup-node@v3
3526
with:
36-
path: ${{ env.pnpm_store_path }}
37-
key: ubuntu-latest-node-v14-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38-
39-
- name: pnpm-store-fallback
40-
if: steps.pnpm-store.outputs.cache-hit != 'true'
41-
uses: actions/cache@v2
42-
id: pnpm-store-fallback
27+
node-version: ${{ matrix.node }}
28+
- run: npm i -g pnpm@6
29+
- uses: actions/setup-node@v3
4330
with:
44-
path: ${{ env.pnpm_store_path }}
45-
key: ubuntu-latest-node-v14-pnpm-store-fallback-${{ hashFiles('**/pnpm-lock.yaml') }}
46-
restore-keys: |
47-
ubuntu-latest-node-v14-pnpm-store-fallback-
48-
ubuntu-latest-node-v14-pnpm-store-
49-
31+
node-version: ${{ matrix.node }}
32+
cache: 'pnpm'
33+
cache-dependency-path: '**/pnpm-lock.yaml'
5034
- name: install
51-
# install but don't run scripts, they could be evil
52-
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
53-
- name: check store
54-
run: pnpm store status
35+
run: pnpm install --frozen-lockfile --prefer-offline
5536

5637
- name: Creating .npmrc
5738
run: |
@@ -62,7 +43,7 @@ jobs:
6243
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6344
- name: Create Release Pull Request or Publish to npm
6445
id: changesets
65-
uses: changesets/action@master
46+
uses: changesets/action@v1
6647
with:
6748
# This expects you to have a script called release which does a build for your packages and calls changeset publish
6849
publish: pnpm release

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
},
1414
"devDependencies": {
1515
"@changesets/cli": "^2.16.0",
16-
"@changesets/get-github-info": "^0.5.0",
1716
"@rixo/eslint-config": "^0.8.1",
18-
"dotenv": "^10.0.0",
17+
"@svitejs/changesets-changelog-github-compact": "^0.1.1",
1918
"prettier": "^1.19.1"
2019
},
2120
"pnpm": {

playground/kit-app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "kit-app",
33
"version": "0.0.1",
4+
"private": true,
45
"scripts": {
56
"dev": "svelte-kit dev",
67
"build": "svelte-kit build",
@@ -26,4 +27,4 @@
2627
"typescript": "^4.4.3"
2728
},
2829
"type": "module"
29-
}
30+
}

0 commit comments

Comments
 (0)