Skip to content

Commit

Permalink
Merge branch 'main_work' into merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Jan 25, 2024
2 parents 4c2e113 + 75a1848 commit 19b402f
Show file tree
Hide file tree
Showing 35 changed files with 4,817 additions and 268 deletions.
115 changes: 39 additions & 76 deletions .github/workflows/build_esptool.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
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: [macos-latest, ubuntu-latest, windows-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 +33,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,78 +41,48 @@ jobs:
python -m pip install --upgrade pip
pip install pyinstaller
pip install --user -e .
- 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
- name: Build stub
if: matrix.os == 'ubuntu-latest'
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: |
./${{ env.DISTPATH }}/esptool${{ matrix.EXTEN }} -h
./${{ env.DISTPATH }}/espefuse${{ matrix.EXTEN }} -h
./${{ env.DISTPATH }}/espsecure${{ matrix.EXTEN }} -h
./${{ env.DISTPATH }}/esp_rfc2217_server${{ matrix.EXTEN }} -h
- name: Add license and readme
shell: bash
run: mv LICENSE README.md ./${{ env.DISTPATH }}
- name: Archive artifact
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: ${{ env.DISTPATH }}
path: ${{ env.DISTPATH }}
name: stubs
path: /home/runner/work/esptool/esptool/flasher_stub/build

create_release:
name: Create GitHub release
if: startsWith(github.ref, 'refs/tags/') && !(contains(github.ref_name, 'dev'))
push_stubs:
name: Commit changed files
needs: build-esptool-binaries
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Get version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
shell: bash
- name: Checkout
- name: Checkout repository
uses: actions/checkout@master
with:
fetch-depth: 0
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --user -e ".[dev]"
- name: Generate changelog
run: |
cz changelog ${{ steps.get_version.outputs.VERSION }} --template ci/gh_changelog_template.md.j2 --file-name changelog_body.md
cat changelog_body.md
- name: Download built binaries
- name: Download builded stubs
uses: actions/download-artifact@master
- name: Compress and rename binaries
with:
name: stubs
path: ./mv_stubs
- name: Display structure of downloaded files
run: |
ls -R
- name: Move stubs in folder
run: |
for dir in esptool-*; do
zip -r "esptool-v${{ steps.get_version.outputs.VERSION }}-${dir#esptool-}.zip" "$dir"
done
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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:
body_path: changelog_body.md
name: Version ${{ steps.get_version.outputs.VERSION }}
draft: true
prerelease: false
files: esptool-v${{ steps.get_version.outputs.VERSION }}-*.zip
commit_message: Stubs updated
25 changes: 0 additions & 25 deletions .github/workflows/dangerjs.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/dev_release_esptool_pypi.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/issue_comment.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/new_issues.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/new_prs.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/release_esptool_pypi.yml

This file was deleted.

21 changes: 4 additions & 17 deletions .github/workflows/test_esptool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- name: Checkout ref commit
Expand Down Expand Up @@ -46,8 +46,8 @@ jobs:
pytest -m host_test
pytest test/test_espsecure_hsm.py
- name: Build stub (Python 3.7 only)
if: matrix.python-version == 3.7
- name: Build stub (Python 3.9 only)
if: matrix.python-version == 3.9
run: |
export TOOLCHAIN_DIR=$HOME/toolchain
Expand All @@ -62,17 +62,4 @@ jobs:
./ci/setup_ci_build_env.sh
make -C flasher_stub V=1
cd flasher_stub && python ./compare_stubs.py
lint_esptool:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: Lint with flake8
run: |
pip install --extra-index-url https://dl.espressif.com/pypi -e .[dev]
python -m flake8
- name: Check formatting with Black
uses: psf/black@stable
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ local.mk
report.xml

docs/_build/
.DS_Store
Loading

0 comments on commit 19b402f

Please sign in to comment.