Skip to content

Commit

Permalink
ci: don't use self-hosted runners
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdragun committed Nov 26, 2024
1 parent 39a12a4 commit 40ca1a9
Showing 1 changed file with 90 additions and 11 deletions.
101 changes: 90 additions & 11 deletions .github/workflows/build_esptool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,58 @@ name: Build esptool
on: [push, pull_request]

jobs:
# build-esptool-binaries-arm:
# name: Build esptool binaries for ${{ matrix.platform }}
# runs-on: ${{ matrix.RUN_ON }}
# strategy:
# matrix:
# platform: [armv7, aarch64]
# container: python:3.8-bullseye
# env:
# SEPARATOR: ':'
# DISTPATH: esptool-${{ matrix.platform }}
# STUBS_DIR: ./esptool/targets/stub_flasher/
# EFUSE_DIR: ./espefuse/efuse_defs/
# PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi"
# steps:
# - uses: uraimo/run-on-arch-action@v2
# if: matrix.platform == 'armv7' && matrix.platform == 'aarch64'
# name: Build and test in ${{ matrix.platform }}
# with:
# arch: ${{ matrix.platform }}
# distro: ubuntu20.04
# run: |
# # Install dependencies
# pip install pyinstaller==5.13.2
# pip install --user -e .

# # Build with PyInstaller
# pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.STUBS_DIR }}1/*.json${{ matrix.SEPARATOR }}${{ env.STUBS_DIR }}1/" --add-data="${{ env.STUBS_DIR }}2/*.json${{ matrix.SEPARATOR }}${{ env.STUBS_DIR }}2/" 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

# # Test binaries
# ./${{ 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

# # Add license and readme
# mv LICENSE README.md ./${{ env.DISTPATH }}

# - name: Archive artifact
# uses: actions/upload-artifact@master
# with:
# name: ${{ env.DISTPATH }}
# path: ${{ env.DISTPATH }}

build-esptool-binaries:
name: Build esptool binaries for ${{ matrix.platform }}
runs-on: ${{ matrix.RUN_ON }}
strategy:
matrix:
platform: [macos-amd64, macos-arm64, windows, linux-amd64, linux-arm32, linux-arm64]
platform: [macos-amd64, macos-arm64, windows, linux-amd64, armv7, aarch64]
include:
- platform: macos-amd64
TARGET: macos-amd64
Expand All @@ -27,17 +73,14 @@ jobs:
TARGET: linux-amd64
SEPARATOR: ':'
RUN_ON: ubuntu-20.04
- platform: linux-arm32
CONTAINER: python:3.8-bullseye
TARGET: linux-arm32
- platform: armv7
TARGET: armv7
SEPARATOR: ':'
RUN_ON: [ARM, self-hosted, linux, docker]
- platform: linux-arm64
CONTAINER: python:3.8-bullseye
TARGET: linux-arm64
RUN_ON: ubuntu-latest
- platform: aarch64
TARGET: aarch64
SEPARATOR: ':'
RUN_ON: [ARM64, self-hosted, linux]
container: ${{ matrix.CONTAINER }} # use python container on ARM
RUN_ON: ubuntu-latest
env:
DISTPATH: esptool-${{ matrix.TARGET }}
STUBS_DIR: ./esptool/targets/stub_flasher/
Expand All @@ -48,22 +91,57 @@ jobs:
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.platform != 'linux-arm32' && matrix.platform != 'linux-arm64'
if: matrix.platform != 'armv7' && matrix.platform != 'aarch64'
uses: actions/setup-python@master
with:
python-version: 3.8
- name: Install dependencies
# PyInstaller >=6.0 results in significantly more antivirus false positives
if: matrix.platform != 'armv7' && matrix.platform != 'aarch64'
run: |
python -m pip install --upgrade pip
pip install pyinstaller==5.13.2
pip install --user -e .
- name: Build with PyInstaller
if: matrix.platform != 'armv7' && matrix.platform != 'aarch64'
run: |
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.STUBS_DIR }}1/*.json${{ matrix.SEPARATOR }}${{ env.STUBS_DIR }}1/" --add-data="${{ env.STUBS_DIR }}2/*.json${{ matrix.SEPARATOR }}${{ env.STUBS_DIR }}2/" 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: Build and test in ${{ matrix.platform }}
uses: uraimo/run-on-arch-action@v2
if: matrix.platform == 'armv7' || matrix.platform == 'aarch64'
with:
arch: ${{ matrix.platform }}
distro: ubuntu20.04
shell: /bin/bash
install: |
apt-get update -y
apt-get install -y python3 python3-pip python3-setuptools
run: |
adduser --disabled-password --gecos "" builder
# chmod -R a+rwx /sources
su builder <<EOF
# Install dependencies
pip3 install pyinstaller==5.13.2
pip3 install --user -e .
# Build with PyInstaller
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.STUBS_DIR }}1/*.json${{ matrix.SEPARATOR }}${{ env.STUBS_DIR }}1/" --add-data="${{ env.STUBS_DIR }}2/*.json${{ matrix.SEPARATOR }}${{ env.STUBS_DIR }}2/" 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
# Test binaries
./${{ 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
# Add license and readme
mv LICENSE README.md ./${{ env.DISTPATH }}
# TODO collect artifacts
- name: Sign binaries
if: matrix.platform == 'windows' && github.event_name != 'pull_request'
env:
Expand All @@ -76,6 +154,7 @@ jobs:
./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/espsecure.exe
./ci/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/esp_rfc2217_server.exe
- name: Test binaries
if: matrix.platform != 'armv7' && matrix.platform != 'aarch64'
shell: bash
run: |
./${{ env.DISTPATH }}/esptool${{ matrix.EXTEN }} -h
Expand Down

0 comments on commit 40ca1a9

Please sign in to comment.