Skip to content

Commit 58235dd

Browse files
authored
Merge pull request #802 from sparkfun/release_candidate
Update workflows to use Dockerfile
2 parents a191032 + c9ee62e commit 58235dd

File tree

5 files changed

+986
-1115
lines changed

5 files changed

+986
-1115
lines changed

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

Lines changed: 30 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ on:
66
env:
77
FILENAME_PREFIX: RTK_Surveyor_Firmware
88
FIRMWARE_VERSION_MAJOR: 4
9-
FIRMWARE_VERSION_MINOR: 3
10-
POINTPERFECT_TOKEN: ${{ secrets.POINTPERFECT_TOKEN }}
9+
FIRMWARE_VERSION_MINOR: 4
1110
#We limit the ESP32 core to v2.0.2
1211
CORE_VERSION: 2.0.2
1312

@@ -52,114 +51,54 @@ jobs:
5251
echo "DEBUG_LEVEL=debug" >> "$GITHUB_ENV"
5352
fi
5453
55-
- name: Setup Arduino CLI
56-
uses: arduino/setup-arduino-cli@v1
57-
58-
- name: Start config file
59-
run: arduino-cli config init --additional-urls "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json"
60-
61-
- name: Update index
62-
run: arduino-cli core update-index
63-
64-
- name: Install platform
65-
run: arduino-cli core install esp32:esp32@${{ env.CORE_VERSION }}
66-
67-
- name: Get Known Libraries
68-
run: arduino-cli lib install
69-
70-
71-
72-
"ESP32-OTA-Pull"@1.0.0
73-
74-
75-
76-
"SdFat"@2.1.1
77-
"SparkFun LIS2DH12 Arduino Library"@1.0.3
78-
"SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4
79-
"SparkFun u-blox GNSS v3"@3.0.14
80-
81-
82-
83-
- name: Enable external libs
84-
run: arduino-cli config set library.enable_unsafe_install true
85-
86-
- name: Get Libraries
87-
run: arduino-cli lib install --git-url
88-
https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library.git
89-
https://github.com/me-no-dev/ESPAsyncWebServer.git
90-
https://github.com/me-no-dev/AsyncTCP.git
91-
92-
#Incorporate ESP-Now patch into core: https://github.com/espressif/arduino-esp32/pull/7044/files
93-
#- name: Patch ESP32 Core
94-
# run: |
95-
# cd Firmware/RTK_Surveyor/Patch/
96-
# cp WiFiGeneric.cpp /home/runner/.arduino15/packages/esp32/hardware/esp32/${{ env.CORE_VERSION }}/libraries/WiFi/src/WiFiGeneric.cpp
97-
98-
#Patch Server.h to avoid https://github.com/arduino-libraries/Ethernet/issues/88#issuecomment-455498941
99-
#Note: this patch can be removed if/when we upgrade to ESP32 core >= v2.0.6
100-
- name: Patch ESP32 Server.h for Ethernet
101-
run: |
102-
cd Firmware/RTK_Surveyor/Patch/
103-
cp Server.h /home/runner/.arduino15/packages/esp32/hardware/esp32/${{ env.CORE_VERSION }}/cores/esp32/Server.h
104-
105-
- name: Setup Python
106-
uses: actions/setup-python@v4
107-
with:
108-
python-version: '3.10'
109-
110-
# Configure Python - now we have Python installed, we need to provide everything needed by esptool otherwise the compile fails
111-
- name: Configure Python
54+
- name: Run Dockerfile and copy files
55+
# The --quiet suppresses the build output, keeping the secrets safe
11256
run: |
113-
pip3 install pyserial
114-
115-
- name: Update index_html
116-
run: |
117-
cd Firmware/Tools
118-
python index_html_zipper.py ../RTK_Surveyor/AP-Config/index.html ../RTK_Surveyor/form.h
119-
120-
- name: Update main_js
121-
run: |
122-
cd Firmware/Tools
123-
python main_js_zipper.py ../RTK_Surveyor/AP-Config/src/main.js ../RTK_Surveyor/form.h
57+
cd ./Firmware
58+
echo "*** The docker build is quiet to protect the GitHub secrets ***"
59+
docker build -t rtk_firmware --no-cache --quiet \
60+
--build-arg CORE_VERSION=${{ env.CORE_VERSION }} \
61+
--build-arg FIRMWARE_VERSION_MAJOR=${{ env.FIRMWARE_VERSION_MAJOR }} \
62+
--build-arg FIRMWARE_VERSION_MINOR=${{ env.FIRMWARE_VERSION_MINOR }} \
63+
--build-arg POINTPERFECT_TOKEN="${{ secrets.POINTPERFECT_TOKEN }}" \
64+
--build-arg ENABLE_DEVELOPER=${{ env.ENABLE_DEVELOPER }} \
65+
--build-arg DEBUG_LEVEL=${{ env.DEBUG_LEVEL }} \
66+
.
67+
docker create --name=rtk_container rtk_firmware:latest
68+
mkdir ./build
69+
docker cp rtk_container:/RTK_Surveyor.ino.bin ./build
70+
docker cp rtk_container:/RTK_Surveyor.ino.elf ./build
71+
docker cp rtk_container:/RTK_Surveyor/form.h ./RTK_Surveyor
72+
docker container rm rtk_container
12473
12574
- name: Commit and push form.h
126-
uses: actions-js/push@master
127-
with:
128-
github_token: ${{ secrets.GITHUB_TOKEN }}
129-
directory: ./Firmware/RTK_Surveyor
130-
branch: ${{ env.BRANCH }}
131-
message: 'Update form.h via Python'
132-
133-
- name: Copy custom app3M_fat9M_16MB.csv
134-
run:
135-
cp Firmware/app3M_fat9M_16MB.csv /home/runner/.arduino15/packages/esp32/hardware/esp32/${{ env.CORE_VERSION }}/tools/partitions/app3M_fat9M_16MB.csv
136-
137-
- name: Compile Sketch
138-
run: arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=${{ env.DEBUG_LEVEL }} ./Firmware/RTK_Surveyor/RTK_Surveyor.ino
139-
--build-property build.partitions=app3M_fat9M_16MB
140-
--build-property upload.maximum_size=3145728
141-
--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 }}\""
142-
--export-binaries
75+
run: |
76+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
77+
git config --local user.name "github-actions[bot]"
78+
git add ./Firmware/RTK_Surveyor/form.h
79+
git commit -m "Update form.h via Python"
80+
git push origin ${{ env.BRANCH }}
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14383

14484
- name: Rename binary
14585
run: |
146-
cd Firmware/RTK_Surveyor/build/esp32.esp32.esp32/
86+
cd ./Firmware/build/
14787
mv RTK_Surveyor.ino.bin ${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
14888
14989
- name: Upload binary to action
15090
uses: actions/upload-artifact@v4
15191
with:
15292
name: ${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}
153-
path: ./Firmware/RTK_Surveyor/build/esp32.esp32.esp32/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
154-
93+
path: ./Firmware/build/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
15594

15695
- name: Push binary to Binaries Repo
15796
# uses: dmnemec/copy_file_to_another_repo_action #Workaround for Issue: https://github.com/orgs/community/discussions/55820#discussioncomment-5946136
15897
uses: Jason2866/copy_file_to_another_repo_action@http408_fix
15998
env:
16099
API_TOKEN_GITHUB: ${{ secrets.API_GITHUB_RTK_FILE_TOKEN }}
161100
with:
162-
source_file: ./Firmware/RTK_Surveyor/build/esp32.esp32.esp32/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
101+
source_file: ./Firmware/build/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
163102
destination_repo: 'sparkfun/SparkFun_RTK_Firmware_Binaries'
164103
destination_folder: ''
165104
user_email: '[email protected]'
Lines changed: 29 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: RTK Firmware Non-Release Build
1+
name: Non-Release Build
22
on:
33
workflow_dispatch:
44
branches:
@@ -7,7 +7,6 @@ env:
77
FILENAME_PREFIX: RTK_Surveyor_Firmware
88
FIRMWARE_VERSION_MAJOR: 99
99
FIRMWARE_VERSION_MINOR: 99
10-
POINTPERFECT_TOKEN: ${{ secrets.POINTPERFECT_TOKEN }}
1110
#We limit the ESP32 core to v2.0.2
1211
CORE_VERSION: 2.0.2
1312

@@ -43,105 +42,43 @@ jobs:
4342
echo "ENABLE_DEVELOPER=true" >> "$GITHUB_ENV"
4443
echo "DEBUG_LEVEL=debug" >> "$GITHUB_ENV"
4544
46-
- name: Setup Arduino CLI
47-
uses: arduino/setup-arduino-cli@v1
48-
49-
- name: Start config file
50-
run: arduino-cli config init --additional-urls "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json"
51-
52-
- name: Update index
53-
run: arduino-cli core update-index
54-
55-
- name: Update library index
56-
run: arduino-cli lib update-index
57-
58-
- name: Install platform
59-
run: arduino-cli core install esp32:esp32@${{ env.CORE_VERSION }}
60-
61-
- name: Get Known Libraries
62-
run: arduino-cli lib install
63-
64-
65-
66-
"ESP32-OTA-Pull"@1.0.0
67-
68-
69-
70-
"SdFat"@2.1.1
71-
"SparkFun LIS2DH12 Arduino Library"@1.0.3
72-
"SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4
73-
"SparkFun u-blox GNSS v3"@3.0.14
74-
75-
76-
77-
- name: Enable external libs
78-
run: arduino-cli config set library.enable_unsafe_install true
79-
80-
- name: Get Libraries
81-
run: arduino-cli lib install --git-url
82-
https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library.git
83-
https://github.com/me-no-dev/ESPAsyncWebServer.git
84-
https://github.com/me-no-dev/AsyncTCP.git
85-
86-
#Incorporate ESP-Now patch into core: https://github.com/espressif/arduino-esp32/pull/7044/files
87-
#- name: Patch ESP32 Core
88-
# run: |
89-
# cd Firmware/RTK_Surveyor/Patch/
90-
# cp WiFiGeneric.cpp /home/runner/.arduino15/packages/esp32/hardware/esp32/${{ env.CORE_VERSION }}/libraries/WiFi/src/WiFiGeneric.cpp
91-
92-
#Patch Server.h to avoid https://github.com/arduino-libraries/Ethernet/issues/88#issuecomment-455498941
93-
#Note: this patch can be removed if/when we upgrade to ESP32 core >= v2.0.6
94-
- name: Patch ESP32 Server.h for Ethernet
95-
run: |
96-
cd Firmware/RTK_Surveyor/Patch/
97-
cp Server.h /home/runner/.arduino15/packages/esp32/hardware/esp32/${{ env.CORE_VERSION }}/cores/esp32/Server.h
98-
99-
- name: Setup Python
100-
uses: actions/setup-python@v4
101-
with:
102-
python-version: '3.10'
103-
104-
# Configure Python - now we have Python installed, we need to provide everything needed by esptool otherwise the compile fails
105-
- name: Configure Python
45+
- name: Run Dockerfile and copy files
46+
# The --quiet suppresses the build output, keeping the secrets safe
10647
run: |
107-
pip3 install pyserial
108-
109-
- name: Update index_html
110-
run: |
111-
cd Firmware/Tools
112-
python index_html_zipper.py ../RTK_Surveyor/AP-Config/index.html ../RTK_Surveyor/form.h
113-
114-
- name: Update main_js
115-
run: |
116-
cd Firmware/Tools
117-
python main_js_zipper.py ../RTK_Surveyor/AP-Config/src/main.js ../RTK_Surveyor/form.h
48+
cd ./Firmware
49+
echo "*** The docker build is quiet to protect the GitHub secrets ***"
50+
docker build -t rtk_firmware --no-cache --quiet \
51+
--build-arg CORE_VERSION=${{ env.CORE_VERSION }} \
52+
--build-arg FIRMWARE_VERSION_MAJOR=${{ env.FIRMWARE_VERSION_MAJOR }} \
53+
--build-arg FIRMWARE_VERSION_MINOR=${{ env.FIRMWARE_VERSION_MINOR }} \
54+
--build-arg POINTPERFECT_TOKEN="${{ secrets.POINTPERFECT_TOKEN }}" \
55+
--build-arg ENABLE_DEVELOPER=${{ env.ENABLE_DEVELOPER }} \
56+
--build-arg DEBUG_LEVEL=${{ env.DEBUG_LEVEL }} \
57+
.
58+
docker create --name=rtk_container rtk_firmware:latest
59+
mkdir ./build
60+
docker cp rtk_container:/RTK_Surveyor.ino.bin ./build
61+
docker cp rtk_container:/RTK_Surveyor.ino.elf ./build
62+
docker cp rtk_container:/RTK_Surveyor/form.h ./RTK_Surveyor
63+
docker container rm rtk_container
11864
11965
- name: Commit and push form.h
120-
uses: actions-js/push@master
121-
with:
122-
github_token: ${{ secrets.GITHUB_TOKEN }}
123-
directory: ./Firmware/RTK_Surveyor
124-
branch: ${{ env.BRANCH }}
125-
message: 'Update form.h via Python'
126-
127-
- name: Copy custom app3M_fat9M_16MB.csv
128-
run:
129-
cp Firmware/app3M_fat9M_16MB.csv /home/runner/.arduino15/packages/esp32/hardware/esp32/${{ env.CORE_VERSION }}/tools/partitions/app3M_fat9M_16MB.csv
130-
131-
- name: Compile Sketch
132-
run: arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=${{ env.DEBUG_LEVEL }} ./Firmware/RTK_Surveyor/RTK_Surveyor.ino
133-
--build-property build.partitions=app3M_fat9M_16MB
134-
--build-property upload.maximum_size=3145728
135-
--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 }}\""
136-
--export-binaries
66+
run: |
67+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
68+
git config --local user.name "github-actions[bot]"
69+
git add ./Firmware/RTK_Surveyor/form.h
70+
git commit -m "Update form.h via Python"
71+
git push origin ${{ env.BRANCH }}
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13774

13875
- name: Create artifact name
13976
run: |
14077
echo "ARTIFACT=${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}" >> $GITHUB_ENV
14178
14279
- name: Create artifact directory
14380
run: |
144-
cd Firmware/RTK_Surveyor/build/esp32.esp32.esp32/
81+
cd ./Firmware/build/
14582
mkdir ${{ env.ARTIFACT }}
14683
mv RTK_Surveyor.ino.bin ${{ env.ARTIFACT }}
14784
mv RTK_Surveyor.ino.elf ${{ env.ARTIFACT }}
@@ -150,5 +87,5 @@ jobs:
15087
uses: actions/upload-artifact@v4
15188
with:
15289
name: ${{ env.ARTIFACT }}
153-
path: Firmware/RTK_Surveyor/build/esp32.esp32.esp32/${{ env.ARTIFACT }}
90+
path: ./Firmware/build/${{ env.ARTIFACT }}
15491
retention-days: 7

Firmware/Dockerfile

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ FROM ubuntu:latest AS upstream
22

33
ARG DEBIAN_FRONTEND=noninteractive
44

5-
ENV FILENAME_PREFIX=RTK_Firmware
6-
ENV FIRMWARE_VERSION_MAJOR=99
7-
ENV FIRMWARE_VERSION_MINOR=99
8-
ENV CORE_VERSION=2.0.2
5+
ARG CORE_VERSION=2.0.2
6+
7+
ARG FIRMWARE_VERSION_MAJOR=99
8+
ARG FIRMWARE_VERSION_MINOR=99
99

1010
# ESP32 Core Debug Level
1111
# We use "none" for releases and "error" for release_candidate
1212
# You may find "verbose" useful while you are debugging your changes
13-
ENV DEBUG_LEVEL=error
13+
ARG DEBUG_LEVEL=error
1414

1515
# Developer Mode
1616
# You may find "true" useful while you are making changes
1717
# Set to false for releases
18-
ENV ENABLE_DEVELOPER=true
18+
ARG ENABLE_DEVELOPER=true
1919

2020
# If you have your own u-blox PointPerfect token, define it here
2121
# or pass it in as an arg when building the Dockerfile
@@ -75,45 +75,37 @@ RUN arduino-cli config set library.enable_unsafe_install true
7575
RUN arduino-cli lib install --git-url https://github.com/me-no-dev/ESPAsyncWebServer.git
7676
RUN arduino-cli lib install --git-url https://github.com/me-no-dev/AsyncTCP.git
7777

78-
# Copy RTK_Everywhere into /work and build deployment image
78+
# Copy RTK_Surveyor and build deployment image
7979
FROM upstream AS deployment
8080

81-
# Create work directory
82-
WORKDIR /work
81+
# Add the source files
8382
ADD . .
8483

85-
# Get current date
86-
#RUN echo "$(date +'%b_%d_%Y')" > date_scores.txt
87-
#RUN DATE_SCORES=$(cat date_scores.txt) && echo "Date: ${DATE_SCORES}"
88-
#RUN echo "$(date +'%b %d %Y')" > date_no_scores.txt
89-
#RUN DATE_NO_SCORES=$(cat date_no_scores.txt) && echo "Date: ${DATE_NO_SCORES}"
90-
9184
# Patch Server.h to avoid https://github.com/arduino-libraries/Ethernet/issues/88#issuecomment-455498941
92-
WORKDIR /work/RTK_Surveyor/Patch
93-
RUN cp Server.h "/root/.arduino15/packages/esp32/hardware/esp32/${CORE_VERSION}/cores/esp32/Server.h"
85+
RUN cd ./RTK_Surveyor/Patch \
86+
&& cp Server.h "/root/.arduino15/packages/esp32/hardware/esp32/${CORE_VERSION}/cores/esp32/Server.h"
9487

9588
# Update form.h with index_html and main_js
96-
WORKDIR /work/Tools
97-
RUN python index_html_zipper.py ../RTK_Surveyor/AP-Config/index.html ../RTK_Surveyor/form.h
98-
RUN python main_js_zipper.py ../RTK_Surveyor/AP-Config/src/main.js ../RTK_Surveyor/form.h
89+
RUN cd ./Tools \
90+
&& python index_html_zipper.py ../RTK_Surveyor/AP-Config/index.html ../RTK_Surveyor/form.h \
91+
&& python main_js_zipper.py ../RTK_Surveyor/AP-Config/src/main.js ../RTK_Surveyor/form.h
9992

10093
# Copy custom app3M_fat9M_16MB.csv
101-
WORKDIR /work
10294
RUN cp app3M_fat9M_16MB.csv "/root/.arduino15/packages/esp32/hardware/esp32/${CORE_VERSION}/tools/partitions/app3M_fat9M_16MB.csv"
10395

10496
# Compile Sketch
105-
WORKDIR /work/RTK_Surveyor
106-
RUN arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=${DEBUG_LEVEL} \
97+
RUN cd ./RTK_Surveyor \
98+
&& arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=${DEBUG_LEVEL} \
10799
./RTK_Surveyor.ino \
108100
--build-property build.partitions=app3M_fat9M_16MB \
109101
--build-property upload.maximum_size=3145728 \
110-
--build-property "compiler.cpp.extra_flags=\"-DPOINTPERFECTTOKEN=${POINTPERFECT_TOKEN}\" \
102+
--build-property "compiler.cpp.extra_flags=\"-DPOINTPERFECT_TOKEN=${POINTPERFECT_TOKEN}\" \
111103
\"-DFIRMWARE_VERSION_MAJOR=${FIRMWARE_VERSION_MAJOR}\" \
112104
\"-DFIRMWARE_VERSION_MINOR=${FIRMWARE_VERSION_MINOR}\" \
113105
\"-DENABLE_DEVELOPER=${ENABLE_DEVELOPER}\"" \
114106
--export-binaries
115107

116108
# Copy the compile output. List the files
117109
FROM deployment AS output
118-
COPY --from=deployment /work/RTK_Surveyor/build/esp32.esp32.esp32 /
110+
COPY --from=deployment ./RTK_Surveyor/build/esp32.esp32.esp32 /
119111
CMD echo $(ls /*.*)

0 commit comments

Comments
 (0)