Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor ci to use corepack and package manager via matrix #11

Merged
merged 4 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 23 additions & 70 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
name: CI

env:
# configure corepack
COREPACK_DEFAULT_TO_LATEST: 0
COREPACK_ENABLE_AUTO_PIN: 0
# configure yarn
YARN_ENABLE_IMMUTABLE_INSTALLS: 'false'

on:
push:
branches:
Expand All @@ -15,86 +22,32 @@ on:
jobs:
test:
name: Test
timeout-minutes: 10
timeout-minutes: 5
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node: [16]
node: [20]
os: [ubuntu-latest, macos-latest, windows-latest]
pm: ["pnpm@9"]
include:
- node: 18
- node: 22
os: ubuntu-latest
pm: "pnpm@9"
- node: 22
os: ubuntu-latest
pm: "yarn@4"
- node: 22
os: ubuntu-latest
pm: "npm@10"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/[email protected]
with:
version: '7.14.1'

- name: Setup node
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: pnpm
cache-dependency-path: '**/pnpm-lock.yaml'

- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline

- name: Test
run: pnpm test

test-npm:
name: Test npm
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup workspaces
run: cat package.json | jq '.workspaces = ["tests/deps/*","tests/projects/*"]' | tee package.json

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install dependencies
run: npm install

- name: Test
run: npm test

test-yarn:
name: Test yarn PnP
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup workspaces
run: cat package.json | jq '.workspaces = ["tests/deps/*","tests/projects/*"]' | tee package.json

- name: Use yarn 3
run: cat package.json | jq '.packageManager = "[email protected]"' | tee package.json

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Enable corepack
run: corepack enable

- run: corepack enable
- name: Install dependencies
run: yarn
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
run: corepack ${{matrix.pm}} install

- name: Test
run: yarn test
run: corepack ${{matrix.pm}} test
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
node_modules
node_modules
.yarn
.pnp.*
yarn.lock
package-lock.json
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
auto-install-peers=false
link-workspace-packages=true
dedupe-injected-deps=false # needed for file: references to work
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,9 @@
"devDependencies": {
"uvu": "^0.5.6",
"vite": "^3.2.3"
}
},
"workspaces": [
"tests/deps/*",
"tests/projects/*"
]
}
Loading