Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows-CI. #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Windows-CI
on: [push, pull_request]

jobs:
build:
runs-on: windows-latest

strategy:
matrix:
arch: ["x86", "x64"]
qt: ["5.15.0"]

env:
CMAKE_GENERATOR: Visual Studio 16 2019
vcpkg-triplet: ${{ matrix.arch }}-windows-static-md

steps:
- uses: actions/checkout@v2

- name: Bootstrap vcpkg
id: bootstrap-vcpkg
run: |
cd C:\vcpkg
git pull
Write-Host "::set-output name=vcpkg-rev::$(git rev-parse HEAD)"
./bootstrap-vcpkg.bat

- name: Restore Dependency Cache
id: cache-vcpkg
uses: actions/cache@v1
with:
path: C:\vcpkg\installed
key: |
vcpkg-triplet=${{ env.vcpkg-triplet }} vcpkg-response=${{ hashFiles('vcpkg.txt') }} vcpkg-rev=${{ steps.bootstrap-vcpkg.outputs.vcpkg-rev }}
restore-keys: |
vcpkg-triplet=${{ env.vcpkg-triplet }} vcpkg-response=${{ hashFiles('vcpkg.txt') }}
vcpkg-triplet=${{ env.vcpkg-triplet }}

- name: Upgrade Dependencies
if: steps.cache-vcpkg.outputs.cache-hit == 'true'
run: |
vcpkg upgrade --no-dry-run --triplet ${{ env.vcpkg-triplet }}

- name: Build Dependencies
run: |
vcpkg install `@vcpkg.txt --triplet ${{ env.vcpkg-triplet }}
vcpkg list --x-full-desc

- name: Configure Platform Arch
run: |
# Qt started providing both x86 and x64 builds for only MSVC 2019 as of 5.15. This was
# true only for MSVC 2017 before then.
[int[]]$qt_ver = "${{ matrix.qt }}".split('.')
if (($qt_ver[0] -eq 5) -and ($qt_ver[1] -lt 15)) {
$qt_compiler = "msvc2017"
} else {
$qt_compiler = "msvc2019"
}

if ("${{ matrix.arch }}" -eq "x86") {
$cmake_arch = "Win32"
$qt_arch = "win32_$($qt_compiler)"
} else {
$cmake_arch = "${{ matrix.arch }}"
$qt_arch = "win64_$($qt_compiler)_64"
}
Write-Host "::set-env name=CMAKE_GENERATOR_PLATFORM::$cmake_arch"
Write-Host "::set-env name=QT_ARCH::$qt_arch"
Hoikas marked this conversation as resolved.
Show resolved Hide resolved

# Qt5 takes roughly a thousand years to build, so we download it from elsehwere...
- name: Restore Qt Cache
id: cache-qt
uses: actions/cache@v1
with:
path: ${{ github.workspace }}\qt
key: os=${{ runner.os }} qt=${{ matrix.qt }} arch=${{ env.qt_arch }}

- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
arch: ${{ env.QT_ARCH }}
version: ${{ matrix.qt }}
dir: ${{ github.workspace }}\qt
cached: ${{ steps.cache-qt.outputs.cache-hit }}
aqtversion: ==0.9.*

- name: Checkout HSPlasma
uses: actions/checkout@v2
with:
repository: H-uru/libhsplasma
path: libhsplasma

- name: Build libHSPlasma
run: |
cd libhsplasma
mkdir build && cd build
cmake `
-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake `
-DVCPKG_TARGET_TRIPLET=${{ env.vcpkg-triplet }} `
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\install `
-DENABLE_PYTHON=OFF -DENABLE_TOOLS=OFF -DENABLE_NET=ON -DENABLE_PHYSX=OFF ..
cmake --build . --config Release -j 2
cmake --build . --config Release --target INSTALL

- name: Build MoulKI
run: |
mkdir build && cd build
cmake `
-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake `
-DVCPKG_TARGET_TRIPLET=${{ env.vcpkg-triplet }} `
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\install `
..
cmake --build . --config Release -j 2
cmake --build . --config Release --target INSTALL

- name: Deploy Qt
run: |
cd ${{ env.Qt5_Dir }}\bin
$ExeFile = Get-ChildItem "${{ github.workspace }}\install\bin" -Filter *.exe
./windeployqt.exe --release $ExeFile.FullName

- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-${{ matrix.arch }}-qt${{ matrix.qt }}
path: install\bin
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,5 @@ add_executable(MoulKI ${all_SOURCES}
)

target_link_libraries(MoulKI ${HSPlasmaNet_LIBRARIES} Qt5::Core Qt5::Widgets)

install(TARGETS MoulKI DESTINATION bin)
1 change: 1 addition & 0 deletions FetchDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "FetchDialog.h"
#include <QIntValidator>
#include "ui_FetchDialog.h"

FetchDialog::FetchDialog(QWidget *parent) :
Expand Down
1 change: 1 addition & 0 deletions MoulKI.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef MOULKI_H
#define MOULKI_H

#include <ResManager/plResManager.h>
#include <SDL/plSDLMgr.h>
#include <QMainWindow>
#include "qtAuthClient.h"
Expand Down
1 change: 1 addition & 0 deletions RefDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "RefDialog.h"
#include <QIntValidator>
#include "ui_RefDialog.h"

RefDialog::RefDialog(QWidget *parent) :
Expand Down
5 changes: 5 additions & 0 deletions vcpkg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
libjpeg-turbo
libpng
openssl
string-theory
zlib