roughly implant #25
Workflow file for this run
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 and Deploy | |
on: | |
push: | |
paths: | |
- "src/**" | |
- "!**.qml" | |
- "!**.md" | |
- "!**.cmake" | |
pull_request: | |
paths: | |
- "src/**" | |
- "!**.qml" | |
- "!**.md" | |
- "!**.cmake" | |
permissions: write-all | |
env: | |
BUILD_TYPE: Release | |
QT_VERSION: "6.5.3" | |
QT_MODULES: "qt5compat qtwebsockets qthttpserver qtshadertools" | |
TARGET: SAST_Evento_Desktop | |
targetName: SAST_Evento_Desktop.exe | |
fileName: SAST_Evento | |
jobs: | |
deploy-ubuntu: | |
name: Ubuntu | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Ninja | |
uses: ashutoshvarma/setup-ninja@v1.1 | |
with: | |
version: "1.11.1" | |
# https://github.com/zhuzichu520/FluentUI/blob/06c9b4e3829af636234a98f946603d68c23f6459/.github/workflows/ubuntu.yml#L49-L50 | |
- name: Install GL library (Ubuntu) | |
run: sudo apt-get install -y libxcb-cursor0 libgl1-mesa-dev libxcb1-dev libgtk-3-dev libxkbcommon-x11-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxcb-xinerama0-dev libxcb-sync-dev libxcb-render-util0-dev libxcb-shm0-dev | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{env.QT_VERSION}} | |
modules: ${{env.QT_MODULES}} | |
cache: "true" | |
cache-key-prefix: "install-qt-action" | |
- name: Install Fcitx5 for Qt | |
run: | | |
sudo apt-get install -y extra-cmake-modules | |
git clone --depth 1 --branch 5.1.1 https://github.com/fcitx/fcitx5-qt | |
cmake -DBUILD_ONLY_PLUGIN=ON -DENABLE_QT4=OFF -DENABLE_QT5=OFF -DENABLE_QT6=ON -G Ninja -S ./fcitx5-qt -B ./fcitx5-qt-build -DCMAKE_PREFIX_PATH=${{env.Qt6_DIR}} -DCMAKE_BUILD_TYPE=Release | |
cmake --build ./fcitx5-qt-build --parallel --config Release | |
cmake --install ./fcitx5-qt-build | |
- name: Configure CMake | |
run: cmake -G Ninja -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_PREFIX_PATH=${{env.Qt6_DIR}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel | |
- name: Install Qt Linux Deploy | |
uses: miurahr/install-linuxdeploy-action@v1 | |
with: | |
plugins: qt appimage | |
- name: Package | |
if: startsWith(github.event.ref, 'refs/tags/') | |
env: | |
EXTRA_QT_PLUGINS: qt5compat | |
run: | | |
export QML_SOURCES_PATHS=./ | |
echo "[Desktop Entry]" > SAST_Evento.desktop | |
echo "Categories=Utility;" >> SAST_Evento.desktop | |
echo "Icon=app_icon" >> SAST_Evento.desktop | |
echo "Name=SAST Evento" >> SAST_Evento.desktop | |
echo "Type=Application" >> SAST_Evento.desktop | |
echo "Exec=SAST_Evento_Desktop" >> SAST_Evento.desktop | |
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --desktop-file=SAST_Evento.desktop --icon-file=app_icon.svg --executable=bin/release/SAST_Evento_Desktop --appdir AppDir | |
mv ${{ env.fileName }}-*.AppImage ${{ env.TARGET }}.AppImage | |
- uses: actions/upload-artifact@v2 | |
if: startsWith(github.event.ref, 'refs/tags/') | |
with: | |
name: SAST_Evento_AppImage | |
path: ${{ env.TARGET }}.AppImage | |
- name: uploadRelease | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.TARGET }}.AppImage | |
asset_name: ${{ env.fileName }}_AppImage.AppImage | |
tag: ${{ github.ref }} | |
overwrite: true | |
deploy-macos: | |
name: MacOS | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-13] | |
qt_ver: [6.5.3] | |
qt_arch: [clang_64] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Ninja | |
uses: seanmiddleditch/gha-setup-ninja@v3 | |
with: | |
version: 1.10.2 | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{env.QT_VERSION}} | |
modules: ${{env.QT_MODULES}} | |
cache: "true" | |
cache-key-prefix: "install-qt-action" | |
- name: build macos | |
run: | | |
cmake --version | |
mkdir build | |
cd build | |
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_PREFIX_PATH=/Users/runner/work/FluentUI/Qt/6.5.3/macos -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -GNinja .. | |
cmake --build . --target all --config Release --parallel | |
- name: Package | |
if: startsWith(github.event.ref, 'refs/tags/') | |
run: | | |
macdeployqt bin/release/SAST_Evento_Desktop.app -qmldir=. -verbose=1 -dmg | |
- uses: actions/upload-artifact@v2 | |
if: startsWith(github.event.ref, 'refs/tags/') | |
with: | |
name: SAST_Evento_MacOS | |
path: bin/release/${{ env.TARGET }}.app | |
- name: uploadRelease | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: bin/release/${{ env.TARGET }}.dmg | |
asset_name: ${{ env.fileName }}_MacOS.dmg | |
tag: ${{ github.ref }} | |
overwrite: true | |
deploy-windows: | |
name: Windows | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-2019] | |
include: | |
- qt_ver: 6.5.3 | |
qt_arch: win64_msvc2019_64 | |
msvc_arch: x64 | |
qt_arch_install: msvc2019_64 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ matrix.qt_ver }} | |
arch: ${{ matrix.qt_arch }} | |
cache: ${{steps.cache-qt.outputs.cache-hit}} | |
modules: ${{env.QT_MODULES}} | |
- name: msvc-build | |
id: build | |
shell: cmd | |
run: | | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.msvc_arch }} | |
ninja --version | |
mkdir build | |
cd build | |
cmake -DCMAKE_MESSAGE_LOG_LEVEL=STATUS -DCMAKE_PREFIX_PATH=D:\a\FluentUI\Qt\6.5.3\msvc2019_64 -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=Release -GNinja .. | |
cmake --build . --target all --config Release --parallel | |
echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV% | |
echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV% | |
echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV% | |
echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV% | |
- name: package | |
if: startsWith(github.event.ref, 'refs/tags/') | |
id: package | |
env: | |
archiveName: ${{ env.fileName }}-${{ matrix.qt_arch }}-${{ matrix.qt_ver }} | |
msvcArch: ${{ matrix.msvc_arch }} | |
shell: pwsh | |
run: | | |
& scripts\windows-publish.ps1 ${env:archiveName} ${env:targetName} | |
# 记录packageName给后续step | |
$name = ${env:archiveName} | |
echo "::set-output name=packageName::$name" | |
- uses: actions/upload-artifact@v2 | |
if: startsWith(github.event.ref, 'refs/tags/') | |
with: | |
name: ${{ steps.package.outputs.packageName }} | |
path: dist | |
- name: inno setup install | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: zhuzichu520/inno-setup-action@v1.0.1 | |
with: | |
filepath: ./action-cli/InstallerScript.iss | |
- name: uploadRelease | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./action-cli/installer.exe | |
asset_name: ${{ env.fileName }}_win64.exe | |
tag: ${{ github.ref }} | |
overwrite: true |