Skip to content
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
56 changes: 31 additions & 25 deletions .github/workflows/ci-cd.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'CI/CD'
name: 'CI'

on:
push:
Expand All @@ -24,21 +24,25 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: 'Enable corepack'
run: corepack enable
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0

# setup-vp replaces corepack + setup-node + dependency cache: it installs
# vp (version resolved from the vite-plus range via yarn.lock), sets up
# Node and the pinned yarn, and caches the yarn store.
- name: 'Setup Vite+'
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1.15.0
with:
node-version: 24
cache: 'yarn'
node-version: '24'
cache: true
run-install: false

- name: 'Install dependencies'
run: yarn install --immutable
run: vp install --frozen-lockfile

- name: 'Format check'
run: yarn fmt:check
run: vp fmt --check

- name: 'Lint'
run: yarn lint
run: vp lint

build:
name: 'Build'
Expand All @@ -48,48 +52,50 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: 'Enable corepack'
run: corepack enable
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0

- name: 'Setup Vite+'
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1.15.0
with:
node-version: 24
cache: 'yarn'
node-version: '24'
cache: true
run-install: false

- name: 'Install dependencies'
run: yarn install --immutable
run: vp install --frozen-lockfile

- name: 'Build'
run: yarn build
run: vp run build

test:
name: 'Test (Node ${{ matrix.node-version }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ['lts/*']
node-version: ['lts']
steps:
- name: 'Checkout'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: 'Enable corepack'
run: corepack enable
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0

- name: 'Setup Vite+'
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1.15.0
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache: true
run-install: false

- name: 'Install dependencies'
run: yarn install --immutable
run: vp install --frozen-lockfile

- name: 'Test'
run:
yarn test:coverage --reporter='github-actions' --reporter='junit'
vp test --run --coverage --reporter='github-actions' --reporter='junit'
--outputFile='./coverage/test-report.junit.xml' --reporter=default

- name: 'Upload coverage to Codecov'
if: ${{ matrix.node-version == 'lts/*' }}
if: ${{ matrix.node-version == 'lts' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -98,7 +104,7 @@ jobs:
fail_ci_if_error: true

- name: 'Upload test results to Codecov'
if: ${{ !cancelled() && matrix.node-version == 'lts/*' }}
if: ${{ !cancelled() && matrix.node-version == 'lts' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Release'

on:
workflow_run:
workflows: ['CI/CD']
workflows: ['CI']
types: [completed]
branches: [master]
workflow_dispatch:
Expand Down Expand Up @@ -33,24 +33,24 @@ jobs:
ref: 'master'
# the job token is read-only; git push must use the GH_TOKEN PAT from env
persist-credentials: false
- name: 'Enable corepack'
run: corepack enable
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- name: 'Setup Vite+'
uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1.15.0
with:
node-version: 24
cache: 'yarn'
node-version: '24'
cache: true
run-install: false

- name: 'Install dependencies'
run: yarn install --immutable
run: vp install --frozen-lockfile

- name: 'Build'
run: yarn build
run: vp run build

- name: 'Release'
env:
# PAT instead of GITHUB_TOKEN so the published release triggers the Discord workflow
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: yarn semantic-release
run: vp exec semantic-release

gen-contributors:
name: 'Generate Contributors List'
Expand Down
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ vite.config.ts # test, lint and format config, all three
- Vitest 4, two projects split by filename: `*.dom.test.ts` runs in jsdom, `*.ssr.test.ts` in node.
- yarn 4 via corepack, for dependency work only (`yarn up <pkg>`, `yarn install --immutable`).
- semantic-release publishes from `master`; GitHub Actions are SHA-pinned via `pinact`.
- CI goes through `vp` only: `voidzero-dev/setup-vp` provides Node, yarn, the dependency cache and the install, so no
`corepack enable`, no `actions/setup-node` and no direct `yarn` call belongs in a workflow.

## Conventions

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![NPM Downloads](https://img.shields.io/npm/dm/%40react-hookz%2Fweb?style=flat-square)](https://www.npmjs.com/package/@react-hookz/web)
[![Dependents](https://img.shields.io/librariesio/dependents/npm/%40react-hookz%2Fweb?style=flat-square)](https://www.npmjs.com/package/@react-hookz/web)
[![Build](https://img.shields.io/github/actions/workflow/status/react-hookz/web/ci-cd.yml?branch=master&style=flat-square)](https://github.com/react-hookz/web/actions)
[![Build](https://img.shields.io/github/actions/workflow/status/react-hookz/web/ci.yml?branch=master&style=flat-square)](https://github.com/react-hookz/web/actions)
[![Coverage](https://img.shields.io/codecov/c/github/react-hookz/web?style=flat-square)](https://app.codecov.io/gh/react-hookz/web)

× **[DISCORD](https://discord.gg/Fjwphtu65f)** × **[RELEASES](https://github.com/react-hookz/web/releases)** ×
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"access": "public"
},
"scripts": {
"build": "yarn build:clean && tsc --version && tsc --project ./tsconfig.build.json",
"build:clean": "yarn rimraf ./dist",
"build": "vp run build:clean && tsc --version && tsc --project ./tsconfig.build.json",
"build:clean": "rimraf ./dist",
"fmt": "vp fmt --write",
"fmt:check": "vp fmt --check",
"lint": "vp lint",
Expand Down