mirror of https://github.com/ospab/ostp.git
Update GUI builds to output dual architectures
This commit is contained in:
parent
7bc31d2bac
commit
532bdc7e76
|
|
@ -232,8 +232,15 @@ jobs:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
build-windows-gui:
|
build-windows-gui:
|
||||||
name: Build Windows GUI (Tauri)
|
name: Build Windows GUI (Tauri) - ${{ matrix.arch }}
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- arch: amd64
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
- arch: arm64
|
||||||
|
target: aarch64-pc-windows-msvc
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
|
@ -245,7 +252,7 @@ jobs:
|
||||||
- name: Setup Rust toolchain
|
- name: Setup Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
targets: x86_64-pc-windows-msvc
|
targets: ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Install Tauri CLI
|
- name: Install Tauri CLI
|
||||||
run: npm install -g @tauri-apps/cli
|
run: npm install -g @tauri-apps/cli
|
||||||
|
|
@ -258,7 +265,7 @@ jobs:
|
||||||
~/.cargo/registry/cache/
|
~/.cargo/registry/cache/
|
||||||
~/.cargo/git/db/
|
~/.cargo/git/db/
|
||||||
target/
|
target/
|
||||||
key: cargo-windows-gui-${{ hashFiles('**/Cargo.lock') }}
|
key: cargo-windows-gui-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- name: Download wintun and tun2socks
|
- name: Download wintun and tun2socks
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
@ -267,36 +274,40 @@ jobs:
|
||||||
|
|
||||||
# Download tun2socks
|
# Download tun2socks
|
||||||
New-Item -ItemType Directory -Force -Path "t2s_tmp"
|
New-Item -ItemType Directory -Force -Path "t2s_tmp"
|
||||||
Invoke-WebRequest -Uri "https://github.com/xjasonlyu/tun2socks/releases/download/v2.6.0/tun2socks-windows-amd64.zip" -OutFile "t2s_tmp/t2s.zip"
|
Invoke-WebRequest -Uri "https://github.com/xjasonlyu/tun2socks/releases/download/v2.6.0/tun2socks-windows-${{ matrix.arch }}.zip" -OutFile "t2s_tmp/t2s.zip"
|
||||||
Expand-Archive "t2s_tmp/t2s.zip" -DestinationPath "t2s_tmp/ext" -Force
|
Expand-Archive "t2s_tmp/t2s.zip" -DestinationPath "t2s_tmp/ext" -Force
|
||||||
Get-ChildItem "t2s_tmp/ext" -Filter "*.exe" -Recurse | Select-Object -First 1 | Copy-Item -Destination "t2s_tmp/tun2socks-windows-amd64.exe" -Force
|
Get-ChildItem "t2s_tmp/ext" -Filter "*.exe" -Recurse | Select-Object -First 1 | Copy-Item -Destination "t2s_tmp/tun2socks.exe" -Force
|
||||||
|
|
||||||
# Download wintun
|
# Download wintun
|
||||||
New-Item -ItemType Directory -Force -Path "target/release"
|
New-Item -ItemType Directory -Force -Path "target/${{ matrix.target }}/release"
|
||||||
Invoke-WebRequest -Uri "https://www.wintun.net/builds/wintun-0.14.1.zip" -OutFile "target/release/wt.zip"
|
Invoke-WebRequest -Uri "https://www.wintun.net/builds/wintun-0.14.1.zip" -OutFile "target/wt.zip"
|
||||||
Expand-Archive "target/release/wt.zip" -DestinationPath "target/release/wt_tmp" -Force
|
Expand-Archive "target/wt.zip" -DestinationPath "target/wt_tmp" -Force
|
||||||
Get-ChildItem "target/release/wt_tmp" -Filter "wintun.dll" -Recurse | Where-Object { $_.FullName -match 'bin[\\/]amd64[\\/]' } | Copy-Item -Destination "target/release/wintun.dll" -Force
|
Get-ChildItem "target/wt_tmp" -Filter "wintun.dll" -Recurse | Where-Object { $_.FullName -match 'bin[\\/]${{ matrix.arch }}[\\/]' } | Copy-Item -Destination "target/${{ matrix.target }}/release/wintun.dll" -Force
|
||||||
|
|
||||||
- name: Build Tauri App
|
- name: Build Tauri App
|
||||||
working-directory: ostp-gui
|
working-directory: ostp-gui
|
||||||
run: |
|
run: |
|
||||||
npm install
|
npm install
|
||||||
npm run build:installer
|
cargo build -p ostp-tun-helper --release --target ${{ matrix.target }}
|
||||||
|
npm run build -- --no-bundle --target ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Rename Installer
|
- name: Package Portable ZIP
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$installer = Get-ChildItem "ostp-gui/src-tauri/target/release/bundle/nsis/*.exe" | Select-Object -First 1
|
$dir = "ostp-gui-dist"
|
||||||
if ($installer) {
|
New-Item -ItemType Directory -Force -Path $dir
|
||||||
Rename-Item -Path $installer.FullName -NewName "ostp-windows-installer.exe"
|
Copy-Item "ostp-gui/src-tauri/target/${{ matrix.target }}/release/ostp-gui.exe" $dir
|
||||||
Write-Host "Renamed installer to ostp-windows-installer.exe"
|
Copy-Item "target/${{ matrix.target }}/release/ostp-tun-helper.exe" $dir
|
||||||
}
|
Copy-Item "t2s_tmp/tun2socks.exe" $dir
|
||||||
|
Copy-Item "target/${{ matrix.target }}/release/wintun.dll" $dir
|
||||||
|
|
||||||
|
Compress-Archive -Path "$dir/*" -DestinationPath "ostp-windows-gui-${{ matrix.arch }}.zip" -Force
|
||||||
|
|
||||||
- name: Upload to GitHub Release
|
- name: Upload to GitHub Release
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: ostp-gui/src-tauri/target/release/bundle/nsis/ostp-windows-installer.exe
|
files: ostp-windows-gui-${{ matrix.arch }}.zip
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
|
@ -332,15 +343,46 @@ jobs:
|
||||||
run: cargo install cargo-ndk
|
run: cargo install cargo-ndk
|
||||||
|
|
||||||
- name: Build Android APK
|
- name: Build Android APK
|
||||||
shell: pwsh
|
shell: bash
|
||||||
working-directory: ostp-flutter
|
working-directory: ostp-flutter
|
||||||
run: ./build.ps1
|
run: |
|
||||||
|
# 1. Compile JNI
|
||||||
|
mkdir -p android/app/src/main/jniLibs/arm64-v8a
|
||||||
|
mkdir -p android/app/src/main/jniLibs/armeabi-v7a
|
||||||
|
|
||||||
|
cd ../ostp-jni
|
||||||
|
cargo ndk -t arm64-v8a -t armeabi-v7a -o "../ostp-flutter/android/app/src/main/jniLibs" build --release
|
||||||
|
cd ../ostp-flutter
|
||||||
|
|
||||||
|
# 2. Download tun2socks
|
||||||
|
if [ ! -f "android/app/src/main/jniLibs/arm64-v8a/libtun2socks.so" ]; then
|
||||||
|
curl -fsSL "https://github.com/xjasonlyu/tun2socks/releases/download/v2.6.0/tun2socks-linux-arm64.zip" -o "t2s64.zip"
|
||||||
|
unzip -o t2s64.zip -d t2s64_tmp
|
||||||
|
cp t2s64_tmp/tun2socks-linux-arm64 android/app/src/main/jniLibs/arm64-v8a/libtun2socks.so
|
||||||
|
rm -rf t2s64.zip t2s64_tmp
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "android/app/src/main/jniLibs/armeabi-v7a/libtun2socks.so" ]; then
|
||||||
|
curl -fsSL "https://github.com/xjasonlyu/tun2socks/releases/download/v2.6.0/tun2socks-linux-armv7.zip" -o "t2s32.zip"
|
||||||
|
unzip -o t2s32.zip -d t2s32_tmp
|
||||||
|
cp t2s32_tmp/tun2socks-linux-armv7 android/app/src/main/jniLibs/armeabi-v7a/libtun2socks.so
|
||||||
|
rm -rf t2s32.zip t2s32_tmp
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 3. Build Flutter APK
|
||||||
|
flutter build apk --release --split-per-abi
|
||||||
|
|
||||||
|
# 4. Copy to output
|
||||||
|
cp build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ostp-android-armv7.apk
|
||||||
|
cp build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ostp-android-arm64.apk
|
||||||
|
|
||||||
- name: Upload to GitHub Release
|
- name: Upload to GitHub Release
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: ostp-flutter/ostp-client-release.apk
|
files: |
|
||||||
|
ostp-flutter/ostp-android-armv7.apk
|
||||||
|
ostp-flutter/ostp-android-arm64.apk
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue