add CI template

This commit is contained in:
artale 2026-05-17 01:17:25 +02:00
commit 1659b5c7a4
1 changed files with 41 additions and 0 deletions

41
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,41 @@
# 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