-
Notifications
You must be signed in to change notification settings - Fork 11
195 lines (165 loc) · 8.84 KB
/
compile-rtk-everywhere.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: Build RTK Everywhere
on:
workflow_dispatch:
branches:
env:
FILENAME_PREFIX: RTK_Everywhere_Firmware
FIRMWARE_VERSION_MAJOR: 1
FIRMWARE_VERSION_MINOR: 4
POINTPERFECT_LBAND_TOKEN: ${{ secrets.POINTPERFECT_LBAND_TOKEN }}
POINTPERFECT_IP_TOKEN: ${{ secrets.POINTPERFECT_IP_TOKEN }}
POINTPERFECT_LBAND_IP_TOKEN: ${{ secrets.POINTPERFECT_LBAND_IP_TOKEN }}
CORE_VERSION: 3.0.1
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Get current date
id: date
run: echo "date=$(date +'%b_%d_%Y')" >> $GITHUB_OUTPUT
- name: Get current date
id: dateNoScores
run: echo "dateNoScores=$(date +'%b %d %Y')" >> $GITHUB_OUTPUT
- name: Extract branch name
run: echo "BRANCH=${{github.ref_name}}" >> $GITHUB_ENV
#File_Name_v1_0.bin
#File_Name_RC-Jan_26_2023.bin
- name: Create file ending and compiler flags based on branch
run: |
if [[ $BRANCH == 'main' ]]; then
echo "FILE_ENDING_UNDERSCORE=_v${{ env.FIRMWARE_VERSION_MAJOR }}_${{ env.FIRMWARE_VERSION_MINOR }}" >> "$GITHUB_ENV"
echo "FILE_ENDING_NOUNDERSCORE=_v${{ env.FIRMWARE_VERSION_MAJOR }}.${{ env.FIRMWARE_VERSION_MINOR }}" >> "$GITHUB_ENV"
echo "JSON_ENDING=" >> "$GITHUB_ENV"
echo "JSON_FILE_NAME=RTK-Everywhere-Firmware.json" >> "$GITHUB_ENV"
echo "ENABLE_DEVELOPER=false" >> "$GITHUB_ENV"
echo "DEBUG_LEVEL=none" >> "$GITHUB_ENV"
else
echo "FILE_ENDING_UNDERSCORE=_RC-${{ steps.date.outputs.date }}" >> "$GITHUB_ENV"
echo "FILE_ENDING_NOUNDERSCORE=_RC-${{ steps.dateNoScores.outputs.dateNoScores }}" >> "$GITHUB_ENV"
echo "JSON_ENDING=-${{ steps.dateNoScores.outputs.dateNoScores }}" >> "$GITHUB_ENV"
echo "JSON_FILE_NAME=RTK-Everywhere-RC-Firmware.json" >> "$GITHUB_ENV"
echo "ENABLE_DEVELOPER=true" >> "$GITHUB_ENV"
echo "DEBUG_LEVEL=debug" >> "$GITHUB_ENV"
fi
- 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/espressif/arduino-esp32/gh-pages/package_esp32_index.json,https://espressif.github.io/arduino-esp32/package_esp32_dev_index.json"
- name: Update core index
run: arduino-cli core update-index
- name: Update library index
run: arduino-cli lib update-index
- name: Install platform
run: arduino-cli core install esp32:esp32@${{ env.CORE_VERSION }}
- name: Get IDF version
run: |
cd /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs
IDF_VERSION=$(ls | grep idf-release)
echo "ESP_IDF=${IDF_VERSION}" >> "$GITHUB_ENV"
- name: Get Known Libraries
run: arduino-cli lib install
"ESP32-OTA-Pull"@1.0.0
"SdFat"@2.1.1
"SparkFun LIS2DH12 Arduino Library"@1.0.3
"SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4
"SparkFun u-blox GNSS v3"@3.1.5
"SparkFun Qwiic OLED Arduino Library"@1.0.13
"SparkFun Extensible Message Parser"@1.0.1
"SparkFun BQ40Z50 Battery Manager Arduino Library"@1.0.0
"ArduinoMqttClient"@0.1.8
"SparkFun u-blox PointPerfect Library"@1.11.4
"SparkFun IM19 IMU Arduino Library"@1.0.1
"SparkFun UM980 Triband RTK GNSS Arduino Library"@1.0.4
# https://github.com/avinabmalla/ESP32_BleSerial/issues/15
- name: Patch ESP32_BleSerial BLECharacteristic
run: |
cd Firmware/RTK_Everywhere/Patch/
cp BleSerial.cpp /home/runner/Arduino/libraries/ESP32_BleSerial/src/BleSerial.cpp
- name: Patch libmbedtls
run: |
cd Firmware/RTK_Everywhere/Patch/
cp libmbedtls.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedtls.a
cp libmbedtls_2.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedtls_2.a
cp libmbedcrypto.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedcrypto.a
cp libmbedx509.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedx509.a
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
# Configure Python - now we have Python installed, we need to provide everything needed by esptool otherwise the compile fails
- name: Configure Python
run: |
pip3 install pyserial
- name: Update index_html
run: |
cd Firmware/Tools
python index_html_zipper.py ../RTK_Everywhere/AP-Config/index.html ../RTK_Everywhere/form.h
- name: Update main_js
run: |
cd Firmware/Tools
python main_js_zipper.py ../RTK_Everywhere/AP-Config/src/main.js ../RTK_Everywhere/form.h
- name: Commit and push form.h
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: ./Firmware/RTK_Everywhere
branch: ${{ env.BRANCH }}
message: 'Update form.h via Python'
- name: Copy custom RTKEverywhere.csv
run:
cp Firmware/RTKEverywhere.csv /home/runner/.arduino15/packages/esp32/hardware/esp32/${{ env.CORE_VERSION }}/tools/partitions/RTKEverywhere.csv
- name: Compile Sketch
run: arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=${{ env.DEBUG_LEVEL }},PSRAM=enabled ./Firmware/RTK_Everywhere/RTK_Everywhere.ino
--build-property build.partitions=RTKEverywhere
--build-property upload.maximum_size=3145728
--build-property "compiler.cpp.extra_flags=-MMD -c \"-DPOINTPERFECT_LBAND_TOKEN=$POINTPERFECT_LBAND_TOKEN\" \"-DPOINTPERFECT_IP_TOKEN=$POINTPERFECT_IP_TOKEN\" \"-DPOINTPERFECT_LBAND_IP_TOKEN=$POINTPERFECT_LBAND_IP_TOKEN\" \"-DFIRMWARE_VERSION_MAJOR=$FIRMWARE_VERSION_MAJOR\" \"-DFIRMWARE_VERSION_MINOR=$FIRMWARE_VERSION_MINOR\" \"-DENABLE_DEVELOPER=${{ env.ENABLE_DEVELOPER }}\""
--export-binaries
- name: Rename binary
run: |
cd Firmware/RTK_Everywhere/build/esp32.esp32.esp32/
mv RTK_Everywhere.ino.bin ${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
- name: Upload binary to action
uses: actions/upload-artifact@v3
with:
name: ${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}
path: ./Firmware/RTK_Everywhere/build/esp32.esp32.esp32/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
- name: Push binary to Binaries Repo
# uses: dmnemec/copy_file_to_another_repo_action #Workaround for Issue: https://github.com/orgs/community/discussions/55820#discussioncomment-5946136
uses: Jason2866/copy_file_to_another_repo_action@http408_fix
env:
API_TOKEN_GITHUB: ${{ secrets.PUSH_BINARIES_REPO }}
with:
source_file: ./Firmware/RTK_Everywhere/build/esp32.esp32.esp32/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
destination_repo: 'sparkfun/SparkFun_RTK_Everywhere_Firmware_Binaries'
destination_folder: ''
user_email: '[email protected]'
user_name: 'nseidle'
commit_message: 'Github Action - Updating Binary ${{ steps.dateNoScores.outputs.dateNoScores }}'
- name: Update JSON File
uses: "DamianReeves/write-file-action@master"
with:
path: ${{ env.JSON_FILE_NAME }}
write-mode: overwrite
contents: |
{"Configurations": [{"Version":"${{ env.FIRMWARE_VERSION_MAJOR }}.${{ env.FIRMWARE_VERSION_MINOR }}${{ env.JSON_ENDING }}", "URL":"https://raw.githubusercontent.com/sparkfun/SparkFun_RTK_Everywhere_Firmware_Binaries/main/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin"}]}
- name: Push JSON to Binaries Repo
# uses: dmnemec/copy_file_to_another_repo_action #Workaround for Issue: https://github.com/orgs/community/discussions/55820#discussioncomment-5946136
uses: Jason2866/copy_file_to_another_repo_action@http408_fix
env:
API_TOKEN_GITHUB: ${{ secrets.PUSH_BINARIES_REPO }}
with:
source_file: ${{ env.JSON_FILE_NAME }}
destination_repo: 'sparkfun/SparkFun_RTK_Everywhere_Firmware_Binaries'
destination_folder: ''
user_email: '[email protected]'
user_name: 'nseidle'
commit_message: 'Github Action - Updating JSON ${{ steps.dateNoScores.outputs.dateNoScores }}'