Skip to content

Commit 249f9bd

Browse files
authored
Merge pull request #760 from sparkfun/pcDocs
Update workflows to use Dockerfile
2 parents 62da629 + 08a0b91 commit 249f9bd

16 files changed

+454
-479
lines changed

.github/workflows/compile-rtk-everywhere.yml

Lines changed: 32 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ env:
77
FILENAME_PREFIX: RTK_Everywhere_Firmware
88
FIRMWARE_VERSION_MAJOR: 2
99
FIRMWARE_VERSION_MINOR: 3
10-
POINTPERFECT_LBAND_TOKEN: ${{ secrets.POINTPERFECT_LBAND_TOKEN }}
11-
POINTPERFECT_IP_TOKEN: ${{ secrets.POINTPERFECT_IP_TOKEN }}
12-
POINTPERFECT_LBAND_IP_TOKEN: ${{ secrets.POINTPERFECT_LBAND_IP_TOKEN }}
13-
POINTPERFECT_RTCM_TOKEN: ${{ secrets.POINTPERFECT_RTCM_TOKEN }}
1410
CORE_VERSION: 3.0.7
1511

1612
jobs:
@@ -54,124 +50,49 @@ jobs:
5450
echo "DEBUG_LEVEL=error" >> "$GITHUB_ENV"
5551
fi
5652
57-
- name: Setup Arduino CLI
58-
uses: arduino/setup-arduino-cli@v1
59-
60-
- name: Start config file
61-
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"
62-
63-
- name: Update core index
64-
run: arduino-cli core update-index
65-
66-
- name: Update library index
67-
run: arduino-cli lib update-index
68-
69-
- name: Install platform
70-
run: arduino-cli core install esp32:esp32@${{ env.CORE_VERSION }}
71-
72-
- name: Get IDF version
73-
run: |
74-
cd /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs
75-
IDF_VERSION=$(ls | grep idf-release)
76-
echo "ESP_IDF=${IDF_VERSION}" >> "$GITHUB_ENV"
77-
78-
- name: Get Known Libraries
79-
run: arduino-cli lib install
80-
81-
82-
83-
"ESP32-OTA-Pull"@1.0.0
84-
85-
86-
"SdFat"@2.1.1
87-
"SparkFun LIS2DH12 Arduino Library"@1.0.3
88-
"SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4
89-
"SparkFun u-blox GNSS v3"@3.1.10
90-
"SparkFun Qwiic OLED Arduino Library"@1.0.13
91-
92-
"SparkFun Extensible Message Parser"@1.0.4
93-
"SparkFun BQ40Z50 Battery Manager Arduino Library"@1.0.0
94-
"ArduinoMqttClient"@0.1.8
95-
"SparkFun u-blox PointPerfect Library"@1.11.4
96-
"SparkFun IM19 IMU Arduino Library"@1.0.1
97-
"SparkFun UM980 Triband RTK GNSS Arduino Library"@1.0.5
98-
"SparkFun LG290P Quadband RTK GNSS Arduino Library"@1.0.8
99-
"SparkFun I2C Expander Arduino Library"@1.0.1
100-
"SparkFun Apple Accessory Arduino Library"@3.0.9
101-
"SparkFun Authentication Coprocessor Arduino Library"@1.0.0
102-
"SparkFun Toolkit"@1.0.6
103-
104-
- name: Patch libmbedtls
53+
- name: Run Dockerfile and copy files
54+
# The --quiet suppresses the build output, keeping the secrets safe
10555
run: |
106-
cd Firmware/RTK_Everywhere/Patch/
107-
cp libmbedtls.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedtls.a
108-
cp libmbedtls_2.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedtls_2.a
109-
cp libmbedcrypto.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedcrypto.a
110-
cp libmbedx509.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedx509.a
111-
112-
- name: Patch NetworkEvents
113-
run: |
114-
cd Firmware/RTK_Everywhere/Patch/
115-
cp NetworkEvents.* /home/runner/.arduino15/packages/esp32/hardware/esp32/${{ env.CORE_VERSION }}/libraries/Network/src/
116-
117-
- name: Patch libbt
118-
run: |
119-
cd Firmware/RTK_Everywhere/Patch/
120-
cp libbt.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libbt.a
121-
122-
- name: Setup Python
123-
uses: actions/setup-python@v4
124-
with:
125-
python-version: '3.10'
126-
127-
# Configure Python - now we have Python installed, we need to provide everything needed by esptool otherwise the compile fails
128-
- name: Configure Python
129-
run: |
130-
pip3 install pyserial
131-
132-
- name: Update index_html
133-
run: |
134-
cd Firmware/Tools
135-
python index_html_zipper.py ../RTK_Everywhere/AP-Config/index.html ../RTK_Everywhere/form.h
136-
137-
- name: Update main_js
138-
run: |
139-
cd Firmware/Tools
140-
python main_js_zipper.py ../RTK_Everywhere/AP-Config/src/main.js ../RTK_Everywhere/form.h
56+
cd ./Firmware
57+
echo "*** The docker build is quiet to protect the GitHub secrets ***"
58+
docker build -t rtk_everywhere_firmware --no-cache --quiet \
59+
--build-arg CORE_VERSION=${{ env.CORE_VERSION }} \
60+
--build-arg FIRMWARE_VERSION_MAJOR=${{ env.FIRMWARE_VERSION_MAJOR }} \
61+
--build-arg FIRMWARE_VERSION_MINOR=${{ env.FIRMWARE_VERSION_MINOR }} \
62+
--build-arg POINTPERFECT_LBAND_TOKEN="${{ secrets.POINTPERFECT_LBAND_TOKEN }}" \
63+
--build-arg POINTPERFECT_IP_TOKEN="${{ secrets.POINTPERFECT_IP_TOKEN }}" \
64+
--build-arg POINTPERFECT_LBAND_IP_TOKEN="${{ secrets.POINTPERFECT_LBAND_IP_TOKEN }}" \
65+
--build-arg POINTPERFECT_RTCM_TOKEN="${{ secrets.POINTPERFECT_RTCM_TOKEN }}" \
66+
--build-arg ENABLE_DEVELOPER=${{ env.ENABLE_DEVELOPER }} \
67+
--build-arg DEBUG_LEVEL=${{ env.DEBUG_LEVEL }} \
68+
.
69+
docker create --name=rtk_everywhere rtk_everywhere_firmware:latest
70+
mkdir ./build
71+
docker cp rtk_everywhere:/RTK_Everywhere.ino.bin ./build
72+
docker cp rtk_everywhere:/RTK_Everywhere.ino.elf ./build
73+
docker cp rtk_everywhere:/RTK_Everywhere/form.h ./RTK_Everywhere
74+
docker container rm rtk_everywhere
14175
14276
- name: Commit and push form.h
143-
uses: actions-js/push@master
144-
with:
145-
github_token: ${{ secrets.GITHUB_TOKEN }}
146-
directory: ./Firmware/RTK_Everywhere
147-
branch: ${{ env.BRANCH }}
148-
message: 'Update form.h via Python'
149-
150-
- name: Copy custom RTKEverywhere.csv
151-
run:
152-
# Compile the source using the 16MB partition file. Other platforms (ie, the 8MB Postcard) use
153-
# the same binary but use a different partition binary during the upload phase.
154-
# View the different RTK partition files used during upload here:
155-
# https://github.com/sparkfun/SparkFun_RTK_Firmware_Uploader/tree/main/RTK_Firmware_Uploader/resource
156-
cp Firmware/RTKEverywhere.csv /home/runner/.arduino15/packages/esp32/hardware/esp32/${{ env.CORE_VERSION }}/tools/partitions/RTKEverywhere.csv
157-
158-
- name: Compile Sketch
159-
run: arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=${{ env.DEBUG_LEVEL }},PSRAM=enabled ./Firmware/RTK_Everywhere/RTK_Everywhere.ino
160-
--build-property build.partitions=RTKEverywhere
161-
--build-property upload.maximum_size=4055040
162-
--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\" \"-DPOINTPERFECT_RTCM_TOKEN=$POINTPERFECT_RTCM_TOKEN\" \"-DFIRMWARE_VERSION_MAJOR=$FIRMWARE_VERSION_MAJOR\" \"-DFIRMWARE_VERSION_MINOR=$FIRMWARE_VERSION_MINOR\" \"-DENABLE_DEVELOPER=${{ env.ENABLE_DEVELOPER }}\""
163-
--export-binaries
77+
run: |
78+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
79+
git config --local user.name "github-actions[bot]"
80+
git add ./Firmware/RTK_Everywhere/form.h
81+
git commit -m "Update form.h via Python"
82+
git push origin ${{ env.BRANCH }}
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16485

