-
-
Notifications
You must be signed in to change notification settings - Fork 3
194 lines (163 loc) · 7.3 KB
/
ci.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
name: PlatformIO CI
on: [ push, pull_request ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Update NodeJS cache on every commit
uses: actions/cache@v4
with:
path: node_modules/
key: node_modules-${{ github.run_id }}
restore-keys: node_modules # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#
- uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install --force
- name: Build UI
run: npm run build
- name: Test UI with stable Chrome
run: npm run test:ci
- name: Check for lint errors
run: npm run lint
build:
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
envs:
[
SIM800L_IP5306_VERSION_20190610,
SIM800L_AXP192_VERSION_20200327,
SIM800C_AXP192_VERSION_20200609,
SIM800L_IP5306_VERSION_20200811,
T-A7670X,
T-Call-A7670X-V1-0,
T-Call-A7670X-V1-1,
T-A7608X
]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Update PIP cache on every commit
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ github.run_id }}-${{ matrix.envs }}
restore-keys: pip # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update PlatformIO cache on every commit
uses: actions/cache@v4
with:
path: ~/.platformio
key: platformio-${{ github.run_id }}-${{ matrix.envs }}
restore-keys: platformio # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update Build cache on every commit
uses: actions/cache@v4
with:
path: .pio/
key: build-${{ github.run_id }}-${{ matrix.envs }}
restore-keys: build # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update NodeJS cache on every commit
uses: actions/cache@v4
with:
path: node_modules/
key: node_modules-${{ github.run_id }}
restore-keys: node_modules # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#
- name: Update generated-files cache on every commit
uses: actions/cache@v4
with:
path: |
.pio/build/${{ matrix.envs }}/firmware.bin
.pio/build/${{ matrix.envs }}/partitions.bin
.pio/build/${{ matrix.envs }}/bootloader.bin
.pio/build/${{ matrix.envs }}/littlefs.bin
key: generated-files-${{ github.run_id }}-${{ matrix.envs }}
restore-keys: generated-files # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install PlatformIO Core
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Clean old build files
run: pio run --target clean -e ${{ matrix.envs }}
- name: Build Firmware
run: pio run -e ${{ matrix.envs }}
- name: Build Filesystem
run: pio run --target buildfs -e ${{ matrix.envs }}
#########################################################################################
## Build Package
#########################################################################################
package:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
envs:
[
SIM800L_IP5306_VERSION_20190610,
SIM800L_AXP192_VERSION_20200327,
SIM800C_AXP192_VERSION_20200609,
SIM800L_IP5306_VERSION_20200811,
T-A7670X,
T-Call-A7670X-V1-0,
T-Call-A7670X-V1-1,
T-A7608X
]
steps:
- uses: actions/checkout@v4
- name: Update PlatformIO cache on every commit
uses: actions/cache@v4
with:
path: ~/.platformio
key: platformio-${{ github.run_id }}-${{ matrix.envs }}
restore-keys: platformio # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update generated-files cache on every commit
uses: actions/cache@v4
with:
path: |
.pio/build/${{ matrix.envs }}/firmware.bin
.pio/build/${{ matrix.envs }}/partitions.bin
.pio/build/${{ matrix.envs }}/bootloader.bin
.pio/build/${{ matrix.envs }}/littlefs.bin
key: generated-files-${{ github.run_id }}-${{ matrix.envs }}
restore-keys: generated-files # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Update package cache on every commit
uses: actions/cache@v4
with:
path: package
key: package-${{ github.run_id }}-${{ matrix.envs }}
restore-keys: package # This matches above key as it is only used as a prefix. it the restores the nearest cache, see https://github.com/restore-keys:/blob/main/tips-and-workarounds.md#update-a-cache
- name: Set Variables
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "branch=$(echo ${{ github.ref_name }} | tr / __)" >> $GITHUB_OUTPUT
- name: Prepare package*.zip artifact
run: |
rm -rf package
mkdir -p package
rm -rf package/*.zip
cp -f ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin "package/boot_app0.bin"
cp -f ".pio/build/${{ matrix.envs }}/firmware.bin" "package/firmware.bin"
cp -f ".pio/build/${{ matrix.envs }}/bootloader.bin" "package/bootloader.bin"
cp -f ".pio/build/${{ matrix.envs }}/partitions.bin" "package/partitions.bin"
cp -f ".pio/build/${{ matrix.envs }}/littlefs.bin" "package/littlefs.bin"
cd ./package
- name: Upload package.zip artifact (Firmware + Bootloader + Partitions + LittleFS)
uses: actions/upload-artifact@v4
with:
name: "OBD2-MQTT-${{ matrix.envs }}-${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})"
path: ./package