-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (125 loc) · 5.53 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
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
compile-sketch:
needs: clear-file-for-saving-info #run second
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: "arduino:mbed_rp2040"
fqbn: "arduino:mbed_rp2040:pico"
board-upload: "nano"
niceBoardName: "rpi pico"
additional-commands: arduino-cli lib install Servo
- 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: "arduino:mbed_rp2040"
fqbn: "arduino:mbed_rp2040:pico"
board-upload: "nano"
niceBoardName: "rpi pico"
- 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: clear_eeprom
arduino-platform: "arduino:mbed_rp2040"
fqbn: "arduino:mbed_rp2040:pico"
board-upload: "nano"
niceBoardName: "rpi pico"
runs-on: ubuntu-latest
steps:
- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@28065f7e0317cc0dde372e0c11631963d743ee3b
- 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 since others aren't needed
rm hex/${{ matrix.configName }}/${{ matrix.code-dir }}.ino.eep
rm hex/${{ matrix.configName }}/${{ matrix.code-dir }}.ino.elf
rm hex/${{ matrix.configName }}/${{ matrix.code-dir }}.ino.with_bootloader.bin
rm hex/${{ matrix.configName }}/${{ matrix.code-dir }}.ino.with_bootloader.hex
- 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!