16586
- name: Rename binary
16687
run: |
167-
cd Firmware/RTK_Everywhere/build/esp32.esp32.esp32/
88+
cd ./Firmware/build
16889
mv RTK_Everywhere.ino.bin ${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
16990
17091
- name: Upload binary to action
17192
uses: actions/upload-artifact@v4
17293
with:
17394
name: ${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}
174-
path: ./Firmware/RTK_Everywhere/build/esp32.esp32.esp32/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
95+
path: ./Firmware/build/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
17596

17697

17798
- name: Push binary to Binaries Repo
@@ -180,7 +101,7 @@ jobs:
180101
env:
181102
API_TOKEN_GITHUB: ${{ secrets.PUSH_BINARIES_REPO }}
182103
with:
183-
source_file: ./Firmware/RTK_Everywhere/build/esp32.esp32.esp32/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
104+
source_file: ./Firmware/build/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
184105
destination_repo: 'sparkfun/SparkFun_RTK_Everywhere_Firmware_Binaries'
185106
destination_folder: ''
186107
user_email: '[email protected]'

.github/workflows/non-release-build.yml

Lines changed: 32 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ env:
77
FILENAME_PREFIX: RTK_Everywhere_Firmware
88
FIRMWARE_VERSION_MAJOR: 99
99
FIRMWARE_VERSION_MINOR: 99
10-
POINTPERFECT_LBAND_TOKEN: ${{ secrets.POINTPERFECT_LBAND_TOKEN }}
11-
POINTPERFECT_IP_TOKEN: ${{ secrets.POINTPERFECT_IP_TOKEN }}
12-
POINTPERFECT_LBAND_IP_TOKEN: ${{ secrets.POINTPERFECT_LBAND_IP_TOKEN }}
13-
POINTPERFECT_RTCM_TOKEN: ${{ secrets.POINTPERFECT_RTCM_TOKEN }}
1410
CORE_VERSION: 3.0.7
1511

1612
jobs:
@@ -54,124 +50,53 @@ jobs:
5450
echo "DEBUG_LEVEL=error" >> "$GITHUB_ENV"
5551
fi
5652
57-
- name: Setup Arduino CLI
58-
uses: arduino/setup-arduino-cli@v1
59-
60-
- name: Start config file
61-
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"
62-
63-
- name: Update core index
64-
run: arduino-cli core update-index
65-
66-
- name: Update library index
67-
run: arduino-cli lib update-index
68-
69-
- name: Install platform
70-
run: arduino-cli core install esp32:esp32@${{ env.CORE_VERSION }}
71-
72-
- name: Get IDF version
73-
run: |
74-
cd /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs
75-
IDF_VERSION=$(ls | grep idf-release)
76-
echo "ESP_IDF=${IDF_VERSION}" >> "$GITHUB_ENV"
77-
78-
- name: Get Known Libraries
79-
run: arduino-cli lib install
80-
81-
82-
83-
"ESP32-OTA-Pull"@1.0.0
84-
85-
86-
"SdFat"@2.1.1
87-
"SparkFun LIS2DH12 Arduino Library"@1.0.3
88-
"SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4
89-
"SparkFun u-blox GNSS v3"@3.1.10
90-
"SparkFun Qwiic OLED Arduino Library"@1.0.13
91-
92-
"SparkFun Extensible Message Parser"@1.0.4
93-
"SparkFun BQ40Z50 Battery Manager Arduino Library"@1.0.0
94-
"ArduinoMqttClient"@0.1.8
95-
"SparkFun u-blox PointPerfect Library"@1.11.4
96-
"SparkFun IM19 IMU Arduino Library"@1.0.1
97-
"SparkFun UM980 Triband RTK GNSS Arduino Library"@1.0.5
98-
"SparkFun LG290P Quadband RTK GNSS Arduino Library"@1.0.8
99-
"SparkFun I2C Expander Arduino Library"@1.0.1
100-
"SparkFun Apple Accessory Arduino Library"@3.0.9
101-
"SparkFun Authentication Coprocessor Arduino Library"@1.0.0
102-
"SparkFun Toolkit"@1.0.6
103-
104-
- name: Patch libmbedtls
105-
run: |
106-
cd Firmware/RTK_Everywhere/Patch/
107-
cp libmbedtls.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedtls.a
108-
cp libmbedtls_2.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedtls_2.a
109-
cp libmbedcrypto.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedcrypto.a
110-
cp libmbedx509.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libmbedx509.a
111-
112-
- name: Patch NetworkEvents
113-
run: |
114-
cd Firmware/RTK_Everywhere/Patch/
115-
cp NetworkEvents.* /home/runner/.arduino15/packages/esp32/hardware/esp32/${{ env.CORE_VERSION }}/libraries/Network/src/
116-
117-
- name: Patch libbt
53+
- name: Run Dockerfile and copy files
54+
# The --quiet suppresses the build output, keeping the secrets safe
11855
run: |
119-
cd Firmware/RTK_Everywhere/Patch/
120-
cp libbt.a /home/runner/.arduino15/packages/esp32/tools/esp32-arduino-libs/${{ env.ESP_IDF }}/esp32/lib/libbt.a
121-
122-
- name: Setup Python
123-
uses: actions/setup-python@v4
124-
with:
125-
python-version: '3.10'
126-
127-
# Configure Python - now we have Python installed, we need to provide everything needed by esptool otherwise the compile fails
128-
- name: Configure Python
129-
run: |
130-
pip3 install pyserial
131-
132-
- name: Update index_html
133-
run: |
134-
cd Firmware/Tools
135-
python index_html_zipper.py ../RTK_Everywhere/AP-Config/index.html ../RTK_Everywhere/form.h
136-
137-
- name: Update main_js
138-
run: |
139-
cd Firmware/Tools
140-
python main_js_zipper.py ../RTK_Everywhere/AP-Config/src/main.js ../RTK_Everywhere/form.h
56+
cd ./Firmware
57+
echo "*** The docker build is quiet to protect the GitHub secrets ***"
58+
docker build -t rtk_everywhere_firmware --no-cache --quiet \
59+
--build-arg CORE_VERSION=${{ env.CORE_VERSION }} \
60+
--build-arg FIRMWARE_VERSION_MAJOR=${{ env.FIRMWARE_VERSION_MAJOR }} \
61+
--build-arg FIRMWARE_VERSION_MINOR=${{ env.FIRMWARE_VERSION_MINOR }} \
62+
--build-arg POINTPERFECT_LBAND_TOKEN="${{ secrets.POINTPERFECT_LBAND_TOKEN }}" \
63+
--build-arg POINTPERFECT_IP_TOKEN="${{ secrets.POINTPERFECT_IP_TOKEN }}" \
64+
--build-arg POINTPERFECT_LBAND_IP_TOKEN="${{ secrets.POINTPERFECT_LBAND_IP_TOKEN }}" \
65+
--build-arg POINTPERFECT_RTCM_TOKEN="${{ secrets.POINTPERFECT_RTCM_TOKEN }}" \
66+
--build-arg ENABLE_DEVELOPER=${{ env.ENABLE_DEVELOPER }} \
67+
--build-arg DEBUG_LEVEL=${{ env.DEBUG_LEVEL }} \
68+
.
69+
docker create --name=rtk_everywhere rtk_everywhere_firmware:latest
70+
mkdir ./build
71+
docker cp rtk_everywhere:/RTK_Everywhere.ino.bin ./build
72+
docker cp rtk_everywhere:/RTK_Everywhere.ino.elf ./build
73+
docker cp rtk_everywhere:/RTK_Everywhere/form.h ./RTK_Everywhere
74+
docker container rm rtk_everywhere
14175
14276
- name: Commit and push form.h
143-
uses: actions-js/push@master
144-
with:
145-
github_token: ${{ secrets.GITHUB_TOKEN }}
146-
directory: ./Firmware/RTK_Everywhere
147-
branch: ${{ env.BRANCH }}
148-
message: 'Update form.h via Python'
149-
150-
- name: Copy custom RTKEverywhere.csv
151-
run:
152-
# Use the 16MB partitions by default. 8MB (Postcard) partitions must be compiled separately
153-
cp Firmware/RTKEverywhere.csv /home/runner/.arduino15/packages/esp32/hardware/esp32/${{ env.CORE_VERSION }}/tools/partitions/RTKEverywhere.csv
154-
155-
- name: Compile Sketch
156-
run: arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=${{ env.DEBUG_LEVEL }},PSRAM=enabled ./Firmware/RTK_Everywhere/RTK_Everywhere.ino
157-
--build-property build.partitions=RTKEverywhere
158-
--build-property upload.maximum_size=4055040
159-
--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\" \"-DPOINTPERFECT_RTCM_TOKEN=$POINTPERFECT_RTCM_TOKEN\" \"-DFIRMWARE_VERSION_MAJOR=$FIRMWARE_VERSION_MAJOR\" \"-DFIRMWARE_VERSION_MINOR=$FIRMWARE_VERSION_MINOR\" \"-DENABLE_DEVELOPER=${{ env.ENABLE_DEVELOPER }}\""
160-
--export-binaries
77+
run: |
78+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
79+
git config --local user.name "github-actions[bot]"
80+
git add ./Firmware/RTK_Everywhere/form.h
81+
git commit -m "Update form.h via Python"
82+
git push origin ${{ env.BRANCH }}
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16185

16286
- name: Create artifact name
16387
run: |
16488
echo "ARTIFACT=${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}" >> $GITHUB_ENV
16589
16690
- name: Create artifact directory
16791
run: |
168-
cd Firmware/RTK_Everywhere/build/esp32.esp32.esp32/
92+
cd ./Firmware/build
16993
mkdir ${{ env.ARTIFACT }}
17094
mv RTK_Everywhere.ino.bin ${{ env.ARTIFACT }}
95+
mv RTK_Everywhere.ino.elf ${{ env.ARTIFACT }}
17196
17297
- name: Upload artifact directory to action - avoid double-zip
17398
uses: actions/upload-artifact@v4
17499
with:
175100
name: ${{ env.ARTIFACT }}
176-
path: Firmware/RTK_Everywhere/build/esp32.esp32.esp32/${{ env.ARTIFACT }}
101+
path: ./Firmware/build/${{ env.ARTIFACT }}
177102
retention-days: 7

0 commit comments

Comments
 (0)