42 lines
1.1 KiB
YAML
42 lines
1.1 KiB
YAML
# Pi Package CI — shared GitLab CI template
|
|
# Use with: include https://warehouse:8888/artale/pi-ci-template/raw/main/.gitlab-ci.yml
|
|
# Or copy directly into each repo.
|
|
|
|
image: node:22-alpine
|
|
|
|
stages:
|
|
- validate
|
|
- test
|
|
|
|
cache:
|
|
paths:
|
|
- node_modules/
|
|
|
|
before_script:
|
|
- node --version
|
|
- npm --version
|
|
|
|
validate:
|
|
stage: validate
|
|
script:
|
|
- echo "Package: $(node -p "require('./package.json').name") v$(node -p "require('./package.json').version")"
|
|
- |
|
|
if [ -f tsconfig.json ]; then
|
|
npm ci --ignore-scripts 2>/dev/null || npm install --ignore-scripts
|
|
npx tsc --noEmit && echo "TypeScript: PASS" || { echo "TypeScript: FAIL"; exit 1; }
|
|
else
|
|
echo "No tsconfig — skipping compile"
|
|
fi
|
|
|
|
test:
|
|
stage: test
|
|
script:
|
|
- |
|
|
if [ -f scripts/test.sh ]; then
|
|
bash scripts/test.sh && echo "Tests: PASS" || { echo "Tests: FAIL"; exit 1; }
|
|
elif [ -f test.sh ]; then
|
|
bash test.sh && echo "Tests: PASS" || { echo "Tests: FAIL"; exit 1; }
|
|
else
|
|
echo "No tests — skipping"
|
|
fi
|