-
Notifications
You must be signed in to change notification settings - Fork 8
255 lines (217 loc) · 7.85 KB
/
dev_compile.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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
---
name: Compile Develop Brench
on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
workflow_dispatch:
inputs:
board:
description: 'Board to Compile'
type: choice
required: true
default: 'M5Dial'
options: ['CoreInk', 'M5Dial', 'M5Cardputer', 'M5StickCPlus2', 'M5StickCPlus', 'M5StickC']
jobs:
compile_sketch:
name: Build ${{ matrix.board.name }} (${{ matrix.locale }})
runs-on: ubuntu-latest
strategy:
# max-parallel: 5
fail-fast: false
matrix:
locale:
- en-us
- pt-br
- ger
- fr-fr
- it-it
- nl_nl
board:
- {
name: "CoreInk",
fqbn: "m5stack:esp32:m5stack_coreink",
extra_flags: "-DCoreInk",
libraries: "M5Core-Ink IRRemoteESP8266 M5Stack-SD-Updater M5Unified ",
partitions: {
bootloader_addr: "0x0000",
},
}
- {
name: "M5Dial",
fqbn: "m5stack:esp32:m5stack_dial",
extra_flags: "-DDIAL",
libraries: "M5Dial IRRemoteESP8266 M5Stack-SD-Updater M5Unified ",
partitions: {
bootloader_addr: "0x0000",
},
}
- {
name: "M5Cardputer",
fqbn: "m5stack:esp32:m5stack_cardputer",
extra_flags: "-DCARDPUTER",
libraries: "M5Cardputer IRRemoteESP8266 M5Stack-SD-Updater M5Unified ESP32Time",
partitions: {
bootloader_addr: "0x0000",
},
}
- {
name: "M5StickCPlus2",
fqbn: "m5stack:esp32:m5stack_stickc_plus2",
extra_flags: "-DSTICK_C_PLUS2",
libraries: "M5StickCPlus2 IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
}
- {
name: "M5StickCPlus",
fqbn: "m5stack:esp32:m5stack_stickc_plus",
extra_flags: "-DSTICK_C_PLUS",
libraries: "M5StickCPlus IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
}
- {
name: "M5StickC",
fqbn: "m5stack:esp32:m5stack_stickc",
extra_flags: "-DSTICK_C",
# TODO: M5StickC's latest version has some dependency issues with M5Hat-JoyC library
libraries: "[email protected] IRRemoteESP8266 M5Stack-SD-Updater M5Unified",
partitions: {
bootloader_addr: "0x1000",
},
}
steps:
- uses: actions/checkout@v4
- id: shark_version
name: Get SHARK Version
run: |
set -x
if [[ "${{ github.ref_type }}" == "tag" ]]; then
version=${{ github.ref_name }}
else
version="${GITHUB_SHA::7}"
fi
echo "version=${version}" > $GITHUB_OUTPUT
- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@v1
- name: Install platform
run: |
set -x
# arduino-cli core install esp32:esp32
arduino-cli core install m5stack:esp32 --additional-urls "file:///${PWD}/package_m5stack_index.json"
arduino-cli core search m5stack
arduino-cli board listall
arduino-cli lib install ${{ matrix.board.libraries }} --log-level warn --verbose
- name: Install esptool
run: |
pip install -U esptool
- name: Setup platform.txt
run: |
baseFolder="$HOME/.arduino15/packages/m5stack/hardware/esp32"
# Find the latest version of the folder
latestVersion=$(find "$baseFolder" -maxdepth 1 -type d -exec basename {} \; | sort -V | head -n 1)
# Full path to the file to be edited
file="$baseFolder/$latestVersion/platform.txt"
backupFile="$baseFolder/$latestVersion/platform.txt.bkp"
prefix="build.extra_flags.esp32"
option=" -w "
prefix2="compiler.c.elf.libs.esp32"
option2=" -zmuldefs "
# Use awk to insert options after the first equals sign on lines with specified prefixes
awk -v prefix="$prefix" -v option="$option" -v prefix2="$prefix2" -v option2="$option2" '{
if ($0 ~ "^" prefix) {
sub(/=/, "=" option);
print;
} else if ($0 ~ "^" prefix2) {
sub(/=/, "=" option2);
print;
} else {
print;
}
}' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
echo "Done."
- name: Compile ${{ matrix.board.name }} Sketch
run: |
set -x
version=${{ steps.shark_version.outputs.version }}
locale=${{ matrix.locale }}
language=$(echo "LANGUAGE_${locale//-/_}" | tr '[:lower:]' '[:upper:]')
extra_flags="${{ matrix.board.extra_flags }} -DSHARK_VERSION=\"${version}\" -D${language}"
arduino-cli compile --fqbn ${{ matrix.board.fqbn }} -e \
--build-property build.partitions=huge_app \
--build-property upload.maximum_size=3145728 \
--build-property compiler.cpp.extra_flags="${extra_flags}" \
./m5stick-shark.ino
- name: Create ${{ matrix.board.name }} Firmware Binary
run: |
set -x
version=${{ steps.shark_version.outputs.version }}
locale=${{ matrix.locale }}
if [[ "${locale}" == "en-us" ]]; then
output_file="M5shark-${version}-${{ matrix.board.name }}.bin"
else
output_file="M5shark-${version}-${{ matrix.board.name }}.${locale}.bin"
fi
fqbn=${{ matrix.board.fqbn }}
directory="${fqbn//:/.}"
esptool.py --chip esp32s3 merge_bin --output ${output_file} \
${{ matrix.board.partitions.bootloader_addr }} build/${directory}/m5stick-shark.ino.bootloader.bin \
0x8000 build/${directory}/m5stick-shark.ino.partitions.bin \
0x10000 build/${directory}/m5stick-shark.ino.bin
- name: List all files
if: always()
continue-on-error: true
run: |
set -x
pwd
ls -all
tree
# TODO: Validate the firmware
- name: Upload ${{ matrix.board.name }} Firmware Binary
uses: actions/upload-artifact@v4
with:
name: M5shark-${{ matrix.board.name }}.${{ matrix.locale }}
path: M5shark-*.bin
if-no-files-found: error
create_release:
runs-on: ubuntu-latest
environment: github_release
needs: [compile_sketch]
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
steps:
- id: shark_version
name: Get SHARK Version
run: |
set -x
if [[ "${{ github.ref_type }}" == "tag" ]]; then
version=${{ github.ref_name }}
else
version="${GITHUB_SHA::7}"
fi
echo "version=${version}" > $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: List all files
if: always()
run: |
set -x
pwd
ls -all
tree
#- name: Create Release ${{ steps.shark_version.outputs.version }}
# uses: softprops/action-gh-release@v1
# with:
# name: SHARK Release ${{ steps.shark_version.outputs.version }}
# tag_name: ${{ steps.shark_version.outputs.version }}
# generate_release_notes: true
# files: |
# M5shark-*.bin