rusefi/.github/workflows/build-firmware.yaml

342 lines
12 KiB
YAML
Raw Normal View History

2022-01-26 13:27:17 -08:00
name: Firmware at GHA
2024-03-12 06:56:18 -07:00
#
# this github action uses generate_matrix.sh to scan the file system and automatically produce build matrix!
#
on:
push:
pull_request:
2023-02-22 16:51:46 -08:00
schedule:
# this produces GitHub nightly releases https://github.com/rusefi/rusefi/releases
# by the way GitHub actions use UTC https://www.utctime.net/ which matches GMT time
- cron: '10 23 * * *'
workflow_dispatch:
inputs:
lts:
description: 'LTS Build'
required: false
type: boolean
jobs:
2023-11-03 22:12:35 -07:00
build-libopenblt-linux:
2023-10-25 00:14:23 -07:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
2023-12-24 19:01:01 -08:00
- name: cmake configure libopenblt
working-directory: ./firmware/ext/openblt/Host/Source/LibOpenBLT/build
run: cmake -DCMAKE_BUILD_TYPE=Release ..
2023-10-25 00:14:23 -07:00
2023-12-24 19:01:01 -08:00
# - name: make libopenblt
# working-directory: ./firmware/ext/openblt/Host/Source/LibOpenBLT/build
# run: make -j8
2023-10-25 00:14:23 -07:00
2023-12-24 19:01:01 -08:00
- name: cmake configure libopenblt_jni
working-directory: ./misc/libopenblt_jni/build
run: cmake -DCMAKE_BUILD_TYPE=Release ..
2023-11-03 22:12:35 -07:00
# - name: make libopenblt_jni
# working-directory: ./misc/libopenblt_jni/build
# run: make -j8
2023-12-24 19:01:01 -08:00
- name: coalesce
if: 0
run: |
mkdir deliver
cp ./firmware/ext/openblt/Host/libopenblt.so deliver/
cp ./misc/libopenblt_jni/build/libopenblt_jni.so deliver/
2023-10-25 00:14:23 -07:00
# - uses: actions/upload-artifact@v4
2023-12-24 19:01:01 -08:00
# if: 0
# name: libopenblt-linux
# path: |
# ./deliver/libopenblt.so
# ./deliver/libopenblt_jni.so
2023-10-25 00:14:23 -07:00
release:
runs-on: ubuntu-latest
steps:
2023-07-26 12:34:26 -07:00
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Set run condition variables
run: |
if [ "${{github.event_name}}" = "schedule" ] && [ "${{github.repository}}" = "rusefi/rusefi" ]; then
echo "full=true" >> $GITHUB_ENV
echo "upload=release" >> $GITHUB_ENV
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
fi
- uses: mukunku/tag-exists-action@v1.6.0
id: checkTag
with:
tag: ${{ env.date }}
- name: Create Release Tag
if: ${{ env.full == 'true' && env.upload == 'release' && steps.checkTag.outputs.exists == 'false' }}
id: tag
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ env.date }}
tag_prefix: ''
- name: Create Release
if: ${{ env.full == 'true' && env.upload == 'release' }}
uses: ncipollo/release-action@v1.14.0
with:
tag: ${{ env.date }}
name: "Nightly ${{ env.date }}"
artifacts: "artifacts/rusefi_bundle_*.zip"
replacesArtifacts: false
token: ${{ secrets.NIGHTLY_RELEASE_ACCESS_TOKEN }}
allowUpdates: true
prerelease: true
2023-11-03 23:16:02 -07:00
- name: coalesce
2023-12-24 19:01:01 -08:00
if: 0
2023-11-03 23:16:02 -07:00
run: |
mkdir deliver
cp ./firmware/ext/openblt/Host/libopenblt.dylib deliver/
cp ./misc/libopenblt_jni/build/libopenblt_jni.dylib deliver/
- uses: actions/upload-artifact@v4
2023-10-25 00:23:59 -07:00
with:
2023-10-25 00:34:22 -07:00
name: bootcommander-linux
2023-10-25 00:23:59 -07:00
path: |
2023-11-03 23:18:04 -07:00
./deliver/libopenblt.dylib
./deliver/libopenblt_jni.dylib
2023-10-25 00:23:59 -07:00
2024-02-11 12:31:44 -08:00
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Set matrix
id: set-matrix
run: |
export EVENT_NAME="${{github.event_name}}"
export RUN_ATTEMPT="${{github.run_attempt}}"
2024-03-24 20:07:39 -07:00
read -d '' COMMIT_MESSAGE << EOM || true
${{ github.event.head_commit.message }}
EOM
export COMMIT_MESSAGE
2024-02-11 12:31:44 -08:00
echo "matrix=$(bash firmware/bin/generate_matrix.sh)" >> $GITHUB_OUTPUT
Use github actions to build and upload bundles (#1583) * add env var to skip upload * remove checking from compile.bat * working on push.yaml * finish sorting * progress * rename push to builds * rename push to builds * Add skip upload env var * fix pull_request name * fixed typo and changed name * fixed indentation and runs-on * try different env var setup * add nucleos and switch to underscore * add quotes * remove boards that were commented * remove boards that were commented * fix project board name * fixed variable name * add ini-file and console-settings * try installing gcc-multilib first * Install g++-multilib as well * remove unnecessary export * fixed exit numbers * change to different env setup * add simulator and console compilation to board bundles * changed OS and added linux simulator build * add checkout and missing colon * add gcc-multilib installes * Install mingw * fixed install * remove mingw from linux sim and call compile directly * change directory * moved envs to command * debug ls * debug ls * set ftp vars * add makefile debug info * removed batchecks * redirect stdout to easier see orrs * change name * remove redirect, add file inpection * Add conditional project name * Try software upgrade * missing char * update ine files * try quotes * add escapes * add quotes * add escapes and quotes * remove quotes and escapes * remove software upgrade * ignore test 2 * update apt * like this then * forgot import * fix case * remove RUSEFI_SKIP_UPLOAD and check RUSEFI_FTP_SERVER instead * break workflow back apart * upload simulator artifact * fixed operator * update apt * change paths * Update build-firmware.yaml * move update bundle to artifacts * fix var name * Install ncftp * set env vars conditionally * remove check so zips are created * try things the github way and copy to primary * re-enable test * missing space
2020-07-08 08:10:24 -07:00
build-firmware:
runs-on: ubuntu-latest
needs: [
# todo proper build of build-libopenblt #5866
2023-11-03 22:12:35 -07:00
#build-libopenblt-linux,
#build-libopenblt-macos,
2024-02-11 12:31:44 -08:00
release,
generate-matrix]
2024-03-09 13:56:52 -08:00
if: ${{ ! contains(needs.generate-matrix.outputs.matrix, '[]') }}
strategy:
# Let all builds finish even if one fails early
fail-fast: false
2024-02-11 12:31:44 -08:00
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
steps:
- name: Check branch name
if: ${{ contains(github.ref_name, '.') }}
run: echo '::error::Branch names must not contain ".", this breaks firmware autoupdates.' && exit 1
- name: Set run condition variables
run: |
if [ "${{github.event_name}}" = "schedule" ] && [ "${{github.repository}}" = "rusefi/rusefi" ]; then
2023-07-26 12:34:26 -07:00
echo "Scheduled mode"
echo "full=true" >> $GITHUB_ENV
echo "upload=release" >> $GITHUB_ENV
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
elif [ "${{github.event_name}}" = "push" ]\
&& [ "${{github.ref}}" = "refs/heads/master" ]\
|| [ "${{toJSON(inputs.lts)}}" = "true" ]; then
2023-07-26 12:34:26 -07:00
echo "Full mode"
echo "full=true" >> $GITHUB_ENV
echo "upload=server" >> $GITHUB_ENV
2024-02-11 12:31:44 -08:00
else
2023-07-26 12:34:26 -07:00
echo "Partial mode"
echo "partial=true" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
- name: Checkout Submodules
run: |
git submodule update --init --depth=1 firmware/ChibiOS
git submodule update --init --depth=1 firmware/ChibiOS-Contrib
git submodule update --init --depth=1 firmware/libfirmware
git submodule update --init --depth=1 firmware/ext/lua
git submodule update --init --depth=1 firmware/ext/uzlib
git submodule update --init --depth=1 firmware/ext/openblt
git submodule update --init --depth=1 firmware/controllers/lua/luaaa
git submodule update --init --depth=1 firmware/controllers/can/wideband_firmware
git submodule update --init --depth=1 java_console/luaformatter
git submodule update --init --depth=1 java_console/peak-can-basic
2022-01-04 08:51:06 -08:00
- uses: actions/setup-java@v4
2021-02-17 07:07:09 -08:00
with:
distribution: 'zulu'
java-version: '11'
2021-02-17 07:07:09 -08:00
- name: Install multilib, mingw, sshpass and mtools
run: |
2023-02-25 15:07:31 -08:00
sudo bash misc/actions/add-ubuntu-latest-apt-mirrors.sh
sudo apt-get install gcc-multilib g++-multilib g++-mingw-w64 gcc-mingw-w64 sshpass mtools zip dosfstools
- name: Set Build Env Variables
working-directory: ./firmware/
run: |
echo LTS=${{toJSON(inputs.lts)}} >> $GITHUB_ENV
echo REF=${{github.ref_name}} >> $GITHUB_ENV
2024-02-11 12:31:44 -08:00
echo BOARD_META_PATH=${{matrix.meta-info}} >> $GITHUB_ENV
2023-12-31 12:25:36 -08:00
- name: Git Status
run: |
git status
2024-02-27 05:02:06 -08:00
#
# Note to humans: on personal devices we have firmware/provide_gcc.sh and setup_linux_environment.sh
#
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
2024-01-02 14:34:33 -08:00
release: '12.3.Rel1'
# Make sure the compiler we just downloaded works - just print out the version
- name: Test arm-none-eabi-gcc Compiler
run: arm-none-eabi-gcc -v
- name: Configs build_server upload SSH variables
if: ${{ env.full == 'true' && env.upload == 'server' }}
2020-11-18 15:59:02 -08:00
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
Use github actions to build and upload bundles (#1583) * add env var to skip upload * remove checking from compile.bat * working on push.yaml * finish sorting * progress * rename push to builds * rename push to builds * Add skip upload env var * fix pull_request name * fixed typo and changed name * fixed indentation and runs-on * try different env var setup * add nucleos and switch to underscore * add quotes * remove boards that were commented * remove boards that were commented * fix project board name * fixed variable name * add ini-file and console-settings * try installing gcc-multilib first * Install g++-multilib as well * remove unnecessary export * fixed exit numbers * change to different env setup * add simulator and console compilation to board bundles * changed OS and added linux simulator build * add checkout and missing colon * add gcc-multilib installes * Install mingw * fixed install * remove mingw from linux sim and call compile directly * change directory * moved envs to command * debug ls * debug ls * set ftp vars * add makefile debug info * removed batchecks * redirect stdout to easier see orrs * change name * remove redirect, add file inpection * Add conditional project name * Try software upgrade * missing char * update ine files * try quotes * add escapes * add quotes * add escapes and quotes * remove quotes and escapes * remove software upgrade * ignore test 2 * update apt * like this then * forgot import * fix case * remove RUSEFI_SKIP_UPLOAD and check RUSEFI_FTP_SERVER instead * break workflow back apart * upload simulator artifact * fixed operator * update apt * change paths * Update build-firmware.yaml * move update bundle to artifacts * fix var name * Install ncftp * set env vars conditionally * remove check so zips are created * try things the github way and copy to primary * re-enable test * missing space
2020-07-08 08:10:24 -07:00
run: |
echo "RUSEFI_SSH_SERVER=${{secrets.RUSEFI_SSH_SERVER}}" >> $GITHUB_ENV
echo "RUSEFI_SSH_USER=${{secrets.RUSEFI_SSH_USER}}" >> $GITHUB_ENV
echo "RUSEFI_SSH_PASS=${{secrets.RUSEFI_SSH_PASS}}" >> $GITHUB_ENV
Use github actions to build and upload bundles (#1583) * add env var to skip upload * remove checking from compile.bat * working on push.yaml * finish sorting * progress * rename push to builds * rename push to builds * Add skip upload env var * fix pull_request name * fixed typo and changed name * fixed indentation and runs-on * try different env var setup * add nucleos and switch to underscore * add quotes * remove boards that were commented * remove boards that were commented * fix project board name * fixed variable name * add ini-file and console-settings * try installing gcc-multilib first * Install g++-multilib as well * remove unnecessary export * fixed exit numbers * change to different env setup * add simulator and console compilation to board bundles * changed OS and added linux simulator build * add checkout and missing colon * add gcc-multilib installes * Install mingw * fixed install * remove mingw from linux sim and call compile directly * change directory * moved envs to command * debug ls * debug ls * set ftp vars * add makefile debug info * removed batchecks * redirect stdout to easier see orrs * change name * remove redirect, add file inpection * Add conditional project name * Try software upgrade * missing char * update ine files * try quotes * add escapes * add quotes * add escapes and quotes * remove quotes and escapes * remove software upgrade * ignore test 2 * update apt * like this then * forgot import * fix case * remove RUSEFI_SKIP_UPLOAD and check RUSEFI_FTP_SERVER instead * break workflow back apart * upload simulator artifact * fixed operator * update apt * change paths * Update build-firmware.yaml * move update bundle to artifacts * fix var name * Install ncftp * set env vars conditionally * remove check so zips are created * try things the github way and copy to primary * re-enable test * missing space
2020-07-08 08:10:24 -07:00
2023-11-03 22:12:35 -07:00
# - name: Download LibOpenBLT Tool (Linux)
# uses: actions/download-artifact@v3
# with:
2023-11-03 22:12:35 -07:00
# name: libopenblt-linux
# path: ./firmware/ext/openblt/Host/
2023-10-25 00:29:01 -07:00
2023-11-03 22:12:35 -07:00
# - name: Download LibOpenBLT Tool (MacOS)
# uses: actions/download-artifact@v3
# with:
# name: libopenblt-macos
# path: ./firmware/ext/openblt/Host/
2023-10-25 00:29:01 -07:00
- name: Clean (Just in Case)
2024-01-30 05:08:01 -08:00
working-directory: ./firmware/
run: |
2024-01-30 05:08:01 -08:00
make clean
- name: Handle configs separately just to make github logs more readable
working-directory: ./firmware/
run: |
bash bin/compile.sh ${{env.BOARD_META_PATH}} config
- name: Building simulator separately just to make github logs more readable
working-directory: ./firmware/
run: |
bash bin/compile.sh ${{env.BOARD_META_PATH}} ../simulator/build/rusefi_simulator.exe
# Build the firmware! We have the technology to build _everything_ in one 'make' invocation but choose to do separately for sake of more readable GHA logs
- name: Build Firmware
working-directory: ./firmware/
run: |
if [ "$full" == "true" ]; then
bash bin/compile.sh -b ${{env.BOARD_META_PATH}}
else
bash bin/compile.sh ${{env.BOARD_META_PATH}} all deliver/rusefi.dfu deliver/rusefi.bin
fi
2020-06-16 09:33:49 -07:00
2024-01-29 05:04:48 -08:00
- name: Upload Bundle
if: ${{ env.full == 'true' }}
working-directory: ./artifacts
2024-03-08 13:44:01 -08:00
run: |
source ../firmware/config/boards/common_script_read_meta_env.inc ../firmware/${{ env.BOARD_META_PATH }}
bash ../firmware/bin/upload_bundle.sh
2024-01-29 05:04:48 -08:00
- name: Add Bundles to Release
if: ${{ env.full == 'true' && env.upload == 'release' }}
uses: ncipollo/release-action@v1.14.0
with:
tag: ${{ env.date }}
name: "Nightly ${{ env.date }}"
artifacts: "artifacts/rusefi_bundle_*.zip"
replacesArtifacts: false
token: ${{ secrets.NIGHTLY_RELEASE_ACCESS_TOKEN }}
allowUpdates: true
prerelease: true
2024-02-25 09:03:40 -08:00
- name: Upload .ini files to rusEFI Online server
if: ${{ env.full == 'true' }}
working-directory: ./firmware
run: |
source config/boards/common_script_read_meta_env.inc ${{ env.BOARD_META_PATH }}
cd ${META_OUTPUT_ROOT_FOLDER}tunerstudio/generated
${OLDPWD}/tunerstudio/upload_ini.sh ${{ secrets.RUSEFI_ONLINE_FTP_USER }} ${{ secrets.RUSEFI_ONLINE_FTP_PASS }} ${{ secrets.RUSEFI_FTP_SERVER }}
2022-08-17 15:29:07 -07:00
2024-02-25 09:03:40 -08:00
- name: Upload github action elf artifact
if: ${{ env.partial == 'true' }}
uses: actions/upload-artifact@v4
with:
name: rusefi_${{matrix.build-target}}.elf
path: ./firmware/build/rusefi.elf
2024-02-25 09:03:40 -08:00
- name: Upload github action map artifact
if: ${{ env.partial == 'true' }}
uses: actions/upload-artifact@v4
with:
name: rusefi_${{matrix.build-target}}.map
path: ./firmware/build/rusefi.map
2024-02-25 09:03:40 -08:00
- name: Upload github action bin artifact
if: ${{ env.partial == 'true' }}
uses: actions/upload-artifact@v4
2020-07-19 13:05:47 -07:00
with:
name: rusefi_${{matrix.build-target}}.bin
path: ./firmware/deliver/rusefi*.bin
2020-07-19 13:05:47 -07:00
2024-02-25 09:03:40 -08:00
- name: Upload github action hex artifact
if: ${{ env.partial == 'true' }}
uses: actions/upload-artifact@v4
2020-07-19 13:05:47 -07:00
with:
name: rusefi_${{matrix.build-target}}.hex
2023-06-25 14:34:27 -07:00
# we have a bit of a mess - this file from 'build' folder is only legit for not-BLT builds
# todo: we should produce .hex in both OpenBLT and non-OpenBLT case same as we do for .bin and .elf
path: ./firmware/build/rusefi*.hex
2020-07-19 13:05:47 -07:00
2024-02-25 09:03:40 -08:00
- name: Upload github action dfu artifact
if: ${{ env.partial == 'true' }}
uses: actions/upload-artifact@v4
2020-07-19 13:05:47 -07:00
with:
name: rusefi_${{matrix.build-target}}.dfu
path: ./firmware/deliver/rusefi*.dfu
2020-07-19 13:05:47 -07:00
2023-07-26 12:34:26 -07:00
- name: Upload bundle artifact
if: ${{ env.full == 'true' }}
uses: actions/upload-artifact@v4
with:
Use github actions to build and upload bundles (#1583) * add env var to skip upload * remove checking from compile.bat * working on push.yaml * finish sorting * progress * rename push to builds * rename push to builds * Add skip upload env var * fix pull_request name * fixed typo and changed name * fixed indentation and runs-on * try different env var setup * add nucleos and switch to underscore * add quotes * remove boards that were commented * remove boards that were commented * fix project board name * fixed variable name * add ini-file and console-settings * try installing gcc-multilib first * Install g++-multilib as well * remove unnecessary export * fixed exit numbers * change to different env setup * add simulator and console compilation to board bundles * changed OS and added linux simulator build * add checkout and missing colon * add gcc-multilib installes * Install mingw * fixed install * remove mingw from linux sim and call compile directly * change directory * moved envs to command * debug ls * debug ls * set ftp vars * add makefile debug info * removed batchecks * redirect stdout to easier see orrs * change name * remove redirect, add file inpection * Add conditional project name * Try software upgrade * missing char * update ine files * try quotes * add escapes * add quotes * add escapes and quotes * remove quotes and escapes * remove software upgrade * ignore test 2 * update apt * like this then * forgot import * fix case * remove RUSEFI_SKIP_UPLOAD and check RUSEFI_FTP_SERVER instead * break workflow back apart * upload simulator artifact * fixed operator * update apt * change paths * Update build-firmware.yaml * move update bundle to artifacts * fix var name * Install ncftp * set env vars conditionally * remove check so zips are created * try things the github way and copy to primary * re-enable test * missing space
2020-07-08 08:10:24 -07:00
name: rusefi_bundle_${{matrix.build-target}}.zip
path: ./artifacts/rusefi_bundle_${{matrix.build-target}}.zip
Use github actions to build and upload bundles (#1583) * add env var to skip upload * remove checking from compile.bat * working on push.yaml * finish sorting * progress * rename push to builds * rename push to builds * Add skip upload env var * fix pull_request name * fixed typo and changed name * fixed indentation and runs-on * try different env var setup * add nucleos and switch to underscore * add quotes * remove boards that were commented * remove boards that were commented * fix project board name * fixed variable name * add ini-file and console-settings * try installing gcc-multilib first * Install g++-multilib as well * remove unnecessary export * fixed exit numbers * change to different env setup * add simulator and console compilation to board bundles * changed OS and added linux simulator build * add checkout and missing colon * add gcc-multilib installes * Install mingw * fixed install * remove mingw from linux sim and call compile directly * change directory * moved envs to command * debug ls * debug ls * set ftp vars * add makefile debug info * removed batchecks * redirect stdout to easier see orrs * change name * remove redirect, add file inpection * Add conditional project name * Try software upgrade * missing char * update ine files * try quotes * add escapes * add quotes * add escapes and quotes * remove quotes and escapes * remove software upgrade * ignore test 2 * update apt * like this then * forgot import * fix case * remove RUSEFI_SKIP_UPLOAD and check RUSEFI_FTP_SERVER instead * break workflow back apart * upload simulator artifact * fixed operator * update apt * change paths * Update build-firmware.yaml * move update bundle to artifacts * fix var name * Install ncftp * set env vars conditionally * remove check so zips are created * try things the github way and copy to primary * re-enable test * missing space
2020-07-08 08:10:24 -07:00
2024-02-25 09:03:40 -08:00
- name: Upload github action autoupdate artifact
if: ${{ env.full == 'true' }}
uses: actions/upload-artifact@v4
with:
Use github actions to build and upload bundles (#1583) * add env var to skip upload * remove checking from compile.bat * working on push.yaml * finish sorting * progress * rename push to builds * rename push to builds * Add skip upload env var * fix pull_request name * fixed typo and changed name * fixed indentation and runs-on * try different env var setup * add nucleos and switch to underscore * add quotes * remove boards that were commented * remove boards that were commented * fix project board name * fixed variable name * add ini-file and console-settings * try installing gcc-multilib first * Install g++-multilib as well * remove unnecessary export * fixed exit numbers * change to different env setup * add simulator and console compilation to board bundles * changed OS and added linux simulator build * add checkout and missing colon * add gcc-multilib installes * Install mingw * fixed install * remove mingw from linux sim and call compile directly * change directory * moved envs to command * debug ls * debug ls * set ftp vars * add makefile debug info * removed batchecks * redirect stdout to easier see orrs * change name * remove redirect, add file inpection * Add conditional project name * Try software upgrade * missing char * update ine files * try quotes * add escapes * add quotes * add escapes and quotes * remove quotes and escapes * remove software upgrade * ignore test 2 * update apt * like this then * forgot import * fix case * remove RUSEFI_SKIP_UPLOAD and check RUSEFI_FTP_SERVER instead * break workflow back apart * upload simulator artifact * fixed operator * update apt * change paths * Update build-firmware.yaml * move update bundle to artifacts * fix var name * Install ncftp * set env vars conditionally * remove check so zips are created * try things the github way and copy to primary * re-enable test * missing space
2020-07-08 08:10:24 -07:00
name: rusefi_bundle_${{matrix.build-target}}_autoupdate.zip
path: ./artifacts/rusefi_bundle_${{matrix.build-target}}_autoupdate.zip