Files
q-blog/.gitea/workflows/ci.yml
greenflame089 402ec26cf8
Some checks failed
CI (node + vitest + lint) / build_test (push) Has been cancelled
ci: manual checkout + ensure single workflow
2025-08-17 00:45:50 -04:00

66 lines
2.1 KiB
YAML

name: CI (node + vitest + lint)
on:
push:
branches: ["main", "master", "update", "*"]
pull_request:
jobs:
build_test:
runs-on: ubuntu-latest:host
steps:
- name: Main · Print env
run: |
echo "Actor: $GITHUB_ACTOR"
echo "Ref: $GITHUB_REF"
echo "SHA: $GITHUB_SHA"
echo "Runner labels: $RUNNER_LABELS"
echo "Workspace: ${GITHUB_WORKSPACE:-$PWD}"
node -v || true
npm -v || true
# Native Gitea runner doesn't auto-checkout; and marketplace may be disabled.
# Perform a manual checkout of THIS repo at the triggering ref.
- name: Main · Manual checkout (no marketplace)
run: |
set -euxo pipefail
ls -la || true
if [ ! -f package.json ]; then
BASE="${GITHUB_SERVER_URL:-https://gitea.qortal.link}"
REPO="${GITHUB_REPOSITORY}"
REF="${GITHUB_SHA:-}"
echo "Cloning $BASE/$REPO @ ${REF:-$GITHUB_REF}"
git init .
git remote add origin "$BASE/$REPO.git"
if [ -n "$REF" ]; then
git fetch --depth=1 origin "$REF"
git checkout -qf FETCH_HEAD
else
# fall back to branch name from ref
BRANCH="$(echo "${GITHUB_REF:-refs/heads/update}" | sed 's#^refs/heads/##; s#^refs/tags/##')"
git fetch --depth=1 origin "$BRANCH"
git checkout -qf "FETCH_HEAD"
fi
fi
test -f package.json && echo "package.json present" || (echo "::error::package.json still missing"; exit 1)
git status --porcelain -b || true
- name: Main · Install deps (prefer CI clean)
run: |
if [ -f package-lock.json ]; then
npm ci || npm ci --prefer-offline || npm install
else
npm install
fi
- name: Main · Local gate (tests + phase0 lint scope)
run: |
npm run check
- name: Artifacts · reports (optional)
if: always()
run: |
mkdir -p artifacts
if ls reports/* >/dev/null 2>&1; then tar -czf artifacts/reports.tar.gz reports; fi