fix comments breaking website #307
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |