-
-
Notifications
You must be signed in to change notification settings - Fork 81
179 lines (149 loc) · 7.17 KB
/
main.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
name: PlatformIO CI
on:
workflow_dispatch:
push:
paths-ignore:
- "**.md"
jobs:
job_build_modulecode:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ~/.platformio
key: ${{ runner.os }}-platformio-2022-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('Pipfile.lock') }}
restore-keys: ${{ runner.os }}-pipenv-
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Create folders
run: |
mkdir -p ./ESPController/data/avr
mkdir -p ~/OUTPUT
mkdir -p ~/OUTPUT/Controller
mkdir -p ~/OUTPUT/ControllerBoardTest
mkdir -p ~/OUTPUT/Modules/HEX
mkdir -p ~/OUTPUT/Modules/BIN
pwd
ls
- name: Build code for ATTINY modules
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ATTINYCellModule --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ATTINYCellModule/platformio.ini
- name: Copy output
run: |
cp ./ATTINYCellModule/.pio/build/V*/*.hex ~/OUTPUT/Modules/HEX/
cp ./ATTINYCellModule/.pio/build/V*/*.bin ~/OUTPUT/Modules/BIN/
- name: Build code for STM32 modules
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/STM32All-In-One --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/STM32All-In-One/platformio.ini
- name: Copy STM32 binary firmware output files
run: |
cp ./STM32All-In-One/.pio/build/V*/*.bin ~/OUTPUT/Modules/BIN/
- name: Get latest esptool
run: |
git clone https://github.com/espressif/esptool.git
cd esptool
pip install --user -e .
cd ~
python -m esptool version
- name: Build code for ESP32 controller
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESPController --environment esp32-devkitc --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESPController/platformio.ini
- name: Copy output
run: |
cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.bin ~/OUTPUT/Controller/
cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.elf ~/OUTPUT/Controller/
cp ./ESPController/.pio/build/esp32-devkitc/partitions.bin ~/OUTPUT/Controller/
cp ./ESPController/.pio/build/esp32-devkitc/bootloader.bin ~/OUTPUT/Controller/
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin ~/OUTPUT/Controller/
cp ./ESPController/data/avr/manifest.json ~/OUTPUT/Modules/
- name: Build File System Image for ESP32
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESPController --target buildfs --environment esp32-devkitc
- name: Copy output
run: |
cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_filesystemimage_espressif32_esp32-devkitc.bin ~/OUTPUT/Controller/
- name: Build single ESP32 image
run: |
python -m esptool --chip esp32 merge_bin -o ~/OUTPUT/Controller/esp32-controller-firmware-complete.bin --flash_mode=keep --flash_size 4MB 0x1000 ~/OUTPUT/Controller/bootloader.bin 0x8000 ~/OUTPUT/Controller/partitions.bin 0xe000 ~/OUTPUT/Controller/boot_app0.bin 0x10000 ~/OUTPUT/Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin 0x1C0000 ~/OUTPUT/Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin 0x370000 ~/OUTPUT/Controller/diybms_controller_filesystemimage_espressif32_esp32-devkitc.bin
- name: Board test code for ESP32 controller
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESP32BoardTest --environment esp32-devkitc --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESP32BoardTest/platformio.ini
- name: Copy board test output
run: |
cp ./ESP32BoardTest/.pio/build/esp32-devkitc/diybms_boardtest_espressif32_esp32-devkitc.bin ~/OUTPUT/ControllerBoardTest/
- name: Publish Artifacts 1
uses: actions/upload-artifact@v3
with:
name: DIYBMS-Compiled
path: ~/OUTPUT
if-no-files-found: error
job_zip_code:
runs-on: ubuntu-latest
needs: [job_build_modulecode]
steps:
- name: Download artifact DIYBMS-Compiled
uses: actions/download-artifact@v3
with:
name: DIYBMS-Compiled
- name: Rename over-the-air firmware
run: mv ./Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin ./Controller/esp32-controller-firmware-over-the-air.bin
- name: Display structure of downloaded files
run: ls -R
- name: ZIP output for release
run: |
zip release.zip ./Controller/esp32-controller-firmware-complete.bin
zip release.zip ./Controller/esp32-controller-firmware-over-the-air.bin
zip release.zip ./ControllerBoardTest/diybms_boardtest_espressif32_esp32-devkitc.bin
zip release.zip ./Modules/manifest.json
zip release.zip ./Modules/HEX/*.*
zip release.zip ./Modules/BIN/module_fw_V490*.*
- name: Get current date
id: date
run: echo "dt=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_ENV
- name: Rename ZIP
run: mv release.zip release_${{ env.dt }}.zip
- name: Publish Artifact
uses: actions/upload-artifact@v3
with:
name: DIYBMS-Release-Artifact-${{ env.dt }}
path: |
./Controller/*.*
./Modules/manifest.json
./Modules/HEX/*.*
./Modules/BIN/module_fw_V490*.bin
if-no-files-found: error
- name: Create Release Files on MASTER branch only
id: create_release
uses: actions/create-release@v1
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: Tag-${{ env.dt }}
release_name: Release-${{ env.dt }}
body: |
Automatically generated release
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release_${{ env.dt }}.zip
asset_name: Compiled_Firmware_${{ env.dt }}.zip
asset_content_type: application/zip