From 140a0c78f01e1518b9068a57e5628141482f9932 Mon Sep 17 00:00:00 2001 From: xobotyi Date: Sun, 26 Jul 2026 14:21:43 +0200 Subject: [PATCH] ci: run the pipeline through vp setup-vp replaces corepack, actions/setup-node and the manual yarn cache in every job: it installs vp -- version resolved from the vite-plus range through yarn.lock -- plus Node and the pinned yarn. Installs go through vp install --frozen-lockfile; fmt, lint, build, test and semantic-release through vp too. Test matrix moves from 'lts/*' to 'lts': node-version feeds vp env use, which takes lts, latest or a plain major, not the nvm spec. build and build:clean called yarn internally, so vp run build shelled back into yarn; build:clean calls rimraf directly instead. Workflow renamed to CI since releases moved to release.yml. The workflow_run trigger matches on workflow name rather than filename, so it moves with the rename; the README badge follows the file name. --- .github/workflows/{ci-cd.yml => ci.yml} | 56 ++++++++++++++----------- .github/workflows/release.yml | 18 ++++---- CLAUDE.md | 2 + README.md | 2 +- package.json | 4 +- 5 files changed, 45 insertions(+), 37 deletions(-) rename .github/workflows/{ci-cd.yml => ci.yml} (67%) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci.yml similarity index 67% rename from .github/workflows/ci-cd.yml rename to .github/workflows/ci.yml index 28f0aa04..6432a122 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: 'CI/CD' +name: 'CI' on: push: @@ -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' @@ -48,18 +52,19 @@ 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 }})' @@ -67,29 +72,30 @@ jobs: 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 }} @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 50cef7f6..822cd7b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: 'Release' on: workflow_run: - workflows: ['CI/CD'] + workflows: ['CI'] types: [completed] branches: [master] workflow_dispatch: @@ -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' diff --git a/CLAUDE.md b/CLAUDE.md index 3b1948a1..e6e6aa28 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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 `, `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 diff --git a/README.md b/README.md index 4b23a9ac..ef8acf04 100644 --- a/README.md +++ b/README.md @@ -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)** × diff --git a/package.json b/package.json index 79788007..85f631dd 100644 --- a/package.json +++ b/package.json @@ -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",