101 lines
2.7 KiB
Groovy
101 lines
2.7 KiB
Groovy
pipeline {
|
||
agent any
|
||
|
||
environment {
|
||
BUILD_ENV = "pcb_rev_1-4_serial"
|
||
PIO_HOME_DIR = "${WORKSPACE}/.pio"
|
||
VENV_PATH = "${WORKSPACE}/Software/.venv"
|
||
}
|
||
|
||
parameters {
|
||
choice(
|
||
name: 'BUILD_ENV',
|
||
choices: ['pcb_rev_1-2_serial', 'pcb_rev_1-3_serial', 'pcb_rev_1-4_serial'],
|
||
description: 'Firmware-Umgebung auswählen'
|
||
)
|
||
}
|
||
|
||
stages {
|
||
|
||
stage('🧰 Setup PlatformIO') {
|
||
steps {
|
||
dir('Software') {
|
||
sh """
|
||
[ -d .venv ] || python3 -m venv .venv
|
||
${env.VENV_PATH}/bin/pip install --upgrade pip platformio
|
||
"""
|
||
}
|
||
}
|
||
}
|
||
|
||
stage('📄 Dummy WiFi-Creds') {
|
||
steps {
|
||
dir('Software') {
|
||
writeFile file: 'wifi_credentials.ini', text: '''
|
||
[wifi_cred]
|
||
wifi_ssid_client = DummySSID
|
||
wifi_password_client = DummyPass
|
||
admin_password = Admin123
|
||
wifi_ap_password = DummyAP
|
||
'''.stripIndent()
|
||
}
|
||
}
|
||
}
|
||
|
||
stage('🧪 Build Firmware') {
|
||
steps {
|
||
dir('Software') {
|
||
sh """
|
||
${env.VENV_PATH}/bin/platformio run -e ${params.BUILD_ENV}
|
||
"""
|
||
}
|
||
}
|
||
}
|
||
|
||
stage('📦 Find & Archive Firmware') {
|
||
steps {
|
||
script {
|
||
def buildPath = "Software/.pio/build/${params.BUILD_ENV}"
|
||
def files = findFiles(glob: "${buildPath}/*.bin")
|
||
if (files.length == 1) {
|
||
archiveArtifacts artifacts: files[0].path, fingerprint: true
|
||
} else {
|
||
error "❌ Konnte keine eindeutige Firmware-Datei finden!"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
stage('🔌 Flash Hardware (Dummy)') {
|
||
steps {
|
||
echo "TODO: Flash-Script aufrufen, z. B.: python3 Hardware/flash.py /dev/ttyUSB0"
|
||
}
|
||
}
|
||
|
||
stage('🧠 Run Tests (Dummy)') {
|
||
steps {
|
||
dir('Testing') {
|
||
echo "TODO: Testing mit z. B.: python3 test_runner.py oder pytest starten"
|
||
}
|
||
}
|
||
}
|
||
|
||
stage('🧹 Cleanup Build Output') {
|
||
steps {
|
||
dir('Software') {
|
||
sh "rm -rf .pio"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
post {
|
||
success {
|
||
echo "✅ CI abgeschlossen – Firmware gebaut, Dummy-Stages bereit"
|
||
}
|
||
failure {
|
||
echo "❌ Fehler im Build – Logs checken, Commander Seraphon"
|
||
}
|
||
}
|
||
}
|