构建安卓版的CI
构建win版的CI(未完成)
以上均需要手动触发
This commit is contained in:
notify 2023-04-07 16:07:52 +08:00 committed by GitHub
parent c6df5ff7a5
commit 018cb249ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 221 additions and 1 deletions

150
.github/workflows/build-android.yml vendored Normal file
View File

@ -0,0 +1,150 @@
name: Build For Android
on:
workflow_dispatch:
jobs:
build:
name: Build Android APK
runs-on: ubuntu-latest
steps:
- name: Checkout Git Repo
uses: actions/checkout@v3
with:
submodules: true
#- name: Setup Debug Session
# uses: csexton/debugger-action@master
- name: Install swig, flex, bison
run: |
sudo apt-get install -y swig flex bison
- name: Install Qt for Host
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
py7zrversion: '>=0.20.2'
version: '6.4.2'
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
modules: 'qtmultimedia qt5compat qtshadertools'
- name: Install Qt for Android
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
py7zrversion: '>=0.20.2'
version: '6.4.2'
host: 'linux'
target: 'android'
arch: 'android_arm64_v8a'
modules: 'qtmultimedia qt5compat qtshadertools'
# 快点TM升级到OpenSSL 31.1.1今年就走到生命期末尾了!
- name: Setup OpenSSL 1.1.1 headers
run: |
cd ..
wget --quiet https://www.openssl.org/source/openssl-1.1.1t.tar.gz
tar xf ./openssl-1.1.1t.tar.gz
cd openssl-1.1.1t
./config
make include/openssl/opensslconf.h
cd ../FreeKill
cp -r ../openssl-1.1.1t/include/openssl ./include
- name: Setup Android for Qt 6.4.x
run: |
cd ..
mkdir android
cd android
wget --quiet https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
unzip commandlinetools-linux-9477386_latest.zip
yes | ./cmdline-tools/bin/sdkmanager --sdk_root=$(pwd) \
"platforms;android-31" \
"platform-tools" \
"build-tools;31.0.0" \
"ndk;23.1.7779620"
- name: Copy android assets
run: |
${Qt6_DIR}/../gcc_64/bin/lrelease lang/zh_CN.ts
cp lang/zh_CN.qm .
FKVER=$(cat CMakeLists.txt | grep 'project(FreeKill' | cut -d ' ' -f 3)
cd android
sed -i 's/function //g' copy_assets.sh # FIX THIS
./copy_assets.sh || echo "" # fail on copy cert, ubuntu is not arch
cd assets/res
cp -r /etc/ssl/certs .
cp /usr/share/ca-certificates/mozilla/* certs/
echo ${FKVER%)} > fk_ver
- name: Configure CMake Project
working-directory: ${{github.workspace}}
run: |
export QT_HOST_PATH=${Qt6_DIR}/../gcc_64/
export ANDROID_SDK_ROOT=$(pwd)/../android
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/23.1.7779620
sed -i "s/LinguistTools/Linguist/g" CMakeLists.txt
${Qt6_DIR}/bin/qt-cmake -S . -B ./build -DCMAKE_BUILD_TYPE=MinSizeRel
- name: Build project
working-directory: ${{github.workspace}}/build
run: make -j2
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: apk
path: build/android-build/build/outputs/apk/debug/android-build-debug.apk
release:
name: Release APK
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Git Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Previous tag
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: 0.0.1
- name: Download APK from build
uses: actions/download-artifact@v3
with:
name: apk
path: apk
- uses: r0adkll/sign-android-release@v1
name: Sign app APK
# ID used to access action output
id: sign_app
with:
releaseDirectory: apk
signingKeyBase64: ${{ secrets.KEY_STORE }}
alias: ${{ secrets.KEY_STORE_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
env:
# override default build-tools version (29.0.3) -- optional
BUILD_TOOLS_VERSION: "31.0.0"
- name: Rename APK
run: |
mv ${{ steps.sign_app.outputs.signedReleaseFile }} \
apk/FreeKill-${{ steps.previoustag.outputs.tag }}.apk
- name: Upload Release APK
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.MY_TOKEN }}
tag_name: ${{ steps.previoustag.outputs.tag }}
files: apk/FreeKill-${{ steps.previoustag.outputs.tag }}.apk

62
.github/workflows/build-windows.yml vendored Normal file
View File

@ -0,0 +1,62 @@
name: Build For Windows 10+
# 调试不好,放弃
# 辣鸡Windows
on:
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout Git Repo
uses: actions/checkout@v3
with:
submodules: true
- name: Install swig, winflexbison3
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install winflexbison3 swig -y
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
py7zrversion: '>=0.20.2'
version: '6.4.3'
host: 'windows'
target: 'desktop'
arch: 'win64_mingw'
modules: 'qtmultimedia qt5compat qtshadertools'
tools: 'tools_openssl_x64 tools_cmake'
- name: Configure CMake Project
working-directory: ${{github.workspace}}
env:
CMAKE_PREFIX_PATH: ${{env.Qt6_Dir}}
OPENSSL_ROOT_DIR: ${{github.workspace}}/../Qt/tools/OpenSSL/bin
run: |
ls ../Qt
ls ../Qt/tools
cmake -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -B ${{github.workspace}}/build
- name: Build project
working-directory: ${{github.workspace}}/build
run: mingw32-make.exe
- name: Compress portable program
working-directory: ${{github.workspace}}
run: |
mkdir build/all
cp build/FreeKill.exe build/all
cp build/zh_CN.qm build/all
cp build/fkparse/libfkparse.dll build/all
cp -r audio fonts image lua packages qml server build/all
cp lib/win/* build/all
cd build/all
windeployqt.exe FreeKill.exe --release
ls
Compress-Archive -Path ${{github.workspace}}\build\all\ -DestinationPath ${{github.workspace}}\build\final.zip

View File

@ -2,6 +2,8 @@ package org.notify.FreeKill;
import android.app.Activity;
import android.view.View;
import android.view.WindowManager;
import android.view.ViewGroup.LayoutParams;
import org.qtproject.qt.android.QtNative;
public class Helper {
@ -18,9 +20,15 @@ public class Helper {
int uiOpt = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOpt);
// FullScreen
WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
lp.layoutInDisplayCutoutMode = LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
activity.getWindow().setAttributes(lp);
decorView.setOnSystemUiVisibilityChangeListener
(new View.OnSystemUiVisibilityChangeListener() {
@Override

View File

@ -46,7 +46,7 @@ Server::Server(QObject* parent)
}
// wait for reply
QThread::sleep(5);
QThread::sleep(150);
foreach (auto p, this->players.values()) {
if (p->getState() == Player::Online && !p->alive) {