-
Notifications
You must be signed in to change notification settings - Fork 1
214 lines (185 loc) · 9.44 KB
/
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
name: Compile
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: Compile
cancel-in-progress: true
jobs:
clear-file-for-saving-info:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: delete file # so that the matrix has a blank file to log info into
run: |
git config --global user.name 'gbg-with-joysticks'
git config --global user.email '[email protected]'
git pull # get the most recent state of the repo
[ -d "./hex" ] && git rm -r ./hex # only delete the directory if it exists
git commit . -m "BOT delete old files" --allow-empty
git push
process-website:
needs: clear-file-for-saving-info #run after
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: process file
run: |
git config --global user.name 'gbg-with-joysticks'
git config --global user.email '[email protected]'
git pull # get the most recent state of the repo
rm -f ./gbg_program/_website.ino
cp ./gbg_program/_wifi_site.html ./gbg_program/_website.ino
sed -i 's:":\\":g' ./gbg_program/_website.ino
tr '\n' ' ' < ./gbg_program/_website.ino > ./gbg_program/_website.ino.tmp
mv -f ./gbg_program/_website.ino.tmp ./gbg_program/_website.ino
sed -i 's:^:\/\/ Do not edit. Auto generated from _wifi_site.html \n#if defined(ARDUINO_RASPBERRY_PI_PICO_W) || defined(ESP32)\n const char indexHTML[] = " :' ./gbg_program/_website.ino
printf '"; \n#endif' >> ./gbg_program/_website.ino
git add .
git commit . -m "BOT process website" --allow-empty
git push
compile-sketch:
needs: process-website #run after
strategy:
max-parallel: 1 # since the actions edit files in the repo, only run one at a time.
matrix:
# list of programs to compile (can have multiple programs for multiple boards)
# for additional-commands use | to separate multiple commands, to install library, use arduino-cli lib install <Library>
# board-upload must match a board type as defined by https://github.com/dbuezas/arduino-web-uploader
include:
- configName: "standard-nanoOld"
code-dir: gbg_program
arduino-platform: "arduino:avr"
fqbn: "arduino:avr:nano"
board-upload: "nanoOldBootloader"
niceBoardName: "old nano"
additional-commands: arduino-cli lib install Servo
- configName: "standard-nanoNew"
code-dir: gbg_program
arduino-platform: "arduino:avr"
fqbn: "arduino:avr:nano"
board-upload: "nano"
niceBoardName: "new nano or uno"
additional-commands: arduino-cli lib install Servo
- configName: "standard-rpiPico"
code-dir: gbg_program
arduino-platform: "rp2040:rp2040 --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json"
fqbn: "rp2040:rp2040:rpipico"
board-upload: "RPIPICO"
niceBoardName: "rpi pico"
- configName: "standard-rpiPico-W"
code-dir: gbg_program
arduino-platform: "rp2040:rp2040 --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json"
fqbn: "rp2040:rp2040:rpipicow"
board-upload: "RPIPICOW"
niceBoardName: "rpi pico W"
- configName: "standard-esp32"
code-dir: gbg_program
arduino-platform: "esp32:esp32 --additional-urls https://github.com/espressif/arduino-esp32/releases/download/3.0.5/package_esp32_dev_index.json"
fqbn: "esp32:esp32:esp32"
board-upload: "ESP"
niceBoardName: "ESP32"
- configName: "clear_eeprom-nanoOld"
code-dir: clear_eeprom
arduino-platform: "arduino:avr"
fqbn: "arduino:avr:nano"
board-upload: "nanoOldBootloader"
niceBoardName: "old nano"
- configName: "clear_eeprom-nanoNew"
code-dir: clear_eeprom
arduino-platform: "arduino:avr"
fqbn: "arduino:avr:nano"
board-upload: "nano"
niceBoardName: "new nano or uno"
- configName: "clear_eeprom-rpiPico"
code-dir: clear_eeprom
arduino-platform: "rp2040:rp2040 --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json"
fqbn: "rp2040:rp2040:rpipico"
board-upload: "RPIPICO"
niceBoardName: "rpi pico"
- configName: "clear_eeprom-rpiPico-W"
code-dir: clear_eeprom
arduino-platform: "rp2040:rp2040 --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json"
fqbn: "rp2040:rp2040:rpipicow"
board-upload: "RPIPICOW"
niceBoardName: "rpi pico W"
- configName: "clear_eeprom-esp32"
code-dir: clear_eeprom
arduino-platform: "esp32:esp32 --additional-urls https://github.com/espressif/arduino-esp32/releases/download/3.0.5/package_esp32_dev_index.json"
fqbn: "esp32:esp32:esp32"
board-upload: "ESP"
niceBoardName: "ESP32"
- configName: "blink-nanoOld"
code-dir: blink
arduino-platform: "arduino:avr"
fqbn: "arduino:avr:nano"
board-upload: "nanoOldBootloader"
niceBoardName: "old nano"
- configName: "blink-nanoNew"
code-dir: blink
arduino-platform: "arduino:avr"
fqbn: "arduino:avr:nano"
board-upload: "nano"
niceBoardName: "new nano or uno"
- configName: "blink-rpiPico"
code-dir: blink
arduino-platform: "rp2040:rp2040 --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json"
fqbn: "rp2040:rp2040:rpipico"
board-upload: "RPIPICO"
niceBoardName: "rpi pico"
- configName: "blink-rpiPico-W"
code-dir: blink
arduino-platform: "rp2040:rp2040 --additional-urls https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json"
fqbn: "rp2040:rp2040:rpipicow"
board-upload: "RPIPICOW"
niceBoardName: "rpi pico W"
- configName: "blink-esp32"
code-dir: blink
arduino-platform: "esp32:esp32 --additional-urls https://github.com/espressif/arduino-esp32/releases/download/3.0.5/package_esp32_dev_index.json"
fqbn: "esp32:esp32:esp32"
board-upload: "ESP"
niceBoardName: "ESP32"
runs-on: ubuntu-latest
steps:
- name: Setup Arduino CLI
uses: arduino/[email protected]
- name: Install Arduino platforms
run: |
arduino-cli core update-index
arduino-cli core install ${{ matrix.arduino-platform }} # install the arduino platform (avr, samd, etc) with the right platform for the current board
${{ matrix.additional-commands }}
- name: Checkout
uses: actions/checkout@v4
- name: Compile Sketch
run: |
git config --global user.name 'gbg-with-joysticks'
git config --global user.email '[email protected]'
git pull # get the most recent state of the repo
arduino-cli compile ${{ matrix.code-dir }} --fqbn ${{ matrix.fqbn }} --output-dir ./hex/${{ matrix.configName }} # compile code in selected directory for selected board and drop hex files in corresponding hex/directory
# delete files other than programName.ino.hex (for AVR), programName.ino.uf2 (for Pico), or progranName.ino.bin (for esp32) since others aren't needed
if [[ "${{ matrix.fqbn }}" != "esp32:esp32:esp32" ]]; then rm -f hex/${{ matrix.configName }}/${{ matrix.code-dir }}.ino.bin; fi
rm -f hex/${{ matrix.configName }}/${{ matrix.code-dir }}.ino.elf
rm -f hex/${{ matrix.configName }}/${{ matrix.code-dir }}.ino.eep
rm -f hex/${{ matrix.configName }}/${{ matrix.code-dir }}.ino.with_bootloader.bin
rm -f hex/${{ matrix.configName }}/${{ matrix.code-dir }}.ino.with_bootloader.hex
rm -f hex/${{ matrix.configName }}/${{ matrix.code-dir }}.ino.map
rm -f hex/${{ matrix.configName }}/${{ matrix.code-dir }}.ino.merged.bin
if [[ "${{ matrix.fqbn }}" == "esp32:esp32:esp32" ]]; then cd ./hex/${{ matrix.configName }}; wget "https://github.com/espressif/arduino-esp32/raw/refs/tags/3.0.5/tools/partitions/boot_app0.bin"; fi
- name: Commit compiled files
run: |
git status
echo "${{ matrix.configName }}, ${{ matrix.code-dir }}, ${{ matrix.board-upload }}, ${{ matrix.niceBoardName }}" >> hex/configurations-info.txt
git status
git add .
git commit --allow-empty -m "BOT update compiled files for ${{ matrix.configName }}" # --allow-empty is needed in case the hex file hasn't changed
git push
compile-complete: # this job passes if the whole matrix passes
needs: [ compile-sketch ]
runs-on: ubuntu-latest
steps:
- name: Compile Complete
run: |
echo complete!