forked from espressif/esptool
-
Notifications
You must be signed in to change notification settings - Fork 1
154 lines (149 loc) · 5.49 KB
/
build_esptool.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Build esptool
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: [ubuntu-latest]
include:
- os: ubuntu-latest
TARGET: linux-amd64
SEPARATOR: ':'
env:
DISTPATH: esptool-${{ matrix.TARGET }}
STUBS_DIR: ./esptool/targets/stub_flasher/
EFUSE_DIR: ./espefuse/efuse_defs/
PIP_EXTRA_INDEX_URL: "https://dl.espressif.com/pypi"
steps:
- name: Checkout repository
uses: actions/checkout@master
- name: Set up Python 3.8
uses: actions/setup-python@master
with:
python-version: 3.8
- name: Install dependencies
run: |
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: 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: 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/')
needs: build-esptool-binaries
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Version ${{ github.ref }}
draft: true
prerelease: false
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
shell: bash
upload_assets:
name: Upload release assets
if: startsWith(github.ref, 'refs/tags/')
needs: create_release
runs-on: ubuntu-latest
strategy:
matrix:
TARGET: [macos, linux-amd64, win64]
env:
DISTPATH: esptool-${{ needs.create_release.outputs.VERSION }}-${{ matrix.TARGET }}
steps:
- name: Download built binaries
uses: actions/download-artifact@master
- name: Rename and package binaries
run: |
mv esptool-${{ matrix.TARGET }} ${{ env.DISTPATH }}
zip -r ${{ env.DISTPATH }}.zip ./${{ env.DISTPATH }}/*
- name: Upload release assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: "${{ env.DISTPATH }}.zip"
asset_name: "${{ env.DISTPATH }}.zip"
asset_content_type: application/zip