Skip to content

Commit f5a7e2f

Browse files
committed
hopefully fixes esp32 build
1 parent 2b07d31 commit f5a7e2f

File tree

7 files changed

+195
-6
lines changed

7 files changed

+195
-6
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Ramesh
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# esp-idf-action
2+
3+
GitHub action to build ESP-IDF project using esp-idf framework. This action downloads the required ESP-IDF from espressif server and from github for latest branch. From `v2` introduced cache esp-idf and its tools based on esp-idf version
4+
5+
The `esp_idf_version` as follows
6+
- `latest` (master branch)
7+
- [ESP-IDF version list](https://github.com/espressif/esp-idf/tags)
8+
9+
**Note:**
10+
The action runs on ubuntu latest and python3 as default interpreter.
11+
12+
### Example
13+
14+
```yml
15+
# This is a esp idf workflow to build ESP32 based project
16+
17+
name: Build and Artifact the ESP-IDF Project
18+
19+
# Controls when the action will run.
20+
on:
21+
# Triggers the workflow on tag create like v1.0, v2.0.0 and so on
22+
push:
23+
tags:
24+
- 'v*'
25+
26+
# Allows you to run this workflow manually from the Actions tab
27+
workflow_dispatch:
28+
29+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
30+
jobs:
31+
# This workflow contains a single job called "build"
32+
build:
33+
# The type of runner that the job will run on
34+
runs-on: ubuntu-latest
35+
36+
- name: Install ESP-IDF and Build project
37+
uses: rmshub/esp-idf-action@v5
38+
with:
39+
esp_idf_version: v4.4.4
40+
esp_idf_target: esp32
41+
42+
- name: Archive build output artifacts
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: build
46+
path: |
47+
build/bootloader/bootloader.bin
48+
build/partition_table/partition-table.bin
49+
build/${{ github.event.repository.name }}.bin
50+
```
51+
52+
## Test
53+
54+
Currently this action verified with esp-idf v4.4.4
55+
56+
## License
57+
58+
This repository is licensed with the [MIT License](LICENSE).
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: 'ESP-IDF Project Build'
2+
author: 'rmshub'
3+
description: 'GitHub action to install ESP-IDF tools for building esp-idf projects'
4+
5+
branding:
6+
icon: 'box'
7+
color: 'orange'
8+
9+
inputs:
10+
fetch-depth:
11+
description: 'Number of commits to fetch. 0 indicates all history for all branches and tags'
12+
required: false
13+
default: '1'
14+
token:
15+
description: 'Personal access token (PAT) used to fetch the repository'
16+
required: false
17+
default: ${{ github.token }}
18+
submodules:
19+
description: 'Whether to checkout submodules: true to checkout submodules or recursive'
20+
required: false
21+
default: true
22+
esp_idf_version:
23+
description: 'ESP-IDF version'
24+
required: false
25+
default: 'v4.3'
26+
esp_idf_target:
27+
description: 'Sets the target (chip) for which the project is built'
28+
required: false
29+
default: 'esp32'
30+
31+
runs:
32+
using: "composite"
33+
steps:
34+
- name: Checkout the code
35+
uses: actions/checkout@v3
36+
with:
37+
fetch-depth: ${{ inputs.fetch-depth }}
38+
token: ${{ inputs.token }}
39+
submodules: ${{ inputs.submodules }}
40+
41+
- name: Cache esp-idf and its tools
42+
id: esp-idf-cache
43+
uses: actions/cache@v3
44+
with:
45+
path: |
46+
~/esp/esp-idf
47+
~/.espressif
48+
key: ${{ runner.os }}-esp-${{ inputs.esp_idf_version }}
49+
50+
- run: |
51+
if echo ${{ steps.esp-idf-cache.outputs.cache-hit }} | grep -c "true"
52+
then
53+
echo "Cache hit - skipping dependency installation"
54+
else
55+
sh ${{ github.action_path }}/install.sh ${{ inputs.esp_idf_version }}
56+
fi
57+
shell: bash
58+
59+
- run: |
60+
source ~/esp/esp-idf/export.sh
61+
idf.py set-target ${{ inputs.esp_idf_target }}
62+
shell: bash
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
# esp idf repository version
4+
esp_idf_version="$1"
5+
6+
# Installing prerequisites
7+
echo "## Install prerequisites"
8+
9+
export DEBIAN_FRONTEND=noninteractive
10+
11+
sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util
12+
13+
# Making Python 3 the default interpreter
14+
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
15+
16+
# Create the esp directory for repo download
17+
mkdir ~/esp
18+
cd ~/esp
19+
20+
echo "## Download esp-idf repository"
21+
22+
case $esp_idf_version in
23+
latest)
24+
# Clone esp idf master branch repository
25+
git clone --recursive https://github.com/espressif/esp-idf.git
26+
;;
27+
*release*)
28+
git clone --recursive --depth=1 --shallow-submodules -b $esp_idf_version https://github.com/espressif/esp-idf.git
29+
;;
30+
*)
31+
# Download esp idf repository
32+
wget https://dl.espressif.com/github_assets/espressif/esp-idf/releases/download/$esp_idf_version/esp-idf-$esp_idf_version.zip
33+
34+
# Extract the files and rename folder
35+
unzip -q esp-idf-$esp_idf_version.zip && mv esp-idf-$esp_idf_version esp-idf
36+
rm -f esp-idf-$esp_idf_version.zip
37+
;;
38+
esac
39+
40+
# Navigate to esp idf repository
41+
cd ~/esp/esp-idf
42+
43+
# Installing tools
44+
echo "## Install esp-idf tools"
45+
46+
# Install required tools
47+
./install.sh

.github/workflows/macOS.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
with:
2020
python-version: '3.10'
2121

22-
- uses: espressif/esp-idf-ci-action@v1
22+
- uses: ./.github/actions/esp-idf-action
2323
with:
2424
esp_idf_version: v5.0.4
25-
target: esp32s3
25+
esp_idf_target: esp32s3
2626

2727
- name: Install Dependencies
2828
run: brew install --force gcc libffi cmake ninja make

.github/workflows/unix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
with:
2121
python-version: '3.10'
2222

23-
- uses: espressif/esp-idf-ci-action@v1
23+
- uses: ./.github/actions/esp-idf-action
2424
with:
2525
esp_idf_version: v5.0.4
26-
target: esp32s3
26+
esp_idf_target: esp32s3
2727

2828
- name: Install Deps
2929
run: sudo apt-get install --force-yes -y build-essential pkg-config cmake ninja-build libffi-dev gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev libpipewire-0.3-dev libwayland-dev libdecor-0-dev

.github/workflows/windows.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ jobs:
1515
- uses: carlosperate/[email protected]
1616
with:
1717
release: '9-2019-q4' # The arm-none-eabi-gcc release to use.
18+
1819
- uses: actions/setup-python@v5
1920
with:
2021
python-version: '3.10'
2122

22-
- uses: espressif/esp-idf-ci-action@v1
23+
- uses: ./.github/actions/esp-idf-action
2324
with:
2425
esp_idf_version: v5.0.4
25-
target: esp32s3
26+
esp_idf_target: esp32s3
2627

2728
- name: Install Dependencies
2829
run: |

0 commit comments

Comments
 (0)