Skip to content

Commit bf0c19a

Browse files
dominikgbluwy
andauthored
chore: refactor ci to use corepack and package manager via matrix (#11)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
1 parent d8d82fa commit bf0c19a

File tree

5 files changed

+398
-417
lines changed

5 files changed

+398
-417
lines changed

.github/workflows/ci.yml

+23-70
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
name: CI
22

3+
env:
4+
# configure corepack
5+
COREPACK_DEFAULT_TO_LATEST: 0
6+
COREPACK_ENABLE_AUTO_PIN: 0
7+
# configure yarn
8+
YARN_ENABLE_IMMUTABLE_INSTALLS: 'false'
9+
310
on:
411
push:
512
branches:
@@ -15,86 +22,32 @@ on:
1522
jobs:
1623
test:
1724
name: Test
18-
timeout-minutes: 10
25+
timeout-minutes: 5
1926
runs-on: ${{ matrix.os }}
2027
strategy:
2128
fail-fast: false
2229
matrix:
23-
node: [16]
30+
node: [20]
2431
os: [ubuntu-latest, macos-latest, windows-latest]
32+
pm: ["pnpm@9"]
2533
include:
26-
- node: 18
34+
- node: 22
35+
os: ubuntu-latest
36+
pm: "pnpm@9"
37+
- node: 22
38+
os: ubuntu-latest
39+
pm: "yarn@4"
40+
- node: 22
2741
os: ubuntu-latest
42+
pm: "npm@10"
2843
steps:
29-
- name: Checkout
30-
uses: actions/checkout@v3
31-
32-
- name: Install pnpm
33-
uses: pnpm/action-setup@v2.2.4
34-
with:
35-
version: '7.14.1'
36-
37-
- name: Setup node
38-
uses: actions/setup-node@v3
44+
- uses: actions/checkout@v4
45+
- uses: actions/setup-node@v4
3946
with:
4047
node-version: ${{ matrix.node }}
41-
cache: pnpm
42-
cache-dependency-path: '**/pnpm-lock.yaml'
43-
44-
- name: Install dependencies
45-
run: pnpm install --frozen-lockfile --prefer-offline
46-
47-
- name: Test
48-
run: pnpm test
49-
50-
test-npm:
51-
name: Test npm
52-
timeout-minutes: 5
53-
runs-on: ubuntu-latest
54-
steps:
55-
- name: Checkout
56-
uses: actions/checkout@v3
57-
58-
- name: Setup workspaces
59-
run: cat package.json | jq '.workspaces = ["tests/deps/*","tests/projects/*"]' | tee package.json
60-
61-
- name: Setup node
62-
uses: actions/setup-node@v3
63-
with:
64-
node-version: 16
65-
66-
- name: Install dependencies
67-
run: npm install
68-
69-
- name: Test
70-
run: npm test
71-
72-
test-yarn:
73-
name: Test yarn PnP
74-
timeout-minutes: 5
75-
runs-on: ubuntu-latest
76-
steps:
77-
- name: Checkout
78-
uses: actions/checkout@v3
79-
80-
- name: Setup workspaces
81-
run: cat package.json | jq '.workspaces = ["tests/deps/*","tests/projects/*"]' | tee package.json
82-
83-
- name: Use yarn 3
84-
run: cat package.json | jq '.packageManager = "yarn@3.2.4"' | tee package.json
85-
86-
- name: Setup node
87-
uses: actions/setup-node@v3
88-
with:
89-
node-version: 16
90-
91-
- name: Enable corepack
92-
run: corepack enable
93-
48+
- run: corepack enable
9449
- name: Install dependencies
95-
run: yarn
96-
env:
97-
YARN_ENABLE_IMMUTABLE_INSTALLS: false
50+
run: corepack ${{matrix.pm}} install
9851

9952
- name: Test
100-
run: yarn test
53+
run: corepack ${{matrix.pm}} test

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
node_modules
1+
node_modules
2+
.yarn
3+
.pnp.*
4+
yarn.lock
5+
package-lock.json

.npmrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
auto-install-peers=false
2+
link-workspace-packages=true
3+
dedupe-injected-deps=false # needed for file: references to work

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,9 @@
4242
"devDependencies": {
4343
"uvu": "^0.5.6",
4444
"vite": "^3.2.3"
45-
}
45+
},
46+
"workspaces": [
47+
"tests/deps/*",
48+
"tests/projects/*"
49+
]
4650
}

0 commit comments

Comments
 (0)