Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 96c2c71

Browse filesBrowse files
ci(tools): Fix tools workflows (espressif#9846)
* ci(tools): Remove ARM64 runner and use get.exe * ci(tools): Optimize get.py and verify extraction * change(tools): Push generated binaries to PR --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 99750cd commit 96c2c71
Copy full SHA for 96c2c71

File tree

4 files changed

+58
-47
lines changed
Filter options

4 files changed

+58
-47
lines changed

‎.github/scripts/install-arduino-core-esp32.sh

Copy file name to clipboardExpand all lines: .github/scripts/install-arduino-core-esp32.sh
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
2828
#git submodule update --init --recursive > /dev/null 2>&1
2929

3030
echo "Installing Platform Tools ..."
31-
cd tools && python get.py
31+
if [ "$OS_IS_WINDOWS" == "1" ]; then
32+
cd tools && ./get.exe
33+
else
34+
cd tools && python get.py
35+
fi
3236
cd $script_init_path
3337

3438
echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"

‎.github/workflows/build_py_tools.yml

Copy file name to clipboardExpand all lines: .github/workflows/build_py_tools.yml
+15-11Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ name: Build Python Tools
33
on:
44
pull_request:
55
paths:
6-
- 'tools/get.py'
7-
- 'tools/espota.py'
8-
- 'tools/gen_esp32part.py'
9-
- 'tools/gen_insights_package.py'
6+
- '.github/workflows/build_py_tools.yml'
7+
- 'tools/get.py'
8+
- 'tools/espota.py'
9+
- 'tools/gen_esp32part.py'
10+
- 'tools/gen_insights_package.py'
1011

1112
jobs:
1213
find-changed-tools:
@@ -21,6 +22,13 @@ jobs:
2122
with:
2223
fetch-depth: 2
2324
ref: ${{ github.event.pull_request.head.ref }}
25+
26+
- name: Check if checkout failed
27+
if: failure()
28+
run: |
29+
echo "Checkout failed."
30+
echo "Make sure you are using a branch inside the repository and not a fork."
31+
2432
- name: Verify Python Tools Changed
2533
uses: tj-actions/changed-files@v41
2634
id: verify-changed-files
@@ -47,7 +55,7 @@ jobs:
4755
strategy:
4856
fail-fast: false
4957
matrix:
50-
os: [windows-latest, macos-latest, ubuntu-20.04, ARM, ARM64]
58+
os: [windows-latest, macos-latest, ubuntu-20.04, ARM]
5159
include:
5260
- os: windows-latest
5361
TARGET: win64
@@ -63,10 +71,6 @@ jobs:
6371
CONTAINER: python:3.8-bullseye
6472
TARGET: arm
6573
SEPARATOR: ':'
66-
- os: ARM64
67-
CONTAINER: python:3.8-bullseye
68-
TARGET: arm64
69-
SEPARATOR: ':'
7074
container: ${{ matrix.CONTAINER }} # use python container on ARM
7175
env:
7276
DISTPATH: pytools-${{ matrix.TARGET }}
@@ -93,7 +97,7 @@ jobs:
9397
ref: ${{ github.event.pull_request.head.ref }}
9498
- name: Set up Python 3.8
9599
# Skip setting python on ARM because of missing compatibility: https://github.com/actions/setup-python/issues/108
96-
if: matrix.os != 'ARM' && matrix.os != 'ARM64'
100+
if: matrix.os != 'ARM'
97101
uses: actions/setup-python@master
98102
with:
99103
python-version: 3.8
@@ -108,7 +112,7 @@ jobs:
108112
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=.github/pytools/espressif.ico tools/$tool.py
109113
done
110114
- name: Sign binaries
111-
if: matrix.os == 'windows-latest' && env.CERTIFICATE != '' && env.CERTIFICATE_PASSWORD != ''
115+
if: matrix.os == 'windows-latest'
112116
env:
113117
CERTIFICATE: ${{ secrets.CERTIFICATE }}
114118
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}

‎tools/get.exe

Copy file name to clipboard
-7.38 KB
Binary file not shown.

‎tools/get.py

