chore: Jenkinsfile

This commit is contained in:
ISA
2025-09-05 12:14:38 +02:00
parent 1485c0c92c
commit c03802e97f
6 changed files with 54 additions and 11 deletions

50
Jenkinsfile vendored
View File

@@ -6,13 +6,51 @@ pipeline {
stage('Versions') {
steps { sh 'node -v && npm -v' }
}
stage('Install deps') {
steps { sh 'npm ci' }
}
stage('Playwright tests') {
stage('Verify mocks') {
steps {
sh 'npx playwright install' // Browser-Binärdateien laden
sh 'npx playwright test'
sh '''
set -euxo pipefail
npm ci
echo "=== git ls-files ==="
git ls-files | grep -i "^mocks/device-cgi-simulator/SERVICE/systemMockData.js" || true
echo "=== ls -la ==="
ls -la mocks/device-cgi-simulator/SERVICE || true
echo "=== file exists? ==="
test -f mocks/device-cgi-simulator/SERVICE/systemMockData.js && echo "FOUND" || (echo "MISSING" && exit 1)
'''
}
}
stage('Build & E2E (chromium)') {
environment {
CI = 'true'
NODE_ENV = 'production'
NEXT_TELEMETRY_DISABLED = '1'
PORT = '3000'
}
steps {
sh '''
set -euxo pipefail
# Install devDependencies as well (rimraf, cross-env, etc.)
env npm_config_production=false npm ci
# Build Next.js
npm run build
# Start local static simulator in background
npm run server:sim &
# Ensure Playwright browsers and OS deps are installed (best-effort)
npx playwright install-deps || true
npx playwright install
# Wait until simulator responds on port 3000 (no curl dependency)
node -e "const http=require('http');let n=120;function ping(){http.get('http://localhost:3000',res=>{console.log('Server is up');process.exit(0)}).on('error',()=>{if(n--<=0){console.error('Server did not start');process.exit(1)}setTimeout(ping,1000)});}ping();"
# Run tests (chromium only to match Woodpecker)
npx playwright test --project=chromium
'''
}
}
}