-
-
Notifications
You must be signed in to change notification settings - Fork 186
138 lines (113 loc) · 5.49 KB
/
build.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
name: Test-build
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
# - feature/cicd-adjusts
jobs:
build_and_release:
name: Build for tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: pip install requests esptool
- name: Install PlatformIO Core
run: |
pip install platformio
platformio update
pio pkg install -p espressif32 -t toolchain-xtensa32
esp32_file="$HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/lib/libnet80211.a"
esp32s3_file="$HOME/.platformio/packages/[email protected]/tools/sdk/esp32s3/lib/libnet80211.a"
esp32_file_temp="$HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/lib/libnet80211_temp.a"
esp32s3_file_temp="$HOME/.platformio/packages/[email protected]/tools/sdk/esp32s3/lib/libnet80211_temp.a"
# Definir caminhos para as ferramentas objcopy
toolchain_esp32="$HOME/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/bin/objcopy"
toolchain_esp32s3="$HOME/.platformio/packages/toolchain-xtensa-esp32s3/xtensa-esp32s3-elf/bin/objcopy"
# Verificar se os arquivos existem antes de executar os comandos
if [[ -f "$esp32_file" && -f "$esp32s3_file" ]]; then
# Execute objcopy commands for ESP32
$toolchain_esp32 --weaken-symbol=ieee80211_raw_frame_sanity_check "$esp32_file" "$esp32_file_temp"
# Rename the original file to .old
mv "$esp32_file" "${esp32_file}.old"
# Rename the _temp to original
mv "$esp32_file_temp" "$esp32_file"
# Execute objcopy commands for ESP32-S3
$toolchain_esp32s3 --weaken-symbol=ieee80211_raw_frame_sanity_check "$esp32s3_file" "$esp32s3_file_temp"
# Rename the original file to .old
mv "$esp32s3_file" "${esp32s3_file}.old"
# Rename the _temp to original
mv "$esp32s3_file_temp" "$esp32s3_file"
echo "Done."
else
echo "One or more specified files were not found."
exit 1
fi
- name: Build Project
run: |
platformio run
- name: Merge output binaries files
run: |
esptool.py --chip esp32 merge_bin -o .pio/build/m5stack-cplus1_1/release.bin --flash_mode dio --flash_size 4MB 0x1000 .pio/build/m5stack-cplus1_1/bootloader.bin 0x8000 .pio/build/m5stack-cplus1_1/partitions.bin 0x10000 .pio/build/m5stack-cplus1_1/firmware.bin
esptool.py --chip esp32 merge_bin -o .pio/build/m5stack-cplus2/release.bin --flash_mode dio --flash_size 8MB 0x1000 .pio/build/m5stack-cplus2/bootloader.bin 0x8000 .pio/build/m5stack-cplus2/partitions.bin 0x10000 .pio/build/m5stack-cplus2/firmware.bin
esptool.py --chip esp32s3 merge_bin -o .pio/build/m5stack-cardputer/release.bin --flash_mode dio --flash_size 8MB 0x0000 .pio/build/m5stack-cardputer/bootloader.bin 0x8000 .pio/build/m5stack-cardputer/partitions.bin 0x10000 .pio/build/m5stack-cardputer/firmware.bin
- name: Rename release.bin files
run: |
for file in $(find .pio/build/**/ -name 'release.bin'); do
version=$(echo ${{ github.run_number }})
env=$(basename $(dirname "$file"))
new_name="Bruce_${env}_v0.0.$version.bin"
mv "$file" "$(dirname "$file")/$new_name"
done
chmod +r .pio/build/**/Bruce*.bin
ls .pio/build/**/Bruce*.bin
if: github.event_name != 'pull_request'
- name: Upload Binaries
id: upload_binaries_Cplus
uses: actions/upload-artifact@v3
with:
path: .pio/build/m5stack-cplus1_1/Bruce*.bin
if: github.event_name != 'pull_request'
- name: Upload Binaries
id: upload_binaries_Cplus2
uses: actions/upload-artifact@v3
with:
path: .pio/build/m5stack-cplus2/Bruce*.bin
if: github.event_name != 'pull_request'
- name: Upload Binaries_Card
id: upload_binaries
uses: actions/upload-artifact@v3
with:
path: .pio/build/m5stack-cardputer/Bruce*.bin
if: github.event_name != 'pull_request'
#- name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.RELEASES_TOKEN }}
# with:
# tag_name: v0.0.${{ github.run_number }}
# release_name: v0.0.${{ github.run_number }}
# draft: true
# prerelease: false
# body: |
# Release automatically generated by CI/CD workflow.
# if: github.event_name != 'pull_request'
#- name: Upload Binaries Release Assets
# run: |
# for file in $(find .pio/build/** -name 'ESP_Web2Sd-Mgr*.bin'); do
# echo "Uploading $file"
# curl \
# -X POST \
# --data-binary @"$file" \
# -H "Authorization: Bearer ${{ secrets.RELEASES_TOKEN }}" \
# -H "Content-Type: application/octet-stream" \
# "${{ steps.create_release.outputs.upload_url }}=$(basename $file)"
# done