Skip to content

Commit ea90a28

Browse files
authored
Add platformIO in all projects. Modify actions to compile with pio (#14)
* Add platformIO in all projects. Modify actions to compile with pio * Spanish to english comments
1 parent 8b74f6a commit ea90a28

5 files changed

Lines changed: 70 additions & 80 deletions

File tree

.github/workflows/build.yaml

Lines changed: 37 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,50 @@
1-
# This is the name of the workflow, visible on GitHub UI.
21
name: build
32

4-
# Here we tell GitHub to run the workflow when a commit
5-
# is pushed or a Pull Request is opened.
63
on: [push, pull_request]
74

8-
# This is the list of jobs that will be run concurrently.
9-
# Since we use a build matrix, the actual number of jobs
10-
# started depends on how many configurations the matrix
11-
# will produce.
125
jobs:
13-
# This is the name of the job - can be whatever.
146
build:
15-
16-
# Here we tell GitHub that the jobs must be determined
17-
# dynamically depending on a matrix configuration.
187
strategy:
198
matrix:
20-
# The matrix will produce one job for each configuration
21-
# parameter of type `arduino-platform`, in this case a
22-
# total of 2.
23-
arduino-platform: ["arduino:avr","esp8266:esp8266"]
24-
# This is usually optional but we need to statically define the
25-
# FQBN of the boards we want to test for each platform. In the
26-
# future the CLI might automatically detect and download the core
27-
# needed to compile against a certain FQBN, at that point the
28-
# following `include` section will be useless.
29-
include:
30-
# This works like this: when the platform is "arduino:samd", the
31-
# variable `fqbn` is set to "arduino:samd:nano_33_iot".
32-
- arduino-platform: "arduino:avr"
33-
fqbn: "arduino:avr:pro:cpu=8MHzatmega328"
34-
- arduino-platform: "arduino:avr"
35-
libraries: "LowPower_LowPowerLab"
36-
- arduino-platform: "arduino:avr"
37-
project_dir: "Firmware_Arduino"
38-
39-
- arduino-platform: "esp8266:esp8266"
40-
fqbn: "esp8266:esp8266:generic"
41-
- arduino-platform: "esp8266:esp8266"
42-
libraries: "LiquidCrystal_PCF8574"
43-
- arduino-platform: "esp8266:esp8266"
44-
project_dir: "Firmware_ESP8266"
45-
46-
# This is the platform GitHub will use to run our workflow, we
47-
# pick Windows for no particular reason.
48-
runs-on: windows-latest
9+
project_dir: ["Firmware_Arduino", "Firmware_ESP8266"]
10+
runs-on: ubuntu-latest
4911

50-
# This is the list of steps this job will run.
5112
steps:
52-
# First of all, we clone the repo using the `checkout` action.
5313
- name: Checkout
5414
uses: actions/checkout@v4
55-
56-
# We use the `arduino/setup-arduino-cli` action to install and
57-
# configure the Arduino CLI on the system.
58-
- name: Setup Arduino CLI
59-
uses: arduino/setup-arduino-cli@v1
60-
61-
# We then install the platform, which one will be determined
62-
# dynamically by the build matrix.
63-
- name: Install platform
15+
with:
16+
submodules: recursive
17+
18+
- name: Setup Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.x"
22+
23+
- name: Cache PlatformIO
24+
uses: actions/cache@v4
25+
with:
26+
path: ~/.platformio
27+
key: pio-${{ runner.os }}-${{ hashFiles(format('{0}/platformio.ini', matrix.project_dir)) }}
28+
restore-keys: |
29+
pio-${{ runner.os }}-
30+
31+
- name: Install PlatformIO Core
32+
run: pip install -U platformio
33+
34+
# Builds all environments defined in platformio.ini; use -e for environment matrix
35+
- name: Build ${{ matrix.project_dir }}
36+
working-directory: ${{ matrix.project_dir }}
6437
run: |
65-
arduino-cli core update-index --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
66-
arduino-cli core install ${{ matrix.arduino-platform }} --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json
67-
68-
# We then install the platform, which one will be determined
69-
# dynamically by the build matrix.
70-
- name: Install libraries
71-
run: |
72-
arduino-cli lib install ${{ matrix.libraries }}
73-
arduino-cli lib list
74-
75-
# Update submodules
76-
- name: Update submodules
77-
run: |
78-
git submodule update --init --recursive
79-
80-
# Finally, we compile the sketch, using the FQBN that was set
81-
# in the build matrix.
82-
- name: Compile Sketches
83-
run: arduino-cli compile --fqbn ${{ matrix.fqbn }} --build-path "${{ matrix.project_dir }}/build" ./${{ matrix.project_dir }}
38+
pio run
39+
# If defining environment matrix: pio run -e ${{ matrix.env }}
40+
41+
# Upload generated artifacts; hex for AVR; bin for ESP8266
42+
- name: Upload artifacts
43+
if: always()
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: ${{ matrix.project_dir }}-artifacts
47+
path: |
48+
${{ matrix.project_dir }}/.pio/build/*/*.hex
49+
${{ matrix.project_dir }}/.pio/build/*/*.bin
50+
${{ matrix.project_dir }}/.pio/build/*/*.elf

Firmware_Arduino/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.pio
2+
.vscode/.browse.c_cpp.db*
3+
.vscode/c_cpp_properties.json
4+
.vscode/launch.json
5+
.vscode/ipch

Firmware_Arduino/platformio.ini

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[platformio]
2+
src_dir = .
3+
4+
[env:promini_8mhz]
5+
platform = atmelavr
6+
board = pro8MHzatmega328
7+
framework = arduino
8+
upload_protocol = arduino
9+
10+
build_src_filter =
11+
+<**/*.ino>
12+
+<**/*.cpp>
13+
-<**/*.c>
14+
15+
lib_deps =
16+
rocketscream/Low-Power @ ^1.6.0

Firmware_ESP8266/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.pio
2+
.vscode/.browse.c_cpp.db*
3+
.vscode/c_cpp_properties.json
4+
.vscode/launch.json
5+
.vscode/ipch
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
[platformio]
2-
default_envs = esp8266
3-
src_dir = Firmware_ESP8266
2+
src_dir = .
43

54
[env:esp8266]
65
platform = espressif8266
7-
board = esp12e ; generic ESP8266 module
6+
board = esp12e
87
framework = arduino
98
board_build.flash_size = 4M1M
109
board_build.flash_mode = dout
1110
board_build.f_cpu = 80000000L
1211
board_build.f_flash = 40000000L
13-
1412
upload_protocol = espota
1513
upload_port = RollerShutterControlPanel.local
1614
upload_resetmethod = ck
1715
upload_speed = 3000000
18-
1916
check_tool = cppcheck
20-
check_skip_packages = yes ; don’t scan framework/toolchain headers :contentReference[oaicite:0]{index=0}
17+
check_skip_packages = yes
2118

2219
build_src_filter =
23-
+<*.ino>
24-
+<*.cpp>
25-
-<*.c>
20+
+<**/*.ino>
21+
+<**/*.cpp>
22+
-<**/*.c>
2623

2724
lib_deps =
2825
https://github.com/arduino-libraries/NTPClient.git#3.2.0
29-
https://github.com/mathertel/LiquidCrystal_PCF8574.git#2.2.0
26+
https://github.com/mathertel/LiquidCrystal_PCF8574.git#2.2.0

0 commit comments

Comments
 (0)