Skip to content

Commit

Permalink
ci: add build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Mythologyli committed Sep 23, 2023
1 parent be0c537 commit bd17b29
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 54 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build

on:
release:
types: [ published ]
push:
branches: [ master ]
pull_request:
branches: [ master ]

permissions: write-all

jobs:
build:

runs-on: windows-2019

steps:
- uses: actions/checkout@v4

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '6.5.0'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
cache: 'true'
cache-key-prefix: 'install-qt-action'

- name: Build
run: |
mkdir build
cmake -S . -B build
cmake --build build --target ZJUConnectForWindows --config Release
- name: Download and copy files
run: |
mkdir "ZJU Connect for Windows"
cd "ZJU Connect for Windows"
cp ../build/Release/ZJUConnectForWindows.exe .
windeployqt.exe ZJUConnectForWindows.exe
curl -LO https://github.com/Mythologyli/zju-web-login/releases/latest/download/weblogin.exe
curl -LO https://github.com/Mythologyli/zju-connect/releases/latest/download/zju-connect-windows-amd64.zip
tar -xf zju-connect-windows-amd64.zip
rm zju-connect-windows-amd64.zip
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ZJU-Connect-for-Windows
path: "ZJU Connect for Windows"

- name: Upload to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
tar -czf ZJU-Connect-for-Windows.zip "ZJU Connect for Windows"
gh release upload ${{ github.event.release.tag_name }} ZJU-Connect-for-Windows.zip
54 changes: 0 additions & 54 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,57 +56,3 @@ target_link_libraries(ZJUConnectForWindows
Qt::Svg
SingleApplication::SingleApplication
)

set(DEBUG_SUFFIX)
if (MSVC AND CMAKE_BUILD_TYPE MATCHES "Debug")
set(DEBUG_SUFFIX "d")
endif ()
set(QT_INSTALL_PATH "${CMAKE_PREFIX_PATH}")
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
if (NOT EXISTS "${QT_INSTALL_PATH}/bin")
set(QT_INSTALL_PATH "${QT_INSTALL_PATH}/..")
endif ()
endif ()
if (EXISTS "${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${QT_INSTALL_PATH}/plugins/platforms/qwindows${DEBUG_SUFFIX}.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/platforms/")
endif ()
if (EXISTS "${QT_INSTALL_PATH}/plugins/tls/qcertonlybackend${DEBUG_SUFFIX}.dll")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/tls/")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${QT_INSTALL_PATH}/plugins/tls/qcertonlybackend${DEBUG_SUFFIX}.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/tls/")
endif ()
if (EXISTS "${QT_INSTALL_PATH}/plugins/tls/qopensslbackend${DEBUG_SUFFIX}.dll")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/tls/")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${QT_INSTALL_PATH}/plugins/tls/qopensslbackend${DEBUG_SUFFIX}.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/tls/")
endif ()
if (EXISTS "${QT_INSTALL_PATH}/plugins/tls/qschannelbackend${DEBUG_SUFFIX}.dll")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/tls/")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${QT_INSTALL_PATH}/plugins/tls/qschannelbackend${DEBUG_SUFFIX}.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/tls/")
endif ()
foreach (QT_LIB Core Gui Widgets Network)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${QT_INSTALL_PATH}/bin/Qt6${QT_LIB}${DEBUG_SUFFIX}.dll"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>")
endforeach (QT_LIB)

0 comments on commit bd17b29

Please sign in to comment.