Enable using multiple agents for building

This commit is contained in:
zontreck 2024-07-21 18:35:14 -07:00
parent 7393c76dd0
commit ea444adfc4

51
Jenkinsfile vendored
View file

@ -1,7 +1,6 @@
pipeline { pipeline {
agent { agent any
label 'linux'
}
options { options {
buildDiscarder( buildDiscarder(
logRotator( logRotator(
@ -11,7 +10,10 @@ pipeline {
} }
stages { stages {
stage ("Build") { stage ("Build on Linux") {
agent {
label 'linux'
}
steps { steps {
script { script {
@ -21,15 +23,6 @@ pipeline {
flutter pub get flutter pub get
chmod +x compile.sh chmod +x compile.sh
./compile.sh ./compile.sh
'''
}
}
}
stage ('Package') {
steps {
script {
sh '''
#!/bin/bash
cd build/linux/x64/release/bundle cd build/linux/x64/release/bundle
tar -cvf ../../../../../linux.tgz ./ tar -cvf ../../../../../linux.tgz ./
@ -37,17 +30,41 @@ pipeline {
cp app-release.apk ../../../../ cp app-release.apk ../../../../
''' '''
} }
} }
}
}
post { post {
always { always {
archiveArtifacts artifacts: '*.tgz', fingerprint: true archiveArtifacts artifacts: '*.tgz', fingerprint: true
archiveArtifacts artifacts: '*.apk', fingerprint: true archiveArtifacts artifacts: '*.apk', fingerprint: true
archiveArtifacts artifacts: 'out/*nb*', fingerprint: true archiveArtifacts artifacts: 'out/*nb*', fingerprint: true
deleteDir() deleteDir()
} }
} }
} }
stage ('Build on Windows') {
agent {
label 'windows'
}
steps {
script {
bat '''
@echo off
flutter build windows
dart compile exe -o out/snbt2nbt.exe bin/snbt2nbt.dart
dart compile exe -o out/nbt2snbt.exe bin/nbt2snbt.dart
cd build/windows/x64/release/bundle
tar -cvf ../../../../bundle/windows.tgz .
'''
}
}
post {
always {
archiveArtifacts artifacts: 'out/*.exe', fingerprint: true
archiveArtifacts artifacts: '*.tgz', fingerprint: true
}
}
}
}
}