Skip to content

Commit 98eb78f

Browse files
committed
Nuitka Package and Upload(dev) update upx installer and use more os bulid
1 parent 6ecca80 commit 98eb78f

1 file changed

Lines changed: 51 additions & 8 deletions

File tree

.github/workflows/dev_package_and_upload.yml

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ on:
2020
# - 'package/nuitka_config.yml'
2121

2222
jobs:
23-
package-and-release:
24-
runs-on: windows-latest
23+
package-and-upload:
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
matrix:
27+
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm]
2528
env:
2629
PYTHON_VERSION: '3.10'
2730
NUITKA_CACHE_DIR: ${{ github.workspace }}/nuitka-cache
31+
UPXVERSION: '5.0.1'
2832

2933
# 添加必要的权限
3034
permissions:
@@ -44,21 +48,60 @@ jobs:
4448
uses: actions/setup-python@v5
4549
with:
4650
python-version: ${{ env.PYTHON_VERSION }}
47-
51+
4852
- name: Cache UPX
4953
id: cache-upx
5054
uses: actions/cache@v4
5155
with:
5256
path: upx
53-
key: ${{ runner.os }}-${{ runner.arch }}-upx-v5.0.1
57+
key: ${{ runner.os }}-${{ runner.arch }}-upx-v${{ UPXVERSION }}
5458
restore-keys: |
5559
${{ runner.os }}-${{ runner.arch }}-upx-
56-
57-
- name: UPX Setup
60+
61+
- name: Create UPX directory
5862
if: ${{ steps.cache-upx.outputs.cache-hit != 'true' }}
63+
run: mkdir -p ./upx
64+
65+
- name: Install UPX on Linux
66+
if: ${{ runner.os == 'Linux' && steps.cache-upx.outputs.cache-hit != 'true' }}
67+
run: |
68+
case "${{ runner.arch }}" in
69+
amd64)
70+
UPX_ARCH=x86_64
71+
;;
72+
arm64)
73+
UPX_ARCH=aarch64
74+
;;
75+
esac
76+
77+
UPX_VERSION=${{ UPXVERSION}}
78+
UPX_URL="https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-linux-${UPX_ARCH}.tar.xz"
79+
80+
curl -L "$UPX_URL" -o upx.tar.xz
81+
tar -xf upx.tar.xz -C ./upx --strip-components=1
82+
chmod +x ./upx/upx
83+
84+
shell: bash
85+
86+
- name: Install UPX on Windows
87+
if: ${{ runner.os == 'Windows' && steps.cache-upx.outputs.cache-hit != 'true' }}
88+
run: |
89+
$arch = if (("${{ runner.arch }}" -eq "amd64") -or ("${{ runner.arch }}" -eq "X64")) { "win64" } else { "win32" }
90+
$upxVersion = "${{ env.UPXVERSION }}"
91+
$upxUrl = "https://github.com/upx/upx/releases/download/v$upxVersion/upx-$upxVersion-$arch.zip"
92+
93+
Invoke-WebRequest -Uri $upxUrl -OutFile upx.zip
94+
Expand-Archive -Path upx.zip -DestinationPath ./upx -Force
95+
96+
# Windows 版本的 UPX 解压后在子目录中,需要移动到根目录
97+
Move-Item -Path "./upx/upx-$upxVersion-$arch/*" -Destination ./upx -Force
98+
99+
shell: pwsh
100+
101+
- name: Verify UPX installation
59102
run: |
60-
mkdir upx
61-
curl -o upx/upx.exe https://assets.ksable.top/github/upx/upx/v5.0.1/windows-amd64/upx.exe
103+
./upx/upx --version
104+
shell: bash
62105

63106
- name: get pip cache dir
64107
id: pip-cache-dir

0 commit comments

Comments
 (0)