Update tururururu.cpp #62
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: 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 |