forked from letscontrolit/ESPEasy
-
Notifications
You must be signed in to change notification settings - Fork 4
211 lines (204 loc) · 7.26 KB
/
build.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# Checks whether the pushed commit can be build with PIO. Only triggered on normal push to the mega branch without tag and with pull requests targeting mega
name: Build
on:
push:
branches: [mega]
tags-ignore: '**'
paths-ignore:
- 'dist/Release_notes.txt'
- 'docs/**'
pull_request:
branches: [mega]
permissions:
contents: read
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
documentation:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-docs-${{ hashFiles('docs/requirements.txt') }}
- name: Build documentation
run: |
cd docs
sudo apt install imagemagick zip
pip install -r requirements.txt
make html
cd ..
zip -r -qq ESPEasy_docs.zip docs/build/*
- uses: actions/upload-artifact@v3
with:
name: Documentation
path: ESPEasy_docs.zip
generate-matrix:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- id: set-matrix
run: |
pip install platformio
python tools/ci/generate-matrix.py
build:
needs: generate-matrix
runs-on: ubuntu-22.04
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ hashFiles('requirements.txt') }}
- uses: actions/cache@v3
if: ${{ contains(matrix.env, 'esp32') }}
with:
path: ~/.platformio
key: ${{ runner.os }}-esp32-${{ hashFiles('platformio*.ini') }}
- uses: actions/cache@v3
if: ${{ contains(matrix.env, 'esp8266') }}
with:
path: ~/.platformio
key: ${{ runner.os }}-esp8266-${{ hashFiles('platformio*.ini') }}
- name: Dependencies
run: |
sudo apt-get update
sudo apt install binutils build-essential libffi-dev libgit2-dev
pip3 install --upgrade pip
pip install wheel
pip install -r requirements.txt
platformio update
- name: Build and archive
id: build-and-archive
env:
CHIP: ${{ matrix.chip }}
ENV: ${{ matrix.env }}
run: |
python tools/ci/build-and-archive.py
- uses: actions/upload-artifact@v3
with:
name: Binaries
path: |
bin
if-no-files-found: ignore
# Repackage separately for ESP82xx and ESP32
repackage:
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-docs-${{ hashFiles('docs/requirements.txt') }}
- name: Get current date
id: date
run: |
echo "builddate=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v3
with:
path: artifacts/
- name: Prepare artifacts
run: |
# ESP82xx
mkdir ESPEasy_dist_ESP82xx
cd dist
find . -exec cp -r --parents {} ../ESPEasy_dist_ESP82xx/ \;
rm ../ESPEasy_dist_ESP82xx/bin/blank_8MB.bin
cd ../artifacts/Binaries
find . -not -name '*ESP32*' -exec mv {} ../../ESPEasy_dist_ESP82xx/bin/ \;
cd ../..
# ESP32 and derived cpus, ESP32 (classic) _MUST_ be last in this list!
for cpu in ESP32s2 ESP32c3 ESP32s3 ESP32c2 ESP32c6 ESP32h2 ESP32solo1 ESP32
do
mkdir ESPEasy_dist_${cpu}
spec="*${cpu}*"
_files=$(find ./artifacts/Binaries -name "$spec"|wc -l)
if [[ $_files > 0 ]]; then
cd dist
find . -exec cp -r --parents {} ../ESPEasy_dist_${cpu}/ \;
cd ../ESPEasy_dist_${cpu}
rm bin/blank_1MB.bin bin/blank_2MB.bin bin/ESPEasy_2step_UploaderMega_1024.bin
cd ../artifacts/Binaries
find . -name "$spec" -exec mv {} ../../ESPEasy_dist_${cpu}/bin/ \;
cd ../..
fi
done
# Each supported cpu has to be listed separately, but empty folders are ignored
- uses: actions/upload-artifact@v3
with:
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP32_PR#${{ github.event.number }}_${{ github.run_id }}
path: |
ESPEasy_dist_ESP32/*
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP32solo1_PR#${{ github.event.number }}_${{ github.run_id }}
path: |
ESPEasy_dist_ESP32solo1/*
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP32s2_PR#${{ github.event.number }}_${{ github.run_id }}
path: |
ESPEasy_dist_ESP32s2/*
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP32c3_PR#${{ github.event.number }}_${{ github.run_id }}
path: |
ESPEasy_dist_ESP32c3/*
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP32s3_PR#${{ github.event.number }}_${{ github.run_id }}
path: |
ESPEasy_dist_ESP32s3/*
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP32c2_PR#${{ github.event.number }}_${{ github.run_id }}
path: |
ESPEasy_dist_ESP32c2/*
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP32c6_PR#${{ github.event.number }}_${{ github.run_id }}
path: |
ESPEasy_dist_ESP32c6/*
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP32h2_PR#${{ github.event.number }}_${{ github.run_id }}
path: |
ESPEasy_dist_ESP32h2/*
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
name: ESPEasy_mega_${{ steps.date.outputs.builddate }}_ESP82xx_PR#${{ github.event.number }}_${{ github.run_id }}
path: |
ESPEasy_dist_ESP82xx/*
if-no-files-found: ignore
# When successfully re-packaged, the original Binaries can be removed
# comment below 3 lines to not remove the Binaries artifact after repackaging
- uses: geekyeggo/delete-artifact@v2
with:
name: Binaries