build-for-release #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow that builds the firmware, and adds the binary to the ./Binaries folder, ready for release. | |
name: build-for-release | |
# Controls when the workflow will run | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
branches: | |
env: | |
FILENAME_PREFIX: OpenLog_Artemis | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Extract branch name | |
run: echo "BRANCH=${{github.ref_name}}" >> $GITHUB_ENV | |
- name: Get firmware version 1 | |
run: | | |
echo "firmwareMajor=$(grep -Po "(?<=FIRMWARE_VERSION_MAJOR = )([0-9])*(?=;$)" ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino)" >> "$GITHUB_ENV" | |
echo "firmwareMinor=$(grep -Po "(?<=FIRMWARE_VERSION_MINOR = )([0-9])*(?=;$)" ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino)" >> "$GITHUB_ENV" | |
- name: Get firmware version 2 | |
run: | | |
echo "firmwareMajorMinor=-V10-v${{ env.firmwareMajor }}${{ env.firmwareMinor }}" >> "$GITHUB_ENV" | |
echo "firmwareMajorMinorX04=-X04-v${{ env.firmwareMajor }}${{ env.firmwareMinor }}" >> "$GITHUB_ENV" | |
- name: Setup Arduino CLI | |
uses: arduino/setup-arduino-cli@v1 | |
- name: Start config file | |
run: arduino-cli config init --additional-urls "https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/main/package_sparkfun_apollo3_index.json" | |
- name: Update index | |
run: arduino-cli core update-index | |
- name: Install platform | |
run: arduino-cli core install "Sparkfun:apollo3@2.2.1" | |
- name: Get Known Libraries | |
run: arduino-cli lib install | |
"SdFat@2.2.2" | |
"SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library" | |
"SparkFun I2C Mux Arduino Library" | |
"SparkFun CCS811 Arduino Library" | |
"SparkFun VL53L1X 4m Laser Distance Sensor" | |
"SparkFun BME280" | |
"SparkFun LPS25HB Pressure Sensor Library" | |
"SparkFun VEML6075 Arduino Library" | |
"SparkFun PHT MS8607 Arduino Library" | |
"SparkFun MCP9600 Thermocouple Library" | |
"SparkFun SGP30 Arduino Library" | |
"SparkFun VCNL4040 Proximity Sensor Library" | |
"SparkFun MS5637 Barometric Pressure Library" | |
"SparkFun High Precision Temperature Sensor TMP117 Qwiic" | |
"SparkFun u-blox GNSS Arduino Library" | |
"SparkFun 6DoF ISM330DHCX" | |
"SparkFun Qwiic Scale NAU7802 Arduino Library" | |
"SparkFun SCD30 Arduino Library" | |
"SparkFun Qwiic Humidity AHT20" | |
"SparkFun SHTC3 Humidity and Temperature Sensor Library" | |
"SparkFun ADS122C04 ADC Arduino Library" | |
"SparkFun MicroPressure Library" | |
"SparkFun Particle Sensor Panasonic SN-GCJA5" | |
"SparkFun SGP40 Arduino Library" | |
"SparkFun Qwiic Button and Qwiic Switch Library" | |
"SparkFun Bio Sensor Hub Library" | |
"SparkFun MMC5983MA Magnetometer Arduino Library" | |
"SparkFun ADS1015 Arduino Library" | |
"SparkFun KX13X Arduino Library" | |
"SparkFun SDP3x Arduino Library" | |
"SparkFun LPS28DFW Arduino Library" | |
"SparkFun VEML7700 Arduino Library" | |
- name: Enable external libs | |
run: arduino-cli config set library.enable_unsafe_install true | |
- name: Get Libraries | |
run: arduino-cli lib install --git-url | |
https://github.com/bluerobotics/BlueRobotics_MS5837_Library.git | |
- name: Enable ICM20948 DMP | |
run: sed -i 's|//#define ICM_20948_USE_DMP|#define ICM_20948_USE_DMP|g' /home/runner/Arduino/libraries/SparkFun_9DoF_IMU_Breakout_-_ICM_20948_-_Arduino_Library/src/util/ICM_20948_C.h | |
- name: Patch Apollo3 Core | |
run: | | |
cd ./Extras | |
unzip UartPower3.zip | |
cp HardwareSerial.h /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-extend/HardwareSerial.h | |
cp HardwareSerial.cpp /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-implement/HardwareSerial.cpp | |
cp UnbufferedSerial.h /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/mbed-os/drivers/UnbufferedSerial.h | |
cp serial_api.c /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/mbed-os/targets/TARGET_Ambiq_Micro/TARGET_Apollo3/device/serial_api.c | |
cp libmbed-os.a /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/variants/SFE_ARTEMIS_ATP/mbed/libmbed-os.a | |
cp SPI.cpp /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/libraries/SPI/src/SPI.cpp | |
rm *.h | |
rm *.cpp | |
rm *.a | |
rm *.c | |
rm *.odt | |
- name: Compile Sketch | |
run: arduino-cli compile -v -e -b SparkFun:apollo3:sfe_artemis_atp ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino | |
- name: Rename binary | |
run: | | |
cd ./Firmware/${{ env.FILENAME_PREFIX }}/build/SparkFun.apollo3.sfe_artemis_atp/ | |
mv ${{ env.FILENAME_PREFIX }}.ino.bin ${{ env.FILENAME_PREFIX }}${{ env.firmwareMajorMinor }}.bin | |
echo "targetBinary=./Firmware/${{ env.FILENAME_PREFIX }}/build/SparkFun.apollo3.sfe_artemis_atp/${{ env.FILENAME_PREFIX }}${{ env.firmwareMajorMinor }}.bin" >> "$GITHUB_ENV" | |
rm *.axf | |
rm *.hex | |
rm *.map | |
- name: Move binary | |
run: mv ${{ env.targetBinary }} ./Binaries | |
- name: Enable Power Loss Protection | |
run: sed -i 's|//#define noPowerLossProtection|#define noPowerLossProtection|g' ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino | |
- name: Compile Sketch | |
run: arduino-cli compile -v -e -b SparkFun:apollo3:sfe_artemis_atp ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino | |
- name: Rename binary | |
run: | | |
cd ./Firmware/${{ env.FILENAME_PREFIX }}/build/SparkFun.apollo3.sfe_artemis_atp/ | |
mv ${{ env.FILENAME_PREFIX }}.ino.bin ${{ env.FILENAME_PREFIX }}${{ env.firmwareMajorMinor }}-NoPowerLossProtection.bin | |
echo "targetBinary=./Firmware/${{ env.FILENAME_PREFIX }}/build/SparkFun.apollo3.sfe_artemis_atp/${{ env.FILENAME_PREFIX }}${{ env.firmwareMajorMinor }}-NoPowerLossProtection.bin" >> "$GITHUB_ENV" | |
rm *.axf | |
rm *.hex | |
rm *.map | |
- name: Move binary | |
run: mv ${{ env.targetBinary }} ./Binaries | |
- name: Disable Power Loss Protection | |
run: sed -i 's|#define noPowerLossProtection|//#define noPowerLossProtection|g' ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino | |
- name: X04 Hardware | |
run: | | |
sed -i 's|#define HARDWARE_VERSION_MAJOR 1|#define HARDWARE_VERSION_MAJOR 0|g' ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino | |
sed -i 's|#define HARDWARE_VERSION_MINOR 0|#define HARDWARE_VERSION_MINOR 4|g' ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino | |
- name: Compile Sketch | |
run: arduino-cli compile -v -e -b SparkFun:apollo3:sfe_artemis_atp ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino | |
- name: Rename binary | |
run: | | |
cd ./Firmware/${{ env.FILENAME_PREFIX }}/build/SparkFun.apollo3.sfe_artemis_atp/ | |
mv ${{ env.FILENAME_PREFIX }}.ino.bin ${{ env.FILENAME_PREFIX }}${{ env.firmwareMajorMinorX04 }}.bin | |
echo "targetBinary=./Firmware/${{ env.FILENAME_PREFIX }}/build/SparkFun.apollo3.sfe_artemis_atp/${{ env.FILENAME_PREFIX }}${{ env.firmwareMajorMinorX04 }}.bin" >> "$GITHUB_ENV" | |
rm *.axf | |
rm *.hex | |
rm *.map | |
- name: Move binary | |
run: mv ${{ env.targetBinary }} ./Binaries | |
- name: V01 Hardware | |
run: | | |
sed -i 's|#define HARDWARE_VERSION_MAJOR 0|#define HARDWARE_VERSION_MAJOR 1|g' ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino | |
sed -i 's|#define HARDWARE_VERSION_MINOR 4|#define HARDWARE_VERSION_MINOR 0|g' ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino | |
- uses: actions-js/push@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ env.BRANCH }} | |
directory: './Binaries' | |
message: 'Pushing new firmware binary' |