Copy file name to clipboardExpand all lines: tools/get.py
+38-35Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -101,52 +101,46 @@ def verify_files(filename, destination, rename_to):
101101
t1 = time.time()
102102
if filename.endswith(".zip"):
103103
try:
104-
with zipfile.ZipFile(filename, "r") as archive:
105-
first_dir = archive.namelist()[0].split("/")[0]
106-
total_files = len(archive.namelist())
107-
for i, zipped_file in enumerate(archive.namelist(), 1):
108-
local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1))
109-
if not os.path.exists(local_path):
110-
print(f"\nMissing {zipped_file} on location: {extracted_dir_path}")
111-
print(f"Verification failed; aborted in {format_time(time.time() - t1)}")
112-
return False
113-
print_verification_progress(total_files, i, t1)
104+
archive = zipfile.ZipFile(filename, "r")
105+
file_list = archive.namelist()
114106
except zipfile.BadZipFile:
115-
print(f"Verification failed; aborted in {format_time(time.time() - t1)}")
107+
if verbose:
108+
print(f"Verification failed; aborted in {format_time(time.time() - t1)}")
116109
return False
117110
elif filename.endswith(".tar.gz"):
118111
try:
119-
with tarfile.open(filename, "r:gz") as archive:
120-
first_dir = archive.getnames()[0].split("/")[0]
121-
total_files = len(archive.getnames())
122-
for i, zipped_file in enumerate(archive.getnames(), 1):
123-
local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1))
124-
if not os.path.exists(local_path):
125-
print(f"\nMissing {zipped_file} on location: {extracted_dir_path}")
126-
print(f"Verification failed; aborted in {format_time(time.time() - t1)}")
127-
return False
128-
print_verification_progress(total_files, i, t1)
112+
archive = tarfile.open(filename, "r:gz")
113+
file_list = archive.getnames()
129114
except tarfile.ReadError:
130-
print(f"Verification failed; aborted in {format_time(time.time() - t1)}")
115+
if verbose:
116+
print(f"Verification failed; aborted in {format_time(time.time() - t1)}")
131117
return False
132118
elif filename.endswith(".tar.xz"):
133119
try:
134-
with tarfile.open(filename, "r:xz") as archive:
135-
first_dir = archive.getnames()[0].split("/")[0]
136-
total_files = len(archive.getnames())
137-
for i, zipped_file in enumerate(archive.getnames(), 1):
138-
local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1))
139-
if not os.path.exists(local_path):
140-
print(f"\nMissing {zipped_file} on location: {extracted_dir_path}")
141-
print(f"Verification failed; aborted in {format_time(time.time() - t1)}")
142-
return False
143-
print_verification_progress(total_files, i, t1)
120+
archive = tarfile.open(filename, "r:xz")
121+
file_list = archive.getnames()
144122
except tarfile.ReadError:
145-
print(f"Verification failed; aborted in {format_time(time.time() - t1)}")
123+
if verbose:
124+
print(f"Verification failed; aborted in {format_time(time.time() - t1)}")
146125
return False
147126
else:
148127
raise NotImplementedError("Unsupported archive type")
149128

129+
try:
130+
first_dir = file_list[0].split("/")[0]
131+
total_files = len(file_list)
132+
for i, zipped_file in enumerate(file_list, 1):
133+
local_path = os.path.join(extracted_dir_path, zipped_file.replace(first_dir, rename_to, 1))
134+
if not os.path.exists(local_path):
135+
if verbose:
136+
print(f"\nMissing {zipped_file} on location: {extracted_dir_path}")
137+
print(f"Verification failed; aborted in {format_time(time.time() - t1)}")
138+
return False
139+
print_verification_progress(total_files, i, t1)
140+
except Exception as e:
141+
print(f"\nError: {e}")
142+
return False
143+
150144
if verbose:
151145
print(f"\nVerification passed; completed in {format_time(time.time() - t1)}")
152146

@@ -231,7 +225,12 @@ def unpack(filename, destination, force_extract): # noqa: C901
231225
shutil.rmtree(rename_to)
232226
shutil.move(dirname, rename_to)
233227

234-
return True
228+
if verify_files(filename, destination, rename_to):
229+
print(" Files extracted successfully.")
230+
return True
231+
else:
232+
print(" Failed to extract files.")
233+
return False
235234

236235

237236
def download_file_with_progress(url, filename, start_time):
@@ -291,6 +290,7 @@ def get_tool(tool, force_download, force_extract):
291290
local_path = dist_dir + archive_name
292291
url = tool["url"]
293292
start_time = time.time()
293+
print("")
294294
if not os.path.isfile(local_path) or force_download:
295295
if verbose:
296296
print("Downloading '" + archive_name + "' to '" + local_path + "'")
@@ -421,6 +421,9 @@ def identify_platform():
421421
current_dir + "/../package/package_esp32_index.template.json", identified_platform
422422
)
423423
mkdir_p(dist_dir)
424+
425+
print("\nDownloading and extracting tools...")
426+
424427
for tool in tools_to_download:
425428
if is_test:
426429
print("Would install: {0}".format(tool["archiveFileName"]))
@@ -432,4 +435,4 @@ def identify_platform():
432435
print(f"Tool {tool['archiveFileName']} was corrupted, but re-downloading did not help!\n")
433436
sys.exit(1)
434437

435-
print("Platform Tools Installed")
438+
print("\nPlatform Tools Installed")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.