feat: use qt-native components; refactor Windows Fluent UI #238
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- "v*" | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
permissions: write-all | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
os_name: windows | |
arch: amd64 | |
- os: windows-latest | |
os_name: windows | |
arch: arm64 | |
- os: macos-latest | |
os_name: darwin | |
arch: amd64 | |
target_arch: x86_64 | |
- os: macos-latest | |
os_name: darwin | |
arch: arm64 | |
target_arch: arm64 | |
- os: ubuntu-latest | |
os_name: linux | |
arch: amd64 | |
- os: ubuntu-24.04-arm | |
os_name: linux | |
arch: arm64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: ".python-version" | |
- name: Install uv and restore cache | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "0.6.0" | |
enable-cache: true | |
cache-dependency-glob: "uv.lock" | |
- name: Install Dependencies | |
run: uv sync | |
- name: Cache apt packages | |
if: runner.os == 'Linux' | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: libglib2.0-0 libgl1 dpkg-dev debhelper | |
libxcb-xinerama0 | |
libxkbcommon-x11-0 | |
libxcb-icccm4 | |
libxcb-image0 | |
libxcb-keysyms1 | |
libxcb-randr0 | |
libxcb-render-util0 | |
libxcb-xfixes0 | |
libxcb-shape0 | |
libxcb-cursor0 | |
libxcb-sync1 | |
libxcb-xkb1 | |
libxcb1 | |
version: 1.0 | |
- name: Build Executable (macOS) | |
if: runner.os == 'macOS' | |
run: | | |
source .venv/bin/activate | |
mkdir -p core | |
curl -L "https://github.com/Mythologyli/zju-connect/releases/latest/download/zju-connect-darwin-${{ matrix.arch }}.zip" -o core/zju-connect.zip | |
unzip -o core/zju-connect.zip -d core | |
rm core/zju-connect.zip | |
pyinstaller --clean --windowed \ | |
--target-arch ${{ matrix.target_arch }} \ | |
--add-data "app:app" \ | |
--add-data "utils:utils" \ | |
--add-data "core/zju-connect:core" \ | |
--add-data ".app-version:." \ | |
--icon app/resources/icons/icon.icns \ | |
-n "HITSZ Connect Verge" main.py | |
- name: Create DMG (macOS) | |
if: runner.os == 'macOS' | |
run: | | |
brew install create-dmg | |
create-dmg \ | |
--volname "HITSZ Connect Verge" \ | |
--background "app/resources/bg.svg" \ | |
--window-pos 400 200 \ | |
--window-size 660 400 \ | |
--icon-size 100 \ | |
--icon "HITSZ Connect Verge.app" 160 185 \ | |
--app-drop-link 500 185 \ | |
"dist/hitsz-connect-verge-${{ matrix.os_name }}-${{ matrix.arch }}.dmg" \ | |
"dist/HITSZ Connect Verge.app" | |
- name: Setup UPX (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
mkdir -p upx | |
Invoke-WebRequest -Uri "https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-win64.zip" -OutFile "upx.zip" | |
Expand-Archive -Path "upx.zip" -DestinationPath "upx" | |
Remove-Item -Path "upx.zip" | |
- name: Build Executable (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
.\.venv\Scripts\Activate.ps1 | |
mkdir -p core | |
Invoke-WebRequest -Uri "https://github.com/Mythologyli/zju-connect/releases/latest/download/zju-connect-windows-${{ matrix.arch }}.zip" -OutFile "core\zju-connect-windows-${{ matrix.arch }}.zip" | |
Expand-Archive -Path "core\zju-connect-windows-${{ matrix.arch }}.zip" -DestinationPath "core" | |
Remove-Item -Path "core\zju-connect-windows-${{ matrix.arch }}.zip" | |
pyside6-rcc .\app\resources\resources.qrc -o .\app\common\resources.py | |
pyinstaller --clean --noconsole ` | |
--add-data "app;app" ` | |
--add-data "utils;utils" ` | |
--add-data "core\zju-connect.exe;core" ` | |
--add-data ".app-version;." ` | |
--icon "app\resources\icons\icon.ico" ` | |
--upx-dir "upx\upx-4.2.4-win64" ` | |
-n "HITSZ Connect Verge" main_fluent2.py | |
# Install Inno Setup | |
choco install innosetup -y | |
# Compile installer | |
$version = Get-Content .app-version -Raw | |
iscc /DMyAppVersion="$version" ` | |
/DArchitecture="${{ matrix.arch }}" ` | |
installer.iss | |
- name: Setup UPX (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
if [ "${{ matrix.arch }}" = "amd64" ]; then | |
wget https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-amd64_linux.tar.xz | |
tar -xf upx-4.2.4-amd64_linux.tar.xz | |
rm upx-4.2.4-amd64_linux.tar.xz | |
else | |
wget https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-arm64_linux.tar.xz | |
tar -xf upx-4.2.4-arm64_linux.tar.xz | |
rm upx-4.2.4-arm64_linux.tar.xz | |
fi | |
- name: Setup UPX (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
if [ "${{ matrix.arch }}" = "amd64" ]; then | |
wget https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-amd64_linux.tar.xz | |
tar -xf upx-4.2.4-amd64_linux.tar.xz | |
rm upx-4.2.4-amd64_linux.tar.xz | |
else | |
wget https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-arm64_linux.tar.xz | |
tar -xf upx-4.2.4-arm64_linux.tar.xz | |
rm upx-4.2.4-arm64_linux.tar.xz | |
fi | |
- name: Build Executable (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
source .venv/bin/activate | |
mkdir -p core | |
curl -L "https://github.com/Mythologyli/zju-connect/releases/latest/download/zju-connect-linux-${{ matrix.arch }}.zip" -o core/zju-connect.zip | |
unzip -o core/zju-connect.zip -d core | |
rm core/zju-connect.zip | |
pyinstaller --noconsole --clean \ | |
--add-data "app:app" \ | |
--add-data "utils:utils" \ | |
--add-data "core/zju-connect:core" \ | |
--add-data ".app-version:." \ | |
--icon "app\resources\icons\icon.png" \ | |
--upx-dir "upx-4.2.4-${{ matrix.arch }}_linux" \ | |
-n hitsz-connect-verge main.py | |
- name: Archive Executable | |
uses: actions/upload-artifact@v4 | |
with: | |
name: hitsz-connect-verge-${{ matrix.os_name }}-${{ matrix.arch }} | |
path: | | |
${{ runner.os == 'macOS' && 'dist/hitsz-connect-verge-*.dmg' || '' }} | |
${{ runner.os == 'Windows' && 'dist/hitsz-connect-verge-*-setup.exe' || '' }} | |
${{ runner.os == 'Linux' && 'dist/hitsz-connect-verge' || '' }} | |
release: | |
permissions: write-all | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Download All Artifacts | |
uses: dawidd6/action-download-artifact@v8 | |
with: | |
path: artifacts | |
- name: Archive Artifact Directories | |
run: | | |
cd artifacts | |
for dir in *; do | |
if [ -d "$dir" ]; then | |
echo "Zipping $dir" | |
zip -r "$dir.zip" "$dir" | |
rm -rf "$dir" | |
fi | |
done | |
- name: Publish Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "artifacts/*.zip" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref_name }} | |
generateReleaseNotes: true | |
prerelease: true |