Skip to content

Commit 8faa934

Browse files
peterdragunradimkarnis
authored andcommitted
ci(github): don't use self-hosted runners for building esptool
Closes espressif#992
1 parent 4bc8d5b commit 8faa934

File tree

1 file changed

+62
-15
lines changed

1 file changed

+62
-15
lines changed

.github/workflows/build_esptool.yml

Lines changed: 62 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,72 @@ name: Build esptool
33
on: [push, pull_request]
44

55
jobs:
6+
build-esptool-binaries-arm:
7+
name: Build esptool binaries for ${{ matrix.platform }}
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
platform: [armv7, aarch64]
12+
env:
13+
DISTPATH: esptool-${{ matrix.platform }}
14+
STUBS_DIR: ./esptool/targets/stub_flasher/
15+
EFUSE_DIR: ./espefuse/efuse_defs/
16+
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi"
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@master
20+
- uses: uraimo/run-on-arch-action@v2
21+
name: Build and test in ${{ matrix.platform }}
22+
with:
23+
distro: ubuntu20.04
24+
shell: /bin/bash
25+
# Not required, but speeds up builds by storing container images in
26+
# a GitHub package registry.
27+
githubToken: ${{ github.token }}
28+
# Create an artifacts directory
29+
setup: mkdir -p "${PWD}/${{ env.DISTPATH }}"
30+
dockerRunArgs: --volume "${PWD}/${{ env.DISTPATH }}:/${{ env.DISTPATH }}"
31+
install: |
32+
apt-get update -y
33+
apt-get install -y python3 python3-pip python3-setuptools libffi-dev
34+
run: |
35+
adduser --disabled-password --gecos "" builder
36+
chmod -R a+rwx /home/runner/work/esptool
37+
su builder <<EOF
38+
export PATH=\$PATH:/home/builder/.local/bin
39+
# Install dependencies
40+
python -m pip install --upgrade pip
41+
# PyInstaller >=6.0 results in significantly more antivirus false positives
42+
pip install pyinstaller==5.13.2
43+
pip install --user -e .
44+
45+
# Build with PyInstaller
46+
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.STUBS_DIR }}1/*.json:${{ env.STUBS_DIR }}1/" --add-data="${{ env.STUBS_DIR }}2/*.json:${{ env.STUBS_DIR }}2/" esptool.py
47+
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico --add-data="${{ env.EFUSE_DIR }}*.yaml:${{ env.EFUSE_DIR }}" espefuse.py
48+
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico espsecure.py
49+
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=ci/espressif.ico esp_rfc2217_server.py
50+
51+
# Test binaries
52+
./${{ env.DISTPATH }}/esptool -h
53+
./${{ env.DISTPATH }}/espefuse -h
54+
./${{ env.DISTPATH }}/espsecure -h
55+
./${{ env.DISTPATH }}/esp_rfc2217_server -h
56+
57+
# Add license and readme
58+
mv LICENSE README.md ./${{ env.DISTPATH }}
59+
60+
- name: Archive artifact
61+
uses: actions/upload-artifact@master
62+
with:
63+
name: ${{ env.DISTPATH }}
64+
path: ${{ env.DISTPATH }}
65+
666
build-esptool-binaries:
767
name: Build esptool binaries for ${{ matrix.platform }}
868
runs-on: ${{ matrix.RUN_ON }}
969
strategy:
1070
matrix:
11-
platform: [macos-amd64, macos-arm64, windows, linux-amd64, linux-arm32, linux-arm64]
71+
platform: [macos-amd64, macos-arm64, windows, linux-amd64]
1272
include:
1373
- platform: macos-amd64
1474
TARGET: macos-amd64
@@ -27,17 +87,6 @@ jobs:
2787
TARGET: linux-amd64
2888
SEPARATOR: ':'
2989
RUN_ON: ubuntu-20.04
30-
- platform: linux-arm32
31-
CONTAINER: python:3.8-bullseye
32-
TARGET: linux-arm32
33-
SEPARATOR: ':'
34-
RUN_ON: [ARM, self-hosted, linux, docker]
35-
- platform: linux-arm64
36-
CONTAINER: python:3.8-bullseye
37-
TARGET: linux-arm64
38-
SEPARATOR: ':'
39-
RUN_ON: [ARM64, self-hosted, linux]
40-
container: ${{ matrix.CONTAINER }} # use python container on ARM
4190
env:
4291
DISTPATH: esptool-${{ matrix.TARGET }}
4392
STUBS_DIR: ./esptool/targets/stub_flasher/
@@ -47,8 +96,6 @@ jobs:
4796
- name: Checkout repository
4897
uses: actions/checkout@master
4998
- name: Set up Python 3.8
50-
# Skip setting python on ARM because of missing compatibility: https://github.com/actions/setup-python/issues/108
51-
if: matrix.platform != 'linux-arm32' && matrix.platform != 'linux-arm64'
5299
uses: actions/setup-python@master
53100
with:
54101
python-version: 3.8
@@ -94,7 +141,7 @@ jobs:
94141
create_release:
95142
name: Create GitHub release
96143
if: startsWith(github.ref, 'refs/tags/') && !(contains(github.ref_name, 'dev'))
97-
needs: build-esptool-binaries
144+
needs: [build-esptool-binaries, build-esptool-binaries-arm]
98145
runs-on: ubuntu-latest
99146
env:
100147
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi"

0 commit comments

Comments
 (0)