pkg test15
This commit is contained in:
+10
-70
@@ -74,80 +74,20 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
build_npc_gui:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
platform: linux/amd64
|
||||
artifact: linux_amd64
|
||||
- os: windows-latest
|
||||
platform: windows/amd64
|
||||
artifact: windows_amd64
|
||||
- os: macos-latest
|
||||
platform: darwin/amd64
|
||||
artifact: darwin_amd64
|
||||
build_android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Check out code
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.22
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18'
|
||||
|
||||
- name: Enable Yarn (corepack)
|
||||
run: corepack enable
|
||||
|
||||
- name: Install frontend deps
|
||||
- name: Build
|
||||
run: |
|
||||
cd cmd/npc/npc-gui/frontend
|
||||
yarn install --frozen-lockfile
|
||||
|
||||
- name: Install Linux Dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y upx libgtk-3-dev libwebkit2gtk-4.0-dev
|
||||
|
||||
- name: Install UPX (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: brew install upx
|
||||
|
||||
- name: Install UPX (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: choco install upx
|
||||
|
||||
- name: Install Wails CLI
|
||||
run: |
|
||||
go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build Wails app
|
||||
run: |
|
||||
cd cmd/npc/npc-gui
|
||||
$(go env GOPATH)/bin/wails build -platform ${{ matrix.platform }} -upx
|
||||
shell: bash
|
||||
|
||||
- name: Package build output
|
||||
run: |
|
||||
cd cmd/npc/npc-gui/build/bin
|
||||
tar -czvf ../../../npc_gui_${{ matrix.artifact }}.tar.gz ./*
|
||||
ls -la ../../../npc_gui_${{ matrix.artifact }}.tar.gz
|
||||
shell: bash
|
||||
|
||||
- name: Upload npc-gui artifact
|
||||
chmod +x build.android.sh
|
||||
docker run --rm -i -w /app -v $(pwd):/app -e ANDROID_HOME=/usr/local/android_sdk -e GOPROXY=direct fyneio/fyne-cross:android-latest /app/build.android.sh
|
||||
- name: Upload
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: cmd/npc/npc-gui/npc_gui_${{ matrix.artifact }}.tar.gz
|
||||
files: |
|
||||
android_client.apk
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
+2
-20
@@ -1,3 +1,5 @@
|
||||
//go:build !darwin
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -12,26 +14,6 @@ import (
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
// 定义退出标志
|
||||
var (
|
||||
quitting bool
|
||||
quitMutex sync.Mutex
|
||||
)
|
||||
|
||||
// setQuitting 设置退出状态
|
||||
func setQuitting() {
|
||||
quitMutex.Lock()
|
||||
defer quitMutex.Unlock()
|
||||
quitting = true
|
||||
}
|
||||
|
||||
// isQuitting 检查是否正在退出
|
||||
func isQuitting() bool {
|
||||
quitMutex.Lock()
|
||||
defer quitMutex.Unlock()
|
||||
return quitting
|
||||
}
|
||||
|
||||
// QuitTray 退出托盘程序
|
||||
func QuitTray() {
|
||||
systray.Quit()
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import "sync"
|
||||
|
||||
// 退出状态由公共文件维护,避免平台实现重复定义。
|
||||
var (
|
||||
quitting bool
|
||||
quitMutex sync.Mutex
|
||||
)
|
||||
|
||||
// setQuitting 设置退出状态
|
||||
func setQuitting() {
|
||||
quitMutex.Lock()
|
||||
defer quitMutex.Unlock()
|
||||
quitting = true
|
||||
}
|
||||
|
||||
// isQuitting 检查是否正在退出
|
||||
func isQuitting() bool {
|
||||
quitMutex.Lock()
|
||||
defer quitMutex.Unlock()
|
||||
return quitting
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//go:build darwin
|
||||
|
||||
package main
|
||||
|
||||
import "log"
|
||||
|
||||
// QuitTray no-op on macOS to avoid AppDelegate conflict with systray.
|
||||
func QuitTray() {}
|
||||
|
||||
// startTray on macOS: disable systray to avoid duplicate AppDelegate symbols.
|
||||
func (a *App) startTray() {
|
||||
log.Println("tray: disabled on darwin (systray AppDelegate conflict)")
|
||||
}
|
||||
Reference in New Issue
Block a user