Skip to content

Commit 0005680

Browse files
committed
Update Dockerfile. Workflow uses Dockerfile
1 parent ca8d37e commit 0005680

File tree

6 files changed

+121
-154
lines changed

6 files changed

+121
-154
lines changed

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

Lines changed: 9 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -29,83 +29,20 @@ jobs:
2929
- name: Get firmware version 2
3030
run: echo "firmwareMajorMinor=-V10-v${{ env.firmwareMajor }}${{ env.firmwareMinor }}" >> "$GITHUB_ENV"
3131

32-
- name: Setup Arduino CLI
33-
uses: arduino/setup-arduino-cli@v1
34-
35-
- name: Start config file
36-
run: arduino-cli config init --additional-urls "https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/main/package_sparkfun_apollo3_index.json"
37-
38-
- name: Update index
39-
run: arduino-cli core update-index
40-
41-
- name: Install platform
42-
run: arduino-cli core install "Sparkfun:[email protected]"
43-
44-
- name: Get Known Libraries
45-
run: arduino-cli lib install
46-
47-
"SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library"
48-
"SparkFun I2C Mux Arduino Library"
49-
"SparkFun CCS811 Arduino Library"
50-
"SparkFun VL53L1X 4m Laser Distance Sensor"
51-
"SparkFun BME280"
52-
"SparkFun LPS25HB Pressure Sensor Library"
53-
"SparkFun VEML6075 Arduino Library"
54-
"SparkFun PHT MS8607 Arduino Library"
55-
"SparkFun MCP9600 Thermocouple Library"
56-
"SparkFun SGP30 Arduino Library"
57-
"SparkFun VCNL4040 Proximity Sensor Library"
58-
"SparkFun MS5637 Barometric Pressure Library"
59-
"SparkFun High Precision Temperature Sensor TMP117 Qwiic"
60-
"SparkFun u-blox GNSS Arduino Library"
61-
"SparkFun 6DoF ISM330DHCX"
62-
"SparkFun Qwiic Scale NAU7802 Arduino Library"
63-
"SparkFun SCD30 Arduino Library"
64-
"SparkFun Qwiic Humidity AHT20"
65-
"SparkFun SHTC3 Humidity and Temperature Sensor Library"
66-
"SparkFun ADS122C04 ADC Arduino Library"
67-
"SparkFun MicroPressure Library"
68-
"SparkFun Particle Sensor Panasonic SN-GCJA5"
69-
"SparkFun SGP40 Arduino Library"
70-
"SparkFun Qwiic Button and Qwiic Switch Library"
71-
"SparkFun Bio Sensor Hub Library"
72-
"SparkFun MMC5983MA Magnetometer Arduino Library"
73-
"SparkFun ADS1015 Arduino Library"
74-
"SparkFun KX13X Arduino Library"
75-
"SparkFun SDP3x Arduino Library"
76-
"SparkFun LPS28DFW Arduino Library"
77-
"SparkFun VEML7700 Arduino Library"
78-
"SparkFun TMP102 Breakout"
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: Enable ICM20948 DMP
88-
run: sed -i 's|//#define ICM_20948_USE_DMP|#define ICM_20948_USE_DMP|g' /home/runner/Arduino/libraries/SparkFun_9DoF_IMU_Breakout_-_ICM_20948_-_Arduino_Library/src/util/ICM_20948_C.h
89-
90-
- name: Patch Apollo3 Core
32+
- name: Run Dockerfile and copy files
9133
run: |
92-
cd ./Extras
93-
unzip UartPower3.zip
94-
cp HardwareSerial.h /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-extend/HardwareSerial.h
95-
cp HardwareSerial.cpp /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-implement/HardwareSerial.cpp
96-
cp UnbufferedSerial.h /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/mbed-os/drivers/UnbufferedSerial.h
97-
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
98-
cp libmbed-os.a /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/variants/SFE_ARTEMIS_ATP/mbed/libmbed-os.a
99-
cp SPI.cpp /home/runner/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/libraries/SPI/src/SPI.cpp
100-
101-
- name: Compile Sketch
102-
run: arduino-cli compile -v -e -b SparkFun:apollo3:sfe_artemis_atp ./Firmware/${{ env.FILENAME_PREFIX }}/${{ env.FILENAME_PREFIX }}.ino
34+
cd ./Firmware
35+
docker build -t openlog_artemis_image --no-cache .
36+
docker create --name=openlog_artemis_container openlog_artemis_image:latest
37+
mkdir ./build
38+
docker cp openlog_artemis_container:/${{ env.FILENAME_PREFIX }}.ino.bin ./build
39+
docker container rm openlog_artemis_container
10340
10441
- name: Rename binary
10542
run: |
106-
cd ./Firmware/${{ env.FILENAME_PREFIX }}/build/SparkFun.apollo3.sfe_artemis_atp/
43+
cd ./Firmware/build
10744
mv ${{ env.FILENAME_PREFIX }}.ino.bin ${{ env.FILENAME_PREFIX }}${{ env.firmwareMajorMinor }}.bin
108-
echo "targetBinary=./Firmware/${{ env.FILENAME_PREFIX }}/build/SparkFun.apollo3.sfe_artemis_atp/${{ env.FILENAME_PREFIX }}${{ env.firmwareMajorMinor }}.bin" >> "$GITHUB_ENV"
45+
echo "targetBinary=./Firmware/build/${{ env.FILENAME_PREFIX }}${{ env.firmwareMajorMinor }}.bin" >> "$GITHUB_ENV"
10946
11047
- name: Upload binary to action
11148
uses: actions/upload-artifact@v4

Dockerfile

Lines changed: 0 additions & 82 deletions
This file was deleted.

Firmware/Dockerfile

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
FROM ubuntu:latest AS upstream
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
5+
# Get curl, git and unzip
6+
RUN apt-get update \
7+
&& apt-get install -y curl git unzip \
8+
&& apt-get clean \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
# Setup Arduino CLI
12+
#RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh
13+
RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
14+
15+
# Start config file
16+
RUN arduino-cli config init --additional-urls https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/main/package_sparkfun_apollo3_index.json
17+
18+
# Update core index
19+
RUN arduino-cli core update-index
20+
21+
# Update library index
22+
RUN arduino-cli lib update-index
23+
24+
# Install core
25+
RUN arduino-cli core install "Sparkfun:[email protected]"
26+
27+
# Get known libraries
28+
# RUN arduino-cli lib install "SparkFun Qwiic Power Switch Arduino Library"
29+
RUN arduino-cli lib install "SdFat"@2.2.2
30+
RUN arduino-cli lib install "SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library"@1.3.0
31+
RUN arduino-cli lib install "SparkFun I2C Mux Arduino Library"@1.0.3
32+
RUN arduino-cli lib install "SparkFun CCS811 Arduino Library"@2.0.3
33+
RUN arduino-cli lib install "SparkFun VL53L1X 4m Laser Distance Sensor"@1.2.12
34+
RUN arduino-cli lib install "SparkFun BME280"@2.0.11
35+
RUN arduino-cli lib install "SparkFun LPS25HB Pressure Sensor Library"@1.1.1
36+
RUN arduino-cli lib install "SparkFun VEML6075 Arduino Library"@1.1.5
37+
RUN arduino-cli lib install "SparkFun PHT MS8607 Arduino Library"@1.0.5
38+
RUN arduino-cli lib install "SparkFun MCP9600 Thermocouple Library"@1.0.5
39+
RUN arduino-cli lib install "SparkFun SGP30 Arduino Library"@1.0.5
40+
RUN arduino-cli lib install "SparkFun VCNL4040 Proximity Sensor Library"@1.0.4
41+
RUN arduino-cli lib install "SparkFun MS5637 Barometric Pressure Library"@1.0.2
42+
RUN arduino-cli lib install "SparkFun High Precision Temperature Sensor TMP117 Qwiic"@1.2.5
43+
RUN arduino-cli lib install "SparkFun u-blox GNSS Arduino Library"@2.2.26
44+
RUN arduino-cli lib install "SparkFun 6DoF ISM330DHCX"@1.0.6
45+
RUN arduino-cli lib install "SparkFun Qwiic Scale NAU7802 Arduino Library"@1.0.6
46+
RUN arduino-cli lib install "SparkFun SCD30 Arduino Library"@1.0.20
47+
RUN arduino-cli lib install "SparkFun Qwiic Humidity AHT20"@1.0.3
48+
RUN arduino-cli lib install "SparkFun SHTC3 Humidity and Temperature Sensor Library"@1.1.4
49+
RUN arduino-cli lib install "SparkFun ADS122C04 ADC Arduino Library"@1.0.4
50+
RUN arduino-cli lib install "SparkFun MicroPressure Library"@1.0.1
51+
RUN arduino-cli lib install "SparkFun Particle Sensor Panasonic SN-GCJA5"@1.0.1
52+
RUN arduino-cli lib install "SparkFun SGP40 Arduino Library"@1.0.4
53+
RUN arduino-cli lib install "SparkFun Qwiic Button and Qwiic Switch Library"@2.0.6
54+
RUN arduino-cli lib install "SparkFun Bio Sensor Hub Library"@1.0.6
55+
RUN arduino-cli lib install "SparkFun MMC5983MA Magnetometer Arduino Library"@1.1.4
56+
RUN arduino-cli lib install "SparkFun ADS1015 Arduino Library"@2.3.2
57+
RUN arduino-cli lib install "SparkFun KX13X Arduino Library"@2.0.4
58+
RUN arduino-cli lib install "SparkFun SDP3x Arduino Library"@1.0.4
59+
RUN arduino-cli lib install "SparkFun LPS28DFW Arduino Library"@1.0.0
60+
RUN arduino-cli lib install "SparkFun VEML7700 Arduino Library"@1.0.0
61+
RUN arduino-cli lib install "SparkFun TMP102 Breakout"@1.1.2
62+
63+
# Enable external libs
64+
RUN arduino-cli config set library.enable_unsafe_install true
65+
66+
# Add BlueRobotics_MS5837_Library from git
67+
RUN arduino-cli lib install --git-url https://github.com/bluerobotics/BlueRobotics_MS5837_Library.git
68+
69+
# Deploy
70+
FROM upstream AS deployment
71+
72+
# Add the source files
73+
ADD . .
74+
75+
# Patch Apollo Core
76+
RUN cd ./Extras \
77+
&& unzip UartPower3.zip \
78+
&& cp HardwareSerial.h /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-extend/HardwareSerial.h \
79+
&& cp HardwareSerial.cpp /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/arduino/mbed-bridge/core-implement/HardwareSerial.cpp \
80+
&& cp UnbufferedSerial.h /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/mbed-os/drivers/UnbufferedSerial.h \
81+
&& cp serial_api.c /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/cores/mbed-os/targets/TARGET_Ambiq_Micro/TARGET_Apollo3/device/serial_api.c \
82+
&& cp libmbed-os.a /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/variants/SFE_ARTEMIS_ATP/mbed/libmbed-os.a \
83+
&& cp SPI.cpp /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/libraries/SPI/src/SPI.cpp
84+
85+
# Enable DMP on ICM 20948
86+
RUN sed -i 's|//#define ICM|#define ICM|g' /root/Arduino/libraries/SparkFun_9DoF_IMU_Breakout_-_ICM_20948_-_Arduino_Library/src/util/ICM_20948_C.h
87+
88+
# Enable debug symbols
89+
# echo "compiler.c.extra_flags=-MMD -g3" >> /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/platform.local.txt
90+
# echo "compiler.cxx.extra_flags=-MMD -g3" >> /root/.arduino15/packages/SparkFun/hardware/apollo3/2.2.1/platform.local.txt
91+
92+
# Disable Power Loss Protection
93+
RUN cd ./OpenLog_Artemis \
94+
&& sed -i 's|#define noPowerLossProtection|//#define noPowerLossProtection|g' OpenLog_Artemis.ino
95+
96+
# X04 Hardware
97+
RUN cd ./OpenLog_Artemis \
98+
&& sed -i 's|#define HARDWARE_VERSION_MAJOR 1|#define HARDWARE_VERSION_MAJOR 0|g' OpenLog_Artemis.ino \
99+
&& sed -i 's|#define HARDWARE_VERSION_MINOR 0|#define HARDWARE_VERSION_MINOR 4|g' OpenLog_Artemis.ino
100+
101+
# Compile
102+
RUN cd ./OpenLog_Artemis \
103+
&& arduino-cli compile -v -e -b SparkFun:apollo3:sfe_artemis_atp OpenLog_Artemis.ino
104+
105+
# Copy the compile output. List the files
106+
FROM deployment AS output
107+
COPY --from=deployment ./OpenLog_Artemis/build/SparkFun.apollo3.sfe_artemis_atp /
108+
CMD echo $(ls /*.*)
File renamed without changes.
File renamed without changes.

Firmware/compile_with_docker.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
docker build -t openlog_artemis_firmware --progress=plain --no-cache-filter deployment .
2+
docker create --name=openlog_artemis_container openlog_artemis_firmware:latest
3+
docker cp openlog_artemis_container:/OpenLog_Artemis.ino.bin .
4+
docker container rm openlog_artemis_container

0 commit comments

Comments
 (0)