-
-
Notifications
You must be signed in to change notification settings - Fork 212
110 lines (94 loc) · 3.17 KB
/
IDFBuild.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: IDFBuild
env:
REPO_URL: https://github.com/espressif/esp-idf
PROJECT_DIR: examples/Test/build_test
on:
push:
paths:
- '**.ino'
- '**.cpp'
- '**.hpp'
- '**.h'
- '**.c'
- '**IDFBuild.yml'
- 'CMakeLists.txt'
- 'esp-idf-versions.php'
pull_request:
workflow_dispatch:
jobs:
set_matrix:
name: Version planner ⊹
runs-on: ubuntu-latest
env:
max-versions: 3 # maximum core versions to test, starting at latest
outputs:
matrix: ${{steps.set-matrix.outputs.matrix}}
project_dir: ${{steps.set-matrix.outputs.project_dir}}
repo_url: ${{steps.set-matrix.outputs.repo_url}}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup matrix
id: set-matrix
run: |
matrix=`php .github/scripts/esp-idf-versions.php`
# echo $matrix | jq # debug
matrix="${matrix//'%'/'%25'}" # escape percent entities
matrix="${matrix//$'\n'/''}" # remove lf
matrix="${matrix//$'\r'/''}" # remove cr
echo "matrix=${matrix}" >> $GITHUB_OUTPUT
echo "project_dir=${{env.PROJECT_DIR}}" >> $GITHUB_OUTPUT
echo "repo_url=${{env.REPO_URL}}" >> $GITHUB_OUTPUT
build:
name: idf ${{ matrix.esp-idf-fqbn }}
needs: set_matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJSON(needs.set_matrix.outputs.matrix)}}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
# - name: Cache pip for ${{ matrix.esp-idf-fqbn }}
# uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ matrix.esp-idf-fqbn }}-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
#
# - name: Cache espressif tools for ${{ matrix.esp-idf-fqbn }}
# uses: actions/cache@v3
# id: espressif
# with:
# path: |
# ~/.espressif
# key: ${{ runner.os }}-espressif-${{ matrix.esp-idf-fqbn }}-${{ hashFiles('**/lockfiles') }}
#
# - name: Cache esp-idf for ${{ matrix.esp-idf-fqbn }}
# id: cache-idf
# uses: actions/cache@v3
# with:
# path: ~/esp/esp-idf
# key: ${{ runner.os }}-idf-${{ matrix.esp-idf-fqbn }}-${{ hashFiles('**/lockfiles') }}
- name: Get/Check IDF ${{ matrix.esp-idf-fqbn }}
run: |
mkdir -p ~/esp
cd ~/esp
idf_fqbn="${{ matrix.esp-idf-fqbn }}"
idf_version=${idf_fqbn#*@}
if [ ! -d "./esp-idf/" ]; then git clone -b v$idf_version --recursive ${{ needs.set_matrix.outputs.repo_url }} esp-idf; fi
cd ~/esp/esp-idf
if [ ! -d "~/.espressif" ]; then ./install.sh; fi
- name: Build example for ${{ matrix.esp-idf-fqbn }}
run: |
source ~/esp/esp-idf/export.sh
idf_fqbn="${{ matrix.esp-idf-fqbn }}"
idf_board=${idf_fqbn%%@*}
cd ${{ needs.set_matrix.outputs.project_dir }}
idf.py set-target $idf_board
idf.py build