ci integration
This commit is contained in:
parent
ed85d07148
commit
8ca7c5407d
|
@ -0,0 +1,19 @@
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
sh 'export PLATFORMIO_PATH=/root/.platformio/penv/bin/platformio'
|
||||||
|
sh 'python gen_release.py'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Publish') {
|
||||||
|
steps {
|
||||||
|
sh 'mkdir -p artifacts'
|
||||||
|
sh 'cp -r release/ artifacts/'
|
||||||
|
archiveArtifacts artifacts: 'artifacts/**/*', fingerprint: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,8 +22,16 @@ firmware_folder = os.path.join(current_dir, 'firmware')
|
||||||
# Define the path to the release folder
|
# Define the path to the release folder
|
||||||
release_folder = os.path.join(current_dir, 'release')
|
release_folder = os.path.join(current_dir, 'release')
|
||||||
|
|
||||||
# Add the path to the PlatformIO executable to the system PATH
|
# Get the platformio path from environment variable
|
||||||
platformio_path = os.path.expanduser('~/.platformio/penv/Scripts')
|
platformio_path = os.environ.get('PLATFORMIO_PATH')
|
||||||
|
# If the environment variable is not set, use the default path
|
||||||
|
if platformio_path is None:
|
||||||
|
if platform.system() == 'Darwin':
|
||||||
|
platformio_path = os.path.expanduser('~/.platformio/penv/bin/platformio')
|
||||||
|
elif platform.system() == 'Windows':
|
||||||
|
platformio_path = os.path.expanduser('~/.platformio/penv/Scripts/platformio.exe')
|
||||||
|
elif platform.system() == 'Linux':
|
||||||
|
platformio_path = os.path.expanduser('~/.platformio/penv/bin/platformio')
|
||||||
|
|
||||||
if os.path.exists(release_folder):
|
if os.path.exists(release_folder):
|
||||||
# If the release folder exists, delete it
|
# If the release folder exists, delete it
|
||||||
|
@ -79,11 +87,11 @@ for environment in environments:
|
||||||
|
|
||||||
# if argument is not supplied, build all environments listed in platformio.ini
|
# if argument is not supplied, build all environments listed in platformio.ini
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
subprocess.run([f'{platformio_path}/platformio.exe', 'run','-c',f'{firmware_folder}/platformio.ini'], cwd=current_dir)
|
subprocess.run([f'{platformio_path}', 'run','-c',f'{firmware_folder}/platformio.ini'], cwd=current_dir)
|
||||||
|
|
||||||
for environment in environments:
|
for environment in environments:
|
||||||
if(len(sys.argv) > 1):
|
if(len(sys.argv) > 1):
|
||||||
subprocess.run([f'{platformio_path}/platformio.exe', 'run', '-e', environment,'-c',f'{firmware_folder}/platformio.ini'], cwd=current_dir)
|
subprocess.run([f'{platformio_path}', 'run', '-e', environment,'-c',f'{firmware_folder}/platformio.ini'], cwd=current_dir)
|
||||||
|
|
||||||
# Iterate over the subfolders in the firmware folder
|
# Iterate over the subfolders in the firmware folder
|
||||||
for subfolder in os.listdir(firmware_folder):
|
for subfolder in os.listdir(firmware_folder):
|
||||||
|
|
Loading…
Reference in New Issue