Files
2025-05-19 12:25:04 +08:00

219 lines
7.8 KiB
YAML

name: Github Deploy
on: [ push, pull_request ]
defaults:
run:
shell: bash
jobs:
build-distribution:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install libegl1
run: |
sudo apt update && sudo apt install -y libegl1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
check-latest: true
- name: Set up Python venv
run: |
python3 -m venv .venv
source .venv/bin/activate
python3 -c "import sys; print(sys.version)"
python3 -m pip install --upgrade pip
- name: Download Python dependencies & latest asset files
run: |
python3 -m pip install setuptools wheel
python3 -m pip install -r requirements.txt
python3 -m pip install requests
python3 Deploy.py --download
- name: Build a binary wheel and a source tarball
run: |
python3 setup.py sdist bdist_wheel
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: |
dist/*.tar.gz
dist/*.whl
publish-to-pypi:
name: >-
Publish Python distribution to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build-distribution
- deploy-binaries
runs-on: ubuntu-latest
environment:
name: deploy-pypi
url: https://pypi.org/p/Furious-GUI
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
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.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: |
brew install create-dmg
if: runner.os == 'macOS'
# Remove problematic brew libs if Intel Mac
# Credits: https://github.com/RimSort/RimSort
- name: Remove problematic brew libs on Intel Mac
run: |
brew remove --force --ignore-dependencies openssl@3
brew cleanup openssl@3
if: runner.os == 'macOS' && runner.arch == 'X64'
- name: Set up Python
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: |
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
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: |
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
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
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
python -m pip install "Xray-core >= 1.8.8" "hysteria2 >= 2.0.4" "tun2socks > 2.5.2"
- name: Run deploy script
run: python Deploy.py
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: binary-distributions-${{ matrix.os }}-Python${{ matrix.python-version }}
path: |
*.zip
*.dmg
github-release:
name: >-
Upload to GitHub Release
needs:
- deploy-binaries
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
pattern: binary-distributions-*
merge-multiple: true
path: dist/
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
--prerelease
--generate-notes
--title 'Furious ${{ github.ref_name }}'
- name: Upload artifact to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'