From c399672755d033ba04d63df845dc21dfc62784d5 Mon Sep 17 00:00:00 2001 From: Marcel Peterkau Date: Mon, 2 Jun 2025 09:02:28 +0200 Subject: [PATCH] prepare for CI Build --- Software/Jenkinsfile | 84 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 Software/Jenkinsfile diff --git a/Software/Jenkinsfile b/Software/Jenkinsfile new file mode 100644 index 0000000..1aa8264 --- /dev/null +++ b/Software/Jenkinsfile @@ -0,0 +1,84 @@ +pipeline { + agent any + + options { + timestamps() + ansiColor('xterm') + } + + environment { + // Default-Env, kann später via Parameter überschrieben werden + BUILD_ENV = "pcb_rev_1-4_serial" + PIO_HOME_DIR = "${WORKSPACE}/.pio" + } + + parameters { + choice( + name: 'BUILD_ENV', + choices: ['pcb_rev_1-2_serial', 'pcb_rev_1-3_serial', 'pcb_rev_1-4_serial'], + description: 'Welches Environment soll gebaut werden?' + ) + } + + stages { + stage('🧼 Cleanup') { + steps { + deleteDir() + } + } + + stage('Checkout') { + steps { + sshagent(['gitea-ssh']) { + sh 'git clone git@git.hiabuto.net:souko/Kettenoeler.git .' + } + } + } + + stage('🧪 Python & PlatformIO Setup') { + steps { + sh ''' + python3 -m venv .venv + . .venv/bin/activate + pip install --upgrade pip platformio + ''' + } + } + + stage('📄 Dummy-Credential-Datei erstellen') { + steps { + writeFile file: 'wifi_credentials.ini', text: ''' +[wifi_cred] +wifi_ssid_client = DummySSID +wifi_password_client = DummyPass +admin_password = Admin1234 +wifi_ap_password = ApPass1234 + '''.stripIndent() + } + } + + stage('⚙️ Build Environment: ${params.BUILD_ENV}') { + steps { + sh ''' + . .venv/bin/activate + platformio run -e ${BUILD_ENV} + ''' + } + } + + stage('📦 Firmware sichern') { + steps { + archiveArtifacts artifacts: ".pio/build/${params.BUILD_ENV}/firmware.bin", fingerprint: true + } + } + } + + post { + success { + echo "✅ Build erfolgreich abgeschlossen – Firmware liegt bereit als Artefakt." + } + failure { + echo "💣 Build fehlgeschlagen – bitte Logs prüfen!" + } + } +}