Vendor CI reusable workflows locally after infra/ci-workflows failed to resolve.
CI / changes (push) Successful in 33s
dotnet8-ci / build-and-test (push) Successful in 31m34s
CI / backend (push) Successful in 31m44s
node-ci / build (push) Successful in 10m31s
CI / frontend (push) Successful in 10m39s

Remote uses: @v1 never scheduled jobs; keep thin callers against local workflow_call copies until collaborative owners include Trent.
This commit is contained in:
2026-10-06 19:56:18 +08:00
parent 5a175e3fba
commit 192cb36dc7
4 changed files with 304 additions and 14 deletions
+111
View File
@@ -0,0 +1,111 @@
# Reusable Node CI pipeline (vendored from docs/CICD / infra/ci-workflows).
# Prefer uses: infra/ci-workflows/.gitea/workflows/node-ci.yml@v1 once this
# repo's owner is listed under that repo's Actions collaborative owners.
#
# Phase order (do not reorder in callers):
# 1. lint_command — lint + typecheck (no dist)
# 2. extra_check_command — audit, unit tests, source checks (no dist)
# 3. build_command — production build only (produces dist)
# 4. post_build_command — bundle budget, e2e, anything that needs dist
name: node-ci
on:
workflow_call:
inputs:
runs_on:
type: string
default: ubuntu-latest
working_directory:
description: "Directory holding package.json, relative to the repo root."
type: string
required: true
node_version:
type: string
default: "22"
package_manager:
description: "npm | pnpm"
type: string
default: npm
lock_file:
type: string
default: package-lock.json
lint_command:
type: string
default: "npm run lint"
extra_check_command:
description: "Optional checks between lint and build. Must NOT require dist/."
type: string
default: ""
build_command:
description: "Build only. Typechecking belongs in lint_command, not here."
type: string
default: "npx vite build"
build_env:
description: "Optional KEY=VALUE lines exported for Build and Post-build."
type: string
default: ""
post_build_command:
description: "Optional checks after build that may use dist/ (bundle budget, e2e)."
type: string
default: ""
artifact_path:
description: "Optional build output to upload. Empty uploads nothing."
type: string
default: ""
jobs:
build:
runs-on: ${{ inputs.runs_on }}
defaults:
run:
working-directory: ${{ inputs.working_directory }}
steps:
- uses: builtin:checkout
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}
cache: ${{ inputs.package_manager }}
cache-dependency-path: ${{ inputs.working_directory }}/${{ inputs.lock_file }}
- name: Install
run: |
if [ "${{ inputs.package_manager }}" = "pnpm" ]; then
corepack enable && pnpm install --frozen-lockfile
else
npm ci
fi
- name: Lint (and typecheck)
run: ${{ inputs.lint_command }}
- name: Extra check
if: inputs.extra_check_command != ''
run: ${{ inputs.extra_check_command }}
- name: Build
run: |
set -euo pipefail
while IFS= read -r line; do
[ -n "$line" ] || continue
export "${line?}"
done <<< "${{ inputs.build_env }}"
${{ inputs.build_command }}
- name: Post-build check
if: inputs.post_build_command != ''
run: |
set -euo pipefail
while IFS= read -r line; do
[ -n "$line" ] || continue
export "${line?}"
done <<< "${{ inputs.build_env }}"
${{ inputs.post_build_command }}
- name: Upload build output
if: inputs.artifact_path != ''
uses: actions/upload-artifact@v4
with:
name: build-output
path: ${{ inputs.working_directory }}/${{ inputs.artifact_path }}