1
1
name : Cron Build
2
2
3
- on :
3
+ on :
4
4
schedule :
5
5
# ┌───────────── minute (0 - 59)
6
6
# │ ┌───────────── hour (0 - 23)
7
7
# │ │ ┌───────────── day of the month (1 - 31)
8
8
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
9
9
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
10
- # │ │ │ │ │
10
+ # │ │ │ │ │
11
11
# │ │ │ │ │
12
12
# │ │ │ │ │
13
13
# * * * * *
14
14
- cron : ' 0 */6 * * *'
15
+ workflow_dispatch :
16
+ inputs :
17
+ idf_branch :
18
+ description : ' IDF branch to build (JSON list of strings e.g. ["release/v5.1"] or "all" to build all branches)'
19
+ required : true
20
+ default : ' all'
21
+ target :
22
+ description : ' Target to build (JSON list of strings e.g. ["esp32", "esp32s2"] or "all" to build all targets)'
23
+ required : true
24
+ default : ' all'
15
25
16
26
defaults :
17
27
run :
18
28
shell : bash
19
29
20
30
jobs :
21
- run :
22
- name : Build with IDF ${{ matrix.idf_branch }}
31
+ gen-matrix :
32
+ name : Generate matrix
23
33
runs-on : ubuntu-latest
24
-
34
+ outputs :
35
+ matrix : ${{ steps.gen-matrix.outputs.matrix }}
36
+ branches : ${{ steps.gen-matrix.outputs.branches }}
37
+ steps :
38
+ - name : Generate matrix
39
+ id : gen-matrix
40
+ run : |
41
+ apt update && apt install jq
42
+
43
+ # Change this based on the IDF branches we want to build
44
+ all_branches="[\"release/v5.1\"]"
45
+
46
+ # Change this based on the COMMON targets for all branches we want to build.
47
+ common_targets="[\"esp32\", \"esp32s2\", \"esp32s3\", \"esp32c2\", \"esp32c3\", \"esp32c6\", \"esp32h2\"]"
48
+
49
+ # For additional targets per branch, add them here
50
+ additional_targets="[{\"idf_branch\": \"release/v5.3\", \"target\": \"esp32p4\"}]"
51
+
52
+ branches="${{ github.event.inputs.idf_branch }}"
53
+ targets="${{ github.event.inputs.target }}"
54
+
55
+ if [ -z "$branches" ] || [ "$branches" == "all" ]; then
56
+ branches=$all_branches
57
+ fi
58
+
59
+ if [ -z "$targets" ]; then
60
+ targets="all"
61
+ fi
62
+
63
+ echo "Inputs:"
64
+ echo "idf_branch: ${{ github.event.inputs.idf_branch }}"
65
+ echo "target: ${{ github.event.inputs.target }}"
66
+
67
+ matrix="{"
68
+ matrix+="\"idf_branch\": $branches,"
69
+
70
+ if [ "$targets" == "all" ]; then
71
+ matrix+="\"target\": $common_targets,"
72
+ matrix+="\"include\": "
73
+ # Add all additional targets that are in the selected branches
74
+ matrix+=$(echo $additional_targets | jq --argjson branches "$branches" '[.[] | select(.idf_branch as $branch | $branches | index($branch))]')
75
+ else
76
+ matrix+="\"target\": $targets"
77
+ fi
78
+
79
+ matrix+="}"
80
+
81
+ echo "Branches: $branches"
82
+ echo "Targets: $targets"
83
+ echo "Matrix:"
84
+ echo "$matrix" | jq .
85
+ echo "matrix=$matrix" >> $GITHUB_OUTPUT
86
+ echo "branches=$branches" >> $GITHUB_OUTPUT
87
+
88
+ check :
89
+ name : Check if result should be deployed
90
+ runs-on : ubuntu-latest
91
+ needs : gen-matrix
25
92
strategy :
26
- fail-fast : false
27
93
matrix :
28
- idf_branch : [release/v5.1, release/v4.4] # , release/v3.3]
94
+ idf_branch : ${{ fromJson(needs.gen-matrix.outputs.branches) }}
95
+ outputs :
96
+ idf_branch : ${{ steps.check.outputs.idf_branch }}
97
+ idf_commit : ${{ steps.check.outputs.idf_commit }}
98
+ ar_branch : ${{ steps.check.outputs.ar_branch }}
99
+ ar_new_commit_message : ${{ steps.check.outputs.ar_new_commit_message }}
100
+ ar_new_branch_name : ${{ steps.check.outputs.ar_new_branch_name }}
101
+ ar_new_pr_title : ${{ steps.check.outputs.ar_new_pr_title }}
102
+ ar_has_commit : ${{ steps.check.outputs.ar_has_commit }}
103
+ ar_has_branch : ${{ steps.check.outputs.ar_has_branch }}
104
+ ar_has_pr : ${{ steps.check.outputs.ar_has_pr }}
105
+ libs_version : ${{ steps.check.outputs.libs_version }}
106
+ libs_has_commit : ${{ steps.check.outputs.libs_has_commit }}
107
+ libs_has_branch : ${{ steps.check.outputs.libs_has_branch }}
108
+ steps :
109
+ - uses : actions/checkout@v3
110
+ - id : check
111
+ env :
112
+ GITHUB_TOKEN : ${{ secrets.PUSH_TOKEN }}
113
+ GIT_AUTHOR_EMAIL : ${{ secrets.PUSH_EMAIL }}
114
+ GIT_COMMITTER_EMAIL : ${{ secrets.PUSH_EMAIL }}
115
+ IDF_BRANCH : ${{ matrix.idf_branch }}
116
+ run : bash ./tools/check-deploy-needed.sh
117
+
118
+ build-libs :
119
+ name : Build with IDF ${{ matrix.idf_branch }} for ${{ matrix.target }}
120
+ runs-on : ubuntu-latest
121
+ needs : [gen-matrix, check]
122
+ if : needs.check.outputs.libs_has_commit == '0' || needs.check.outputs.ar_has_commit == '0'
123
+ strategy :
124
+ fail-fast : false
125
+ matrix : ${{ fromJson(needs.gen-matrix.outputs.matrix) }}
29
126
steps :
30
127
- uses : actions/checkout@v4
31
128
with :
@@ -38,107 +135,78 @@ jobs:
38
135
GIT_AUTHOR_EMAIL : ${{ secrets.PUSH_EMAIL }}
39
136
GIT_COMMITTER_EMAIL : ${{ secrets.PUSH_EMAIL }}
40
137
IDF_BRANCH : ${{ matrix.idf_branch }}
138
+ TARGETS : ${{ matrix.target }}
41
139
run : |
42
- git checkout ${{ matrix.idf_branch }} || echo "Using master branch"
140
+ git checkout ${{ env.IDF_BRANCH }} || echo "Using master branch"
43
141
bash ./tools/cron.sh
142
+
44
143
- name : Upload build
45
144
if : failure()
46
145
uses : actions/upload-artifact@v4
47
146
with :
48
- name : build
147
+ name : build-${{ matrix.idf_branch }}-${{ matrix.target }}
49
148
path : build
50
- - name : Upload archive
149
+
150
+ - name : Upload library files
51
151
uses : actions/upload-artifact@v4
52
152
with :
53
- name : artifacts
153
+ name : libs-${{ matrix.idf_branch }}-${{ matrix.target }}
54
154
path : dist
55
155
156
+ combine-artifacts :
157
+ name : Combine artifacts for IDF ${{ matrix.idf_branch }}
158
+ runs-on : ubuntu-latest
159
+ needs : [gen-matrix, check, build-libs]
160
+ if : needs.check.outputs.libs_has_commit == '0' || needs.check.outputs.ar_has_commit == '0'
161
+ strategy :
162
+ fail-fast : false
163
+ matrix :
164
+ idf_branch : ${{ fromJson(needs.gen-matrix.outputs.branches) }}
165
+ steps :
166
+ - name : Download artifacts
167
+ uses : actions/download-artifact@v4
168
+ with :
169
+ path : dist
170
+ pattern : libs-${{ matrix.idf_branch }}-*
171
+ merge-multiple : true
172
+
173
+ - name : Combine artifacts
174
+ shell : bash
175
+ run : |
176
+ set -e
177
+ mkdir -p out
178
+ find dist -name 'arduino-esp32-libs-esp*.tar.gz'
179
+ for file in $files; do
180
+ tar zxvf $file -C out
181
+ cat out/tools/esp32-arduino-libs/versions.txt >> out/tools/esp32-arduino-libs/versions_full.txt
182
+ done
183
+
184
+ # Merge versions.txt files
185
+ awk -i inplace '!seen[$0]++' out/tools/esp32-arduino-libs/versions_full.txt
186
+ mv -f out/tools/esp32-arduino-libs/versions_full.txt out/tools/esp32-arduino-libs/versions.txt
187
+
188
+ cd out/tools/esp32-arduino-libs && tar zcf ../../../dist/esp32-arduino-libs.tar.gz * && cd ../../..
189
+ cp out/package_esp32_index.template.json dist/package_esp32_index.template.json
190
+
191
+ - name : Upload full esp32-arduino-libs archive
192
+ uses : actions/upload-artifact@v4
193
+ with :
194
+ name : esp32-arduino-libs
195
+ path : dist/esp32-arduino-libs.tar.gz
56
196
57
- # check:
58
- # name: Check if result should be deployed
59
- # runs-on: ubuntu-latest
60
- # strategy:
61
- # matrix:
62
- # branch: [release/v5.1, release/v4.4] #, release/v3.3]
63
- # outputs:
64
- # idf_branch: ${{ steps.check.outputs.idf_branch }}
65
- # idf_commit: ${{ steps.check.outputs.idf_commit }}
66
- # ar_branch: ${{ steps.check.outputs.ar_branch }}
67
- # ar_new_commit_message: ${{ steps.check.outputs.ar_new_commit_message }}
68
- # ar_new_branch_name: ${{ steps.check.outputs.ar_new_branch_name }}
69
- # ar_new_pr_title: ${{ steps.check.outputs.ar_new_pr_title }}
70
- # ar_has_commit: ${{ steps.check.outputs.ar_has_commit }}
71
- # ar_has_branch: ${{ steps.check.outputs.ar_has_branch }}
72
- # ar_has_pr: ${{ steps.check.outputs.ar_has_pr }}
73
- # libs_version: ${{ steps.check.outputs.libs_version }}
74
- # libs_has_commit: ${{ steps.check.outputs.libs_has_commit }}
75
- # libs_has_branch: ${{ steps.check.outputs.libs_has_branch }}
76
- # steps:
77
- # - uses: actions/checkout@v3
78
- # - id: check
79
- # env:
80
- # GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
81
- # GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }}
82
- # GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }}
83
- # IDF_BRANCH: ${{ matrix.idf_branch }}
84
- # run: bash ./tools/check-deploy-needed.sh
85
-
86
- # build:
87
- # name: Build Libs for ${{ matrix.target }}
88
- # runs-on: ubuntu-latest
89
- # needs: check
90
- # if: needs.check.outputs.libs_has_commit == '0' || needs.check.outputs.ar_has_commit == '0'
91
- # strategy:
92
- # matrix:
93
- # target: [esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2]
94
- # fail-fast: false
95
- # steps:
96
- # - uses: actions/checkout@v3
97
- # # - name: Install dependencies
98
- # # run: bash ./tools/prepare-ci.sh
99
- # - shell: bash
100
- # name: Build Libs for ${{ matrix.target }}
101
- # run: echo ${{ matrix.target }}
102
- # # run: bash ./build.sh -t ${{ matrix.target }}
103
- # # - name: Upload archive
104
- # # uses: actions/upload-artifact@v3
105
- # # with:
106
- # # name: artifacts
107
- # # path: dist
108
-
109
- # deploy:
110
- # name: Deploy build
111
- # runs-on: ubuntu-latest
112
- # needs: [check, build]
113
- # steps:
114
- # - uses: actions/checkout@v3
115
- # - shell: bash
116
- # env:
117
- # GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
118
- # GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }}
119
- # GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }}
120
- # IDF_BRANCH: ${{ needs.check.outputs.idf_branch }}
121
- # IDF_COMMIT: ${{ needs.check.outputs.idf_commit }}
122
- # AR_BRANCH: ${{ needs.check.outputs.ar_branch }}
123
- # AR_NEW_COMMIT_MESSAGE: ${{ needs.check.outputs.ar_new_commit_message }}
124
- # AR_NEW_BRANCH_NAME: ${{ needs.check.outputs.ar_new_branch_name }}
125
- # AR_NEW_PR_TITLE: ${{ needs.check.outputs.ar_new_pr_title }}
126
- # AR_HAS_COMMIT: ${{ needs.check.outputs.ar_has_commit }}
127
- # AR_HAS_BRANCH: ${{ needs.check.outputs.ar_has_branch }}
128
- # AR_HAS_PR: ${{ needs.check.outputs.ar_has_pr }}
129
- # LIBS_VERSION: ${{ needs.check.outputs.libs_version }}
130
- # LIBS_HAS_COMMIT: ${{ needs.check.outputs.libs_has_commit }}
131
- # LIBS_HAS_BRANCH: ${{ needs.check.outputs.libs_has_branch }}
132
- # run: |
133
- # echo "IDF_COMMIT: $IDF_COMMIT"
134
- # echo "AR_BRANCH: $AR_BRANCH"
135
- # echo "AR_NEW_COMMIT_MESSAGE: $AR_NEW_COMMIT_MESSAGE"
136
- # echo "AR_NEW_BRANCH_NAME: $AR_NEW_BRANCH_NAME"
137
- # echo "AR_NEW_PR_TITLE: $AR_NEW_PR_TITLE"
138
- # echo "AR_HAS_COMMIT: $AR_HAS_COMMIT"
139
- # echo "AR_HAS_BRANCH: $AR_HAS_BRANCH"
140
- # echo "AR_HAS_PR: $AR_HAS_PR"
141
- # echo "LIBS_VERSION: $LIBS_VERSION"
142
- # echo "LIBS_HAS_COMMIT: $LIBS_HAS_COMMIT"
143
- # echo "LIBS_HAS_BRANCH: $LIBS_HAS_BRANCH"
197
+ - name : Upload package_esp32_index.template.json
198
+ uses : actions/upload-artifact@v4
199
+ with :
200
+ name : package-esp32-index-json
201
+ path : dist/package_esp32_index.template.json
144
202
203
+ - name : Push changes
204
+ if : ${{ github.repository == 'espressif/esp32-arduino-lib-builder' }}
205
+ env :
206
+ GITHUB_TOKEN : ${{ secrets.PUSH_TOKEN }}
207
+ GIT_AUTHOR_EMAIL : ${{ secrets.PUSH_EMAIL }}
208
+ GIT_COMMITTER_EMAIL : ${{ secrets.PUSH_EMAIL }}
209
+ IDF_BRANCH : ${{ matrix.idf_branch }}
210
+ run : |
211
+ ./tools/push-to-arduino.sh
212
+ if [ $? -ne 0 ]; then exit 1; fi
0 commit comments