|
| 1 | +name: RTK Firmware Non-Release Build |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + branches: |
| 5 | + |
| 6 | +env: |
| 7 | + FILENAME_PREFIX: RTK_Surveyor_Firmware |
| 8 | + FIRMWARE_VERSION_MAJOR: 99 |
| 9 | + FIRMWARE_VERSION_MINOR: 99 |
| 10 | + POINTPERFECT_TOKEN: ${{ secrets.POINTPERFECT_TOKEN }} |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + |
| 15 | + name: Build |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@master |
| 21 | + |
| 22 | + - name: Get current date |
| 23 | + id: date |
| 24 | + run: echo "date=$(date +'%b_%d_%Y')" >> $GITHUB_OUTPUT |
| 25 | + |
| 26 | + - name: Get current date |
| 27 | + id: dateNoScores |
| 28 | + run: echo "dateNoScores=$(date +'%b %d %Y')" >> $GITHUB_OUTPUT |
| 29 | + |
| 30 | + - name: Extract branch name |
| 31 | + run: echo "BRANCH=${{github.ref_name}}" >> $GITHUB_ENV |
| 32 | + |
| 33 | + #File_Name_v3_1.bin |
| 34 | + #File_Name_RC-Jan_26_2023.bin |
| 35 | + - name: Create file ending and compiler flags based on branch |
| 36 | + run: | |
| 37 | + echo "FILE_ENDING_UNDERSCORE=_RC-${{ steps.date.outputs.date }}" >> "$GITHUB_ENV" |
| 38 | + echo "FILE_ENDING_NOUNDERSCORE=_RC-${{ steps.dateNoScores.outputs.dateNoScores }}" >> "$GITHUB_ENV" |
| 39 | + echo "JSON_ENDING=-${{ steps.dateNoScores.outputs.dateNoScores }}" >> "$GITHUB_ENV" |
| 40 | + echo "JSON_FILE_NAME=RTK-RC-Firmware.json" >> "$GITHUB_ENV" |
| 41 | + echo "ENABLE_DEVELOPER=true" >> "$GITHUB_ENV" |
| 42 | + echo "DEBUG_LEVEL=debug" >> "$GITHUB_ENV" |
| 43 | +
|
| 44 | + - name: Setup Arduino CLI |
| 45 | + uses: arduino/setup-arduino-cli@v1 |
| 46 | + |
| 47 | + - name: Start config file |
| 48 | + run: arduino-cli config init --additional-urls "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" |
| 49 | + |
| 50 | + - name: Update index |
| 51 | + run: arduino-cli core update-index |
| 52 | + |
| 53 | + #We limit the ESP32 core to v2.0.2 |
| 54 | + - name: Install platform |
| 55 | + run: arduino-cli core install esp32:[email protected] |
| 56 | + |
| 57 | + - name: Get Known Libraries |
| 58 | + run: arduino-cli lib install |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + "ESP32-OTA-Pull"@1.0.0 |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + "SdFat"@2.1.1 |
| 67 | + "SparkFun LIS2DH12 Arduino Library"@1.0.3 |
| 68 | + "SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4 |
| 69 | + "SparkFun u-blox GNSS v3"@3.0.14 |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + - name: Enable external libs |
| 74 | + run: arduino-cli config set library.enable_unsafe_install true |
| 75 | + |
| 76 | + - name: Get Libraries |
| 77 | + run: arduino-cli lib install --git-url |
| 78 | + https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library.git |
| 79 | + https://github.com/me-no-dev/ESPAsyncWebServer.git |
| 80 | + https://github.com/me-no-dev/AsyncTCP.git |
| 81 | + |
| 82 | + #Incorporate ESP-Now patch into core: https://github.com/espressif/arduino-esp32/pull/7044/files |
| 83 | + #- name: Patch ESP32 Core |
| 84 | + # run: | |
| 85 | + # cd Firmware/RTK_Surveyor/Patch/ |
| 86 | + # cp WiFiGeneric.cpp /home/runner/.arduino15/packages/esp32/hardware/esp32/2.0.2/libraries/WiFi/src/WiFiGeneric.cpp |
| 87 | + |
| 88 | + #Patch Server.h to avoid https://github.com/arduino-libraries/Ethernet/issues/88#issuecomment-455498941 |
| 89 | + #Note: this patch can be removed if/when we upgrade to ESP32 core >= v2.0.6 |
| 90 | + - name: Patch ESP32 Server.h for Ethernet |
| 91 | + run: | |
| 92 | + cd Firmware/RTK_Surveyor/Patch/ |
| 93 | + cp Server.h /home/runner/.arduino15/packages/esp32/hardware/esp32/2.0.2/cores/esp32/Server.h |
| 94 | +
|
| 95 | + - name: Setup Python |
| 96 | + uses: actions/setup-python@v4 |
| 97 | + with: |
| 98 | + python-version: '3.10' |
| 99 | + |
| 100 | + # Configure Python - now we have Python installed, we need to provide everything needed by esptool otherwise the compile fails |
| 101 | + - name: Configure Python |
| 102 | + run: | |
| 103 | + pip3 install pyserial |
| 104 | +
|
| 105 | + - name: Update index_html |
| 106 | + run: | |
| 107 | + cd Firmware/Tools |
| 108 | + python index_html_zipper.py ../RTK_Surveyor/AP-Config/index.html ../RTK_Surveyor/form.h |
| 109 | +
|
| 110 | + - name: Update main_js |
| 111 | + run: | |
| 112 | + cd Firmware/Tools |
| 113 | + python main_js_zipper.py ../RTK_Surveyor/AP-Config/src/main.js ../RTK_Surveyor/form.h |
| 114 | +
|
| 115 | + - name: Commit and push form.h |
| 116 | + uses: actions-js/push@master |
| 117 | + with: |
| 118 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 119 | + directory: ./Firmware/RTK_Surveyor |
| 120 | + branch: ${{ env.BRANCH }} |
| 121 | + message: 'Update form.h via Python' |
| 122 | + |
| 123 | + - name: Copy custom app3M_fat9M_16MB.csv |
| 124 | + run: |
| 125 | + cp Firmware/app3M_fat9M_16MB.csv /home/runner/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/app3M_fat9M_16MB.csv |
| 126 | + |
| 127 | + - name: Compile Sketch |
| 128 | + run: arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=${{ env.DEBUG_LEVEL }} ./Firmware/RTK_Surveyor/RTK_Surveyor.ino |
| 129 | + --build-property build.partitions=app3M_fat9M_16MB |
| 130 | + --build-property upload.maximum_size=3145728 |
| 131 | + --build-property "compiler.cpp.extra_flags=\"-DPOINTPERFECT_TOKEN=$POINTPERFECT_TOKEN\" \"-DFIRMWARE_VERSION_MAJOR=$FIRMWARE_VERSION_MAJOR\" \"-DFIRMWARE_VERSION_MINOR=$FIRMWARE_VERSION_MINOR\" \"-DENABLE_DEVELOPER=${{ env.ENABLE_DEVELOPER }}\"" |
| 132 | + --export-binaries |
| 133 | + |
| 134 | + - name: Create artifact name |
| 135 | + run: | |
| 136 | + echo "ARTIFACT=${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}" >> $GITHUB_ENV |
| 137 | +
|
| 138 | + - name: Create artifact directory |
| 139 | + run: | |
| 140 | + cd Firmware/RTK_Surveyor/build/esp32.esp32.esp32/ |
| 141 | + mkdir ${{ env.ARTIFACT }} |
| 142 | + mv RTK_Surveyor.ino.bin ${{ env.ARTIFACT }} |
| 143 | +
|
| 144 | + - name: Upload artifact directory to action - avoid double-zip |
| 145 | + uses: actions/upload-artifact@v3 |
| 146 | + with: |
| 147 | + name: ${{ env.ARTIFACT }} |
| 148 | + path: Firmware/RTK_Surveyor/build/esp32.esp32.esp32/${{ env.ARTIFACT }} |
| 149 | + retention-days: 7 |
0 commit comments