|
| 1 | +# Workflow that builds the firmware, and adds the binary to the ./Binaries folder, ready for release. |
| 2 | + |
| 3 | +name: build-for-release |
| 4 | + |
| 5 | +# Controls when the workflow will run |
| 6 | +on: |
| 7 | + # Allows you to run this workflow manually from the Actions tab |
| 8 | + workflow_dispatch: |
| 9 | + branches: |
| 10 | + |
| 11 | +env: |
| 12 | + FILENAME_PREFIX: OpenLog_Artemis |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + |
| 17 | + name: Build |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@master |
| 23 | + |
| 24 | + - name: Extract branch name |
| 25 | + run: echo "BRANCH=${{github.ref_name}}" >> $GITHUB_ENV |
| 26 | + |
| 27 | + - name: Get firmware version 1 |
| 28 | + run: | |
| 29 | + echo "firmwareMajor=$(grep -Po "(?<=FIRMWARE_VERSION_MAJOR = )([0-9])*(?=;$)" ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino)" >> "$GITHUB_ENV" |
| 30 | + echo "firmwareMinor=$(grep -Po "(?<=FIRMWARE_VERSION_MINOR = )([0-9])*(?=;$)" ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino)" >> "$GITHUB_ENV" |
| 31 | +
|
| 32 | + - name: Get firmware version 2 |
| 33 | + run: echo "firmwareMajorMinor=-V10-v${{ env.firmwareMajor }}${{ env.firmwareMinor }}" >> "$GITHUB_ENV" |
| 34 | + |
| 35 | + - name: Setup Arduino CLI |
| 36 | + uses: arduino/setup-arduino-cli@v1 |
| 37 | + |
| 38 | + - name: Start config file |
| 39 | + run: arduino-cli config init --additional-urls "https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/main/package_sparkfun_apollo3_index.json" |
| 40 | + |
| 41 | + - name: Update index |
| 42 | + run: arduino-cli core update-index |
| 43 | + |
| 44 | + - name: Install platform |
| 45 | + run: arduino-cli core install "Sparkfun:[email protected]" |
| 46 | + |
| 47 | + - name: Get Known Libraries |
| 48 | + run: arduino-cli lib install |
| 49 | + |
| 50 | + "SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library" |
| 51 | + "SparkFun I2C Mux Arduino Library" |
| 52 | + "SparkFun CCS811 Arduino Library" |
| 53 | + "SparkFun VL53L1X 4m Laser Distance Sensor" |
| 54 | + "SparkFun BME280" |
| 55 | + "SparkFun LPS25HB Pressure Sensor Library" |
| 56 | + "SparkFun VEML6075 Arduino Library" |
| 57 | + "SparkFun PHT MS8607 Arduino Library" |
| 58 | + "SparkFun MCP9600 Thermocouple Library" |
| 59 | + "SparkFun SGP30 Arduino Library" |
| 60 | + "SparkFun VCNL4040 Proximity Sensor Library" |
| 61 | + "SparkFun MS5637 Barometric Pressure Library" |
| 62 | + "SparkFun High Precision Temperature Sensor TMP117 Qwiic" |
| 63 | + "SparkFun u-blox GNSS Arduino Library" |
| 64 | + "SparkFun 6DoF ISM330DHCX" |
| 65 | + "SparkFun Qwiic Scale NAU7802 Arduino Library" |
| 66 | + "SparkFun SCD30 Arduino Library" |
| 67 | + "SparkFun Qwiic Humidity AHT20" |
| 68 | + "SparkFun SHTC3 Humidity and Temperature Sensor Library" |
| 69 | + "SparkFun ADS122C04 ADC Arduino Library" |
| 70 | + "SparkFun MicroPressure Library" |
| 71 | + "SparkFun Particle Sensor Panasonic SN-GCJA5" |
| 72 | + "SparkFun SGP40 Arduino Library" |
| 73 | + "SparkFun Qwiic Button and Qwiic Switch Library" |
| 74 | + "SparkFun Bio Sensor Hub Library" |
| 75 | + "SparkFun MMC5983MA Magnetometer Arduino Library" |
| 76 | + "SparkFun ADS1015 Arduino Library" |
| 77 | + "SparkFun KX13X Arduino Library" |
| 78 | + "SparkFun SDP3x Arduino Library" |
| 79 | + |
| 80 | + - name: Enable external libs |
| 81 | + run: arduino-cli config set library.enable_unsafe_install true |
| 82 | + |
| 83 | + - name: Get Libraries |
| 84 | + run: arduino-cli lib install --git-url |
| 85 | + https://github.com/bluerobotics/BlueRobotics_MS5837_Library.git |
| 86 | + |
| 87 | + - name: Patch Apollo3 Core |
| 88 | + run: | |
| 89 | + cd ./Extras |
| 90 | + unzip UartPower3.zip |
| 91 | + cp HardwareSerial.h /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-extend/HardwareSerial.h |
| 92 | + cp HardwareSerial.cpp /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-implement/HardwareSerial.cpp |
| 93 | + cp UnbufferedSerial.h /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/mbed-os/drivers/UnbufferedSerial.h |
| 94 | + 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 |
| 95 | + cp libmbed-os.a /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/variants/SFE_ARTEMIS_ATP/mbed/libmbed-os.a |
| 96 | + cp SPI.cpp /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/libraries/SPI/src/SPI.cpp |
| 97 | + rm *.h |
| 98 | + rm *.cpp |
| 99 | + rm *.a |
| 100 | + rm *.c |
| 101 | + rm *.odt |
| 102 | +
|
| 103 | + - name: Compile Sketch |
| 104 | + run: arduino-cli compile -v -e -b SparkFun:apollo3:sfe_artemis_atp ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino |
| 105 | + --build-property "compiler.cpp.extra_flags=\"-DICM_20948_USE_DMP\" |
| 106 | + |
| 107 | + - name: Rename binary |
| 108 | + run: | |
| 109 | + cd ./Firmware/${{ env.FILENAME_PREFIX }}/build/SparkFun.apollo3.sfe_artemis_atp/ |
| 110 | + mv ${{ env.FILENAME_PREFIX }}.ino.bin ${{ env.FILENAME_PREFIX }}${{ env.firmwareMajorMinor }}.bin |
| 111 | + echo "targetBinary=./Firmware/${{ env.FILENAME_PREFIX }}/build/SparkFun.apollo3.sfe_artemis_atp/${{ env.FILENAME_PREFIX }}${{ env.firmwareMajorMinor }}.bin" >> "$GITHUB_ENV" |
| 112 | + rm *.axf |
| 113 | + rm *.hex |
| 114 | + rm *.map |
| 115 | +
|
| 116 | + - name: Move binary |
| 117 | + run: mv ${{ env.targetBinary }} ./Binaries |
| 118 | + |
| 119 | + - uses: actions-js/push@master |
| 120 | + with: |
| 121 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 122 | + branch: ${{ env.BRANCH }} |
| 123 | + directory: './Binaries' |
| 124 | + message: 'Pushing new firmware binary' |
0 commit comments