Skip to content

Commit

Permalink
Update build_esptool.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Nov 11, 2023
1 parent afaa7d2 commit 3295524
Showing 1 changed file with 54 additions and 34 deletions.
88 changes: 54 additions & 34 deletions .github/workflows/build_esptool.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
name: Build esptool

on: [push, pull_request]
on:
workflow_dispatch:
push:
paths-ignore:
- '.github/**' # Ignore changes towards the .github directory

jobs:
build-esptool-binaries:
name: Build esptool binaries for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-20.04, windows-latest, ARM, ARM64]
os: [ubuntu-latest]
include:
- os: macos-latest
TARGET: macos
SEPARATOR: ':'
- os: ubuntu-20.04
- os: ubuntu-latest
TARGET: linux-amd64
SEPARATOR: ':'
- os: windows-latest
TARGET: win64
EXTEN: .exe
SEPARATOR: ';'
- os: ARM
CONTAINER: python:3.8-bullseye
TARGET: arm
SEPARATOR: ':'
- os: ARM64
CONTAINER: python:3.8-bullseye
TARGET: arm64
SEPARATOR: ':'
container: ${{ matrix.CONTAINER }} # use python container on ARM
env:
DISTPATH: esptool-${{ matrix.TARGET }}
STUBS_DIR: ./esptool/targets/stub_flasher/
Expand All @@ -38,8 +26,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@master
- name: Set up Python 3.8
# Skip setting python on ARM because of missing compatibility: https://github.com/actions/setup-python/issues/108
if: matrix.os != 'ARM' && matrix.os != 'ARM64'
uses: actions/setup-python@master
with:
python-version: 3.8
Expand All @@ -48,23 +34,30 @@ jobs:
python -m pip install --upgrade pip
pip install pyinstaller
pip install --user -e .
- name: Build stub
if: matrix.os == 'ubuntu-latest'
run: |
export TOOLCHAIN_DIR=$HOME/toolchain
export ESP8266_BINDIR=$TOOLCHAIN_DIR/xtensa-lx106-elf/bin
export ESP32_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32-elf/bin
export ESP32S2_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32s2-elf/bin
export ESP32S3_BINDIR=$TOOLCHAIN_DIR/xtensa-esp32s3-elf/bin
export ESP32C3_BINDIR=$TOOLCHAIN_DIR/riscv32-esp-elf/bin
export PATH=$PATH:$ESP8266_BINDIR:$ESP32_BINDIR:$ESP32S2_BINDIR:$ESP32S3_BINDIR:$ESP32C3_BINDIR
./ci/setup_ci_build_env.sh
make -C flasher_stub V=1
- name: Archive stubs artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@master
with:
name: stubs
path: /home/runner/work/esptool/esptool/flasher_stub/build
- name: Build with PyInstaller
run: |
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.STUBS_DIR }}*.json${{ matrix.SEPARATOR }}${{ env.STUBS_DIR }}" esptool.py
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.EFUSE_DIR }}*.yaml${{ matrix.SEPARATOR }}${{ env.EFUSE_DIR }}" espefuse.py
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico espsecure.py
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico esp_rfc2217_server.py
- name: Sign binaries
if: matrix.os == 'windows-latest' && github.event_name != 'pull_request'
env:
CERTIFICATE: ${{ secrets.CERTIFICATE }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
shell: pwsh
run: |
./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/esptool.exe
./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/espefuse.exe
./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/espsecure.exe
./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/esp_rfc2217_server.exe
- name: Test binaries
shell: bash
run: |
Expand All @@ -74,13 +67,40 @@ jobs:
./${{ env.DISTPATH }}/esp_rfc2217_server${{ matrix.EXTEN }} -h
- name: Add license and readme
shell: bash
run: mv LICENSE README.md ./${{ env.DISTPATH }}
run: cp LICENSE README.md ./${{ env.DISTPATH }}
- name: Archive artifact
uses: actions/upload-artifact@master
with:
name: ${{ env.DISTPATH }}
path: ${{ env.DISTPATH }}

push_stubs:
name: Commit changed files
needs: build-esptool-binaries
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@master
with:
fetch-depth: 0
- name: Download builded stubs
uses: actions/download-artifact@master
with:
name: stubs
path: ./mv_stubs
- name: Display structure of downloaded files
run: |
ls -R
- name: Move stubs in folder
run: |
rm ./esptool/targets/stub_flasher/*
cp -R ./mv_stubs/*.json ./esptool/targets/stub_flasher
ls -R ./esptool/targets/stub_flasher
rm -rf ./mv_stubs
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Stubs updated

create_release:
name: Create GitHub release
if: startsWith(github.ref, 'refs/tags/')
Expand Down Expand Up @@ -112,7 +132,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
TARGET: [macos, linux-amd64, win64, arm, arm64]
TARGET: [macos, linux-amd64, win64]
env:
DISTPATH: esptool-${{ needs.create_release.outputs.VERSION }}-${{ matrix.TARGET }}
steps:
Expand Down

0 comments on commit 3295524

Please sign in to comment.