From bc582f7a88ea1a671da432be8d9f45306480dee6 Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Mon, 19 May 2025 17:29:00 +0800 Subject: [PATCH] Update package release workflow Signed-off-by: Loren Eteval --- .github/workflows/deploy-pypi.yml | 70 ++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 16 deletions(-) diff --git a/.github/workflows/deploy-pypi.yml b/.github/workflows/deploy-pypi.yml index c0cb6d1..e1bba48 100644 --- a/.github/workflows/deploy-pypi.yml +++ b/.github/workflows/deploy-pypi.yml @@ -1,6 +1,6 @@ name: Github Deploy -on: [push, pull_request] +on: [ push, pull_request ] defaults: run: @@ -24,7 +24,7 @@ jobs: run: | python3 -m venv .venv source .venv/bin/activate - python3 --version + python3 -c "import sys; print(sys.version)" python3 -m pip install --upgrade pip - name: Download Python dependencies & latest asset files run: | @@ -68,15 +68,27 @@ jobs: deploy-binaries: name: Deploy binaries on ${{ matrix.os }} runs-on: ${{ matrix.os }} + continue-on-error: true strategy: matrix: - os: [windows-2022, macos-13, macos-14] - python-version: ["3.12"] + os: [ windows-2022, macos-13, macos-14 ] + python-version: [ "3.13" ] env: # Last PySide6 version that supports macOS 10.9 & Python 3.11 PYSIDE6_LEGACY_VERSION: "6.4.3" PYSIDE6_TARGET_VERSION: "6.8.3" + # Set by command line + # PYSIDE6_Windows_X64_TARGET_VERSION + # PYSIDE6_macOS_X64_TARGET_VERSION + # PYSIDE6_macOS_ARM64_TARGET_VERSION + # PySide6 has Windows ARM64 build since 6.9.0 + PYSIDE6_Windows_ARM64_TARGET_VERSION: "6.9.0" steps: + - name: Set platform environment variables version + run: | + echo "PYSIDE6_Windows_X64_TARGET_VERSION=$PYSIDE6_TARGET_VERSION" >> $GITHUB_ENV + echo "PYSIDE6_macOS_X64_TARGET_VERSION=$PYSIDE6_TARGET_VERSION" >> $GITHUB_ENV + echo "PYSIDE6_macOS_ARM64_TARGET_VERSION=$PYSIDE6_TARGET_VERSION" >> $GITHUB_ENV - uses: actions/checkout@v4 - name: Install macOS dependencies run: | @@ -93,48 +105,74 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + # Support Windows ARM64 build + architecture: ${{ runner.arch == 'ARM64' && 'arm64' || 'x64' }} check-latest: true - name: Set up Python venv run: | - python3 -m venv .venv if [ "$RUNNER_OS" == "macOS" ]; then + python3 -m venv .venv source .venv/bin/activate elif [ "$RUNNER_OS" == "Windows" ]; then + python -m venv .venv .venv/Scripts/activate else echo "$RUNNER_OS not supported" exit 1 fi - python3 --version - python3 -m pip install --upgrade pip + python -c "import sys; print(sys.version)" + python -m pip install --upgrade pip + - name: Install pre-built numpy wheel on Windows ARM64 + run: | + python -m pip install "https://github.com/LorenEteval/numpy-2.2.4-cp313-win_arm64/releases/download/2.2.4/numpy-2.2.4-cp313-cp313-win_arm64.whl" + if: runner.os == 'Windows' && runner.arch == 'ARM64' - name: Download Python dependencies & latest asset files run: | - python3 -m pip install setuptools wheel - python3 -m pip install PySide6-Essentials==$PYSIDE6_TARGET_VERSION - python3 -m pip install -r requirements.txt - python3 -m pip install "numpy<2" nuitka imageio - python3 -m pip install requests - python3 Deploy.py --download + python -m pip install setuptools wheel + python -m pip install PySide6-Essentials==$PYSIDE6_${{ runner.os }}_${{ runner.arch }}_TARGET_VERSION + python -m pip install -r requirements.txt + python -m pip install nuitka imageio + python -m pip install requests + python Deploy.py --download + - name: Download LLVM ARM64 Clang toolchain + # TODO: Need mingw-arm64 on Windows ARM64 + shell: pwsh + run: | + Invoke-WebRequest -Uri "https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.5/clang+llvm-20.1.5-aarch64-pc-windows-msvc.tar.xz" ` + -OutFile "clang+llvm-20.1.5-aarch64-pc-windows-msvc.tar.xz" + $newPath = ($env:PATH -split ";" | Where-Object { $_ -notlike "C:\Program Files\LLVM\bin" }) -join ";" + echo "PATH=$newPath" >> $env:GITHUB_ENV + mkdir C:\llvm-aarch64 + tar -xf clang+llvm-20.1.5-aarch64-pc-windows-msvc.tar.xz -C C:\llvm-aarch64 + echo "C:\llvm-aarch64\clang+llvm-20.1.5-aarch64-pc-windows-msvc\bin" >> $env:GITHUB_PATH + echo "CGO_ENABLED=1" >> $env:GITHUB_ENV + echo "CC=clang" >> $env:GITHUB_ENV + echo "CXX=clang++" >> $env:GITHUB_ENV + if: runner.os == 'Windows' && runner.arch == 'ARM64' - name: Set up go legacy uses: actions/setup-go@v4 with: go-version: "1.20" + # Support Windows ARM64 build + architecture: ${{ runner.arch == 'ARM64' && 'arm64' || 'x64' }} check-latest: true - name: Install go legacy dependencies run: | go version - python3 -m pip install "hysteria > 1.3.5" + python -m pip install "hysteria > 1.3.5" - name: Set up go uses: actions/setup-go@v4 with: go-version: "1.24" + # Support Windows ARM64 build + architecture: ${{ runner.arch == 'ARM64' && 'arm64' || 'x64' }} check-latest: true - name: Install go dependencies run: | go version - python3 -m pip install "Xray-core >= 1.8.8" "hysteria2 >= 2.0.4" "tun2socks > 2.5.2" + python -m pip install "Xray-core >= 1.8.8" "hysteria2 >= 2.0.4" "tun2socks > 2.5.2" - name: Run deploy script - run: python3 Deploy.py + run: python Deploy.py - name: Store the distribution packages uses: actions/upload-artifact@v4 with: