x-tools/.github/workflows/build-daily.yml
2025-03-04 22:24:20 +08:00

211 lines
8.1 KiB
YAML

name: build-daily
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch: # Enables manually
# on:
# push:
# branches:
# - master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
QT_VERSION: 6.8.2
QT_MODULES: 'qtcharts qtserialbus qtserialport qtwebsockets'
jobs:
update-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update continuous tag
run: |
git config --global user.email "x-tools@outlook.com"
git config --global user.name "x-tools-author"
git tag -d continuous || true
git push origin :refs/tags/continuous
git tag continuous
git push origin continuous -f
update-release:
runs-on: ubuntu-latest
needs: update-tag
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Delete Release
run: |
gh release delete continuous -y || true
- name: Create Release
run: |
gh release create continuous --title "Continuous Build" --notes "Daily build of xTools"
release-for-windows:
runs-on: windows-2022
needs: update-release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '${{ env.QT_VERSION }}'
target: 'desktop'
arch: 'win64_msvc2022_64'
dir: '${{ github.workspace }}'
modules: '${{env.QT_MODULES}}'
- name: Build for Windows
shell: cmd
run: |
git fetch --tags
mkdir build
cd build
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake -DCMAKE_PREFIX_PATH='${{ github.workspace }}/Qt/${{env.QT_VERSION}}/win64_msvc2022_64' -DCMAKE_BUILD_TYPE=Release -G "Ninja" ../
cmake --build . --target xTools
cmake --build . --target xTools_zip
- name: Upload Release Asset for Windnows
shell: cmd
run: |
for %%f in (bin\Windows\Release\xTools-zip\*.zip) do gh release upload continuous "%%f"
release-for-linux:
runs-on: ubuntu-20.04
needs: update-release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
aqtversion: '==3.1.*'
version: ${{env.QT_VERSION}}
target: 'desktop'
arch: 'linux_gcc_64'
dir: ${{ github.workspace }}
modules: ${{env.QT_MODULES}}
- name: install-dependencies
run: |
sudo apt-get install -y libxcb-xinerama0 libxcb-cursor-dev libudev-dev libusb-dev libusb-1.0-0-dev ninja-build
- name: Build for Linux
run: |
git fetch --tags
mkdir build
cd build
cmake ../ -DCMAKE_PREFIX_PATH='${{ github.workspace }}/Qt/${{env.QT_VERSION}}/linux_gcc_64' -DCMAKE_BUILD_TYPE:STRING=Release -G "Ninja"
cmake --build . --target xTools
cmake --build . --target xTools_deb
cmake --build . --target xTools_appimage
- name: Upload Release Asset for Linux
run: |
dir bin/Linux/Release
find bin/Linux/Release/xTools-deb -name "*.deb" -exec gh release upload continuous {} \;
find bin/Linux/Release/xTools-appimage -name "*.AppImage" -exec gh release upload continuous {} \;
release-for-macos:
runs-on: macos-14
needs: update-release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Qt for macOS
uses: jurplel/install-qt-action@v4
with:
version: '${{env.QT_VERSION}}'
target: 'desktop'
arch: 'clang_64'
dir: ${{ github.workspace }}
modules: 'qtcharts qtserialbus qtserialport qtwebsockets'
- name: Build for macOS
# 278ERROR: no file at "/usr/local/opt/libiodbc/lib/libiodbc.2.dylib"
# brew unlink unixodbc
# brew install libiodbc
# ERROR: no file at "/Applications/Postgres.app/Contents/Versions/14/lib/libpq.5.dylib"
# ln -s /usr/local/Cellar/postgresql@14/14.10/lib/postgresql@14/libpq.5.14.dylib /Applications/Postgres.app/Contents/Versions/14/lib/libpq.5.dylib
run: |
git fetch --tags
# brew unlink unixodbc
# brew install libiodbc
mkdir -p /Applications/Postgres.app/Contents/Versions/14/lib
ln -s /usr/local/Cellar/postgresql@14/14.10/lib/postgresql@14/libpq.5.14.dylib /Applications/Postgres.app/Contents/Versions/14/lib/libpq.5.dylib
mkdir build
cd build
cmake ../ -DCMAKE_PREFIX_PATH='${{ github.workspace }}/Qt/${{env.QT_VERSION}}/clang_64/lib/cmake/Qt6' -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build . --target xTools
cmake --build . --target xTools_dmg
- name: Upload Release Asset for macOS
run: |
ls bin/Darwin/Release/xTools
find bin/Darwin/Release/xTools -name "*.dmg" -exec gh release upload continuous {} \;
release-for-android:
runs-on: windows-2022
needs: update-release
env:
QT_ANDROID_KEYSTORE_PATH: ${{ github.workspace }}\res\android\android_release.keystore
QT_ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
QT_ANDROID_KEYSTORE_STORE_PASS: ${{ secrets.ANDROID_KEYSTORE_STORE_PASS }}
QT_ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.ANDROID_KEYSTORE_KEY_PASS }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Qt for Android
uses: jurplel/install-qt-action@v4
with:
aqtversion: '==3.1.*'
target: android
arch: android_armv7
host: windows
dir: ${{ github.workspace }}
modules: ${{env.QT_MODULES}}
version: ${{env.QT_VERSION}}
- name: Install Qt for Desktop(mingw)
uses: jurplel/install-qt-action@v4
with:
aqtversion: '==3.1.*'
target: desktop
arch: win64_mingw
host: windows
dir: ${{ github.workspace }}
modules: ${{env.QT_MODULES}}
version: ${{env.QT_VERSION}}
- name: CMake for Android
shell: cmd
run: |
git fetch --tags
set JAVA_HOME=%JAVA_HOME_17_X64%
${{ github.workspace }}\Qt\${{env.QT_VERSION}}\android_armv7\bin\qt-cmake.bat ^
-G "MinGW Makefiles" ^
-S . ^
-B "build\armeabi_v7a" ^
-DQT_HOST_PATH:PATH="${{ github.workspace }}\Qt\${{env.QT_VERSION}}\mingw_64" ^
-DCMAKE_BUILD_TYPE:STRING=Release ^
-DCMAKE_CXX_COMPILER:FILEPATH="%ANDROID_NDK_ROOT%/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe" ^
-DANDROID_SDK_ROOT:PATH="%ANDROID_SDK_ROOT%" ^
-DANDROID_NDK_ROOT:PATH="%ANDROID_NDK_ROOT%" ^
-DBUILD_SHARED_LIBS:BOOL=OFF ^
-DWITH_TOOLS:BOOL=OFF ^
-DWITHOUT_PNG:BOOL=ON
- name: Build for android
shell: cmd
run: |
set JAVA_HOME=%JAVA_HOME_17_X64%
echo %JAVA_HOME%
cmake --build build\armeabi_v7a --target xTools --config Release
- name: Copy File for Deploy
shell: cmd
run: |
mkdir build\armeabi_v7a\android-build\libs\armeabi-v7a
dir build\armeabi_v7a
copy .\build\armeabi_v7a\libxTools_armeabi-v7a.so .\build\armeabi_v7a\android-build\libs\armeabi-v7a /y
- name: Deploy for Android
shell: cmd
run: |
set JAVA_HOME=%JAVA_HOME_17_X64%
echo %JAVA_HOME%
${{ github.workspace }}\Qt\${{env.QT_VERSION}}\mingw_64\bin\androiddeployqt.exe ^
--input build\armeabi_v7a\android-xTools-deployment-settings.json ^
--output build\armeabi_v7a\android-build ^
--android-platform android-35 ^
--sign ${{ env.QT_ANDROID_KEYSTORE_PATH }} ${{ env.QT_ANDROID_KEYSTORE_ALIAS }} --storepass ${{ env.QT_ANDROID_KEYSTORE_STORE_PASS }} --keypass ${{ env.QT_ANDROID_KEYSTORE_KEY_PASS }} ^
--jdk %JAVA_HOME% --gradle --release
- name: Upload Release Asset for Android
run: |
cmake -E copy build/armeabi_v7a/android-build/build/outputs/apk/release/android-build-release-signed.apk xtools-android-armeabi_v7a.apk
ls && tree build/armeabi_v7a && gh release upload continuous xtools-android-armeabi_v7a.apk