Skip to content

Commit 21d22bd

Browse files
authored
Github Actions build MCU libs in parallel Jobs (#120)
1 parent ced3c13 commit 21d22bd

File tree

3 files changed

+53
-62
lines changed

3 files changed

+53
-62
lines changed

.github/workflows/parallel_build.yaml

Lines changed: 29 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
jobs:
77
build-libs:
88
name: Build Libs for ${{ matrix.target }}
9-
runs-on: macos-14
9+
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
1212
target: [esp32, esp32s2, esp32s3, esp32c2, esp32c3, esp32c6, esp32h2, esp32p4]
@@ -23,16 +23,18 @@ jobs:
2323
run: |
2424
echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
2525
- name: Build Libs for ${{ matrix.target }}
26-
run: bash ./build.sh -e -t ${{ matrix.target }}
26+
run: |
27+
bash ./build.sh -e -t ${{ matrix.target }}
28+
mv release-info.txt out/framework-arduinoespressif32
2729
- name: Upload artifacts for ${{ matrix.target }}
2830
uses: actions/upload-artifact@v4
2931
with:
3032
name: artifacts-${{ matrix.target }}
31-
path: framework-arduinoespressif32
33+
path: out/framework-arduinoespressif32
3234

3335
build-slave_firmware:
3436
name: Build Slave Firmware
35-
runs-on: macos-14
37+
runs-on: ubuntu-latest
3638
steps:
3739
- uses: actions/checkout@v4
3840
- name: Set up Python
@@ -42,8 +44,7 @@ jobs:
4244
- name: Install dependencies
4345
run: bash ./tools/prepare-ci.sh
4446
- name: Build slave firmware
45-
run: |
46-
bash ./tools/compile_slave.sh
47+
run: bash ./tools/compile_slave.sh
4748
- name: Upload artifacts
4849
uses: actions/upload-artifact@v4
4950
with:
@@ -53,7 +54,7 @@ jobs:
5354
combine-artifacts:
5455
name: Combine artifacts and create framework
5556
needs: [build-libs, build-slave_firmware]
56-
runs-on: macos-14
57+
runs-on: ubuntu-latest
5758
steps:
5859
- uses: actions/checkout@v4
5960
- name: Set up Python
@@ -63,7 +64,7 @@ jobs:
6364
- name: Download build artifacts
6465
uses: actions/download-artifact@v4
6566
with:
66-
path: dist
67+
path: framework-arduinoespressif32
6768
pattern: artifacts-*
6869
merge-multiple: true
6970
- name: Download slave firmware
@@ -73,45 +74,31 @@ jobs:
7374
path: slave_firmware
7475
- name: Create complete framework
7576
run: |
76-
echo "Listing current directory:"
77-
ls -la
78-
echo "Listing slave_firmware directory:"
79-
ls -la slave_firmware/ || echo "slave_firmware directory not found"
80-
echo "Listing dist directory:"
81-
ls -la dist/ || echo "dist directory not found"
82-
# Integrate slave firmware directly
83-
mkdir -p dist/framework-arduinoespressif32/tools/slave_firmware
84-
cp -r slave_firmware/* dist/framework-arduinoespressif32/tools/slave_firmware/
85-
# Create final framework ZIP
86-
(cd dist && zip -qr framework-arduinoespressif32.zip framework-arduinoespressif32)
77+
mkdir -p framework-arduinoespressif32/tools/slave_firmware
78+
mv slave_firmware/* framework-arduinoespressif32/tools/slave_firmware/
79+
mv framework-arduinoespressif32/release-info.txt .
80+
IDF_BRANCH=$(grep 'esp-idf branch' release-info.txt | sed -E 's/.*branch \[([^]]+)\].*/\1/')
81+
IDF_COMMIT=$(grep 'esp-idf branch' release-info.txt | sed -E 's/.*commit \[([^]]+)\].*/\1/')
82+
echo "IDF_BRANCH=$IDF_BRANCH"
83+
echo "IDF_COMMIT=$IDF_COMMIT"
84+
idf_version_string="${IDF_BRANCH//\//_}-$IDF_COMMIT"
85+
7z a -mx=9 -tzip -xr'!.*' framework-arduinoespressif32-${idf_version_string}.zip framework-arduinoespressif32/
8786
88-
- name: Upload framework artifact
89-
uses: actions/upload-artifact@v4
90-
with:
91-
name: framework
92-
path: |
93-
dist/framework*
94-
dist/release-info.txt
87+
- name: Set tag name
88+
id: set_tag_name
89+
run: |
90+
IDF_VERSION=$(grep 'esp-idf branch' release-info.txt | sed -E 's/.*branch \[release\/v([0-9]+\.[0-9]+)\].*/\1/')
91+
DATE=$(date +"%d%m-%H%M")
92+
echo "tag_name=${DATE}-${IDF_VERSION}" >> $GITHUB_OUTPUT
9593
96-
release_framework:
97-
name: Release Framework
98-
needs: combine-artifacts
99-
runs-on: macos-14
100-
steps:
101-
- uses: actions/checkout@v4
102-
- name: Download complete framework
103-
uses: actions/download-artifact@v4
104-
with:
105-
name: framework
106-
path: dist
107-
- name: Release
94+
- name: Release framework-arduinoespressif32
10895
uses: jason2866/action-gh-release@v1.3
10996
with:
110-
tag_name: ${{ github.run_number }}
111-
body_path: dist/release-info.txt
97+
tag_name: ${{ steps.set_tag_name.outputs.tag_name }}
98+
body_path: release-info.txt
11299
prerelease: true
113100
files: |
114-
dist/framework*
115-
dist/release-info.txt
101+
framework-arduinoespressif32-*.zip
102+
release-info.txt
116103
env:
117104
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

tools/archive-build.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pio_zip_archive_path="dist/framework-arduinoespressif32-$TARGET-$idf_version_str
1010
mkdir -p dist && rm -rf "$archive_path" "$build_archive_path"
1111

1212
cd out
13-
echo "Creating PlatformIO Tasmota framework-arduinoespressif32"
13+
echo "Copying built MCU libs to framework"
1414
mkdir -p arduino-esp32/cores/esp32
1515
mkdir -p arduino-esp32/tools/partitions
1616
cp -rf ../components/arduino/tools arduino-esp32
@@ -61,8 +61,11 @@ mv arduino-esp32/ framework-arduinoespressif32/
6161
cd framework-arduinoespressif32/libraries
6262
rm -rf **/examples
6363
cd ../tools/esp32-arduino-libs
64-
# rm -rf **/flags
64+
rm -rf **/flags
6565
cd ../../../
66-
# If the framework is needed as tar.gz uncomment next line
67-
# tar --exclude=.* -zcf ../$pio_archive_path framework-arduinoespressif32/
68-
7z a -mx=9 -tzip -xr'!.*' ../$pio_zip_archive_path framework-arduinoespressif32/
66+
67+
68+
if [[ -z "$GITHUB_ACTIONS" ]]; then
69+
echo "Creating PlatformIO Tasmota framework-arduinoespressif32"
70+
7z a -mx=9 -tzip -xr'!.*' ../$pio_zip_archive_path framework-arduinoespressif32/
71+
fi

tools/prepare-ci.sh

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#!/bin/bash
22

3-
# Ubuntu setup
4-
# Change in archive-build.sh gawk to awk
5-
#sudo apt update && sudo apt install -y gperf cmake ninja-build ccache
6-
#pip3 install wheel future pyelftools
7-
8-
# MacOS (ARM) setup
9-
# Change in archive-build.sh awk to gawk
10-
brew install gsed
11-
brew install gawk
12-
brew install gperf
13-
#brew install ninja
14-
brew install ccache
15-
python -m pip install uv
16-
uv venv
17-
uv pip install future pyelftools
3+
if [[ "$OSTYPE" == "darwin"* ]]; then
4+
echo "macOS OS detected. Install dependencies..."
5+
brew install gsed || true
6+
brew install gawk || true
7+
brew install gperf || true
8+
brew install ninja || true
9+
brew install ccache || true
10+
brew install 7zip || true
11+
python3 -m pip install uv
12+
uv venv
13+
uv pip install future pyelftools
14+
else
15+
echo "Linux detected. Install dependencies..."
16+
sudo apt update && sudo apt install -y gperf cmake ninja-build ccache p7zip-full
17+
pip3 install wheel future pyelftools
18+
fi

0 commit comments

Comments
 (0)