Add windows CI

This commit is contained in:
Xiphoseer 2022-01-05 10:06:34 +01:00
parent 8ed7690b96
commit adab6cf96f
5 changed files with 89 additions and 30 deletions

View File

@ -8,27 +8,45 @@ on:
jobs:
build-and-test:
runs-on: ubuntu-latest
name: Build & Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Add msbuild to PATH (windows only)
if: ${{ matrix.os == 'windows-latest' }}
uses: microsoft/setup-msbuild@v1.1
with:
vs-version: '[16,17)'
msbuild-architecture: x64
- name: cmake
uses: lukka/run-cmake@v10
with:
configurePreset: 'default'
buildPreset: 'default'
testPreset: 'default'
configurePreset: "ci-${{matrix.os}}"
buildPreset: "ci-${{matrix.os}}"
testPreset: "ci-${{matrix.os}}"
- name: artifacts
uses: actions/upload-artifact@v2
with:
name: linux-build
name: build-${{matrix.os}}
path: |
build
!build/tests
!build/Testing
!build/CMakeFiles
!build/DartConfiguration.tcl
!build/CTestTestfile.cmake
!build/CMakeCache.txt
!build/build.ninja
!build/_deps
!build/cmake_install.cmake
!build/*.a
!build/*.lib
!build/*.dir
!build/*.vcxproj
!build/*.vcxproj.filters

View File

@ -371,6 +371,11 @@ RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${PROJECT_SOURCE_DIR}/dPhysics/*.cpp
)
if(MSVC)
# Skip warning for invalid conversion from size_t to uint32_t for all targets below for now
add_compile_options("/wd4267")
endif(MSVC)
# 3rdparty static libraries:
#add_library(zlib ${SOURCES_ZLIB})
add_library(raknet ${SOURCES_RAKNET})
@ -391,6 +396,10 @@ target_link_libraries(dNet dCommon) #Needed because otherwise linker errors occu
target_link_libraries(dCommon ZLIB::ZLIB)
target_link_libraries(dCommon libbcrypt)
if(WIN32)
target_link_libraries(raknet ws2_32)
endif(WIN32)
# Our executables:
add_executable(WorldServer ${SOURCES})
add_executable(AuthServer ${SOURCES_AUTH})
@ -421,9 +430,6 @@ target_link_libraries(ChatServer backtrace)
endif()
endif(UNIX)
if(WIN32)
target_link_libraries(WorldServer ws2_32)
endif(WIN32)
target_link_libraries(WorldServer tinyxml2)
# Target libraries for Auth:
@ -436,9 +442,6 @@ if(UNIX)
target_link_libraries(AuthServer pthread)
target_link_libraries(AuthServer dl)
endif(UNIX)
if(WIN32)
target_link_libraries(AuthServer ws2_32)
endif(WIN32)
# Target libraries for Master:
target_link_libraries(MasterServer dCommon)
@ -450,9 +453,6 @@ if(UNIX)
target_link_libraries(MasterServer pthread)
target_link_libraries(MasterServer dl)
endif(UNIX)
if(WIN32)
target_link_libraries(MasterServer ws2_32)
endif(WIN32)
# Target libraries for Chat:
target_link_libraries(ChatServer dCommon)
@ -465,9 +465,6 @@ if(UNIX)
target_link_libraries(ChatServer pthread)
target_link_libraries(ChatServer dl)
endif(UNIX)
if(WIN32)
target_link_libraries(ChatServer ws2_32)
endif(WIN32)
# Compiler flags:
# Disabled deprecated warnings as the MySQL includes have deprecated code in them.

View File

@ -8,23 +8,39 @@
"configurePresets": [
{
"name": "default",
"displayName": "Default Configure Settings",
"description": "Sets build and install directories",
"displayName": "Default configure step",
"description": "Use 'build' dir and Unix makefiles",
"binaryDir": "${sourceDir}/build",
"generator": "Unix Makefiles"
},
{
"name": "ci-ubuntu-latest",
"displayName": "CI configure step for Ubuntu",
"description": "Same as default, Used in GitHub actions workflow",
"inherits": "default"
},
{
"name": "ci-windows-latest",
"displayName": "CI configure step for Windows",
"description": "Set architecture to 64-bit (b/c RakNet)",
"inherits": "default",
"generator": "Visual Studio 16 2019",
"architecture": {
"value": "x64"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "windows-default",
"inherits": "ci-windows-latest",
"displayName": "Windows only Configure Settings",
"description": "Sets build and install directories",
"binaryDir": "${sourceDir}/build",
"generator": "Ninja",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
}
],
@ -35,14 +51,42 @@
"displayName": "Default Build",
"description": "Default Build",
"jobs": 2
},
{
"name": "ci-windows-latest",
"configurePreset": "ci-windows-latest",
"displayName": "Windows CI Build",
"description": "This preset is used by the CI build on windows",
"configuration": "RelWithDebInfo",
"jobs": 2
},
{
"name": "ci-ubuntu-latest",
"configurePreset": "ci-ubuntu-latest",
"displayName": "Linux CI Build",
"description": "This preset is used by the CI build on linux",
"jobs": 2
}
],
"testPresets": [
{
"name": "default",
"configurePreset": "default",
"displayName": "Default Tests",
"description": "Runs all tests",
"name": "ci-ubuntu-latest",
"configurePreset": "ci-ubuntu-latest",
"displayName": "CI Tests on Linux",
"description": "Runs all tests on a linux configuration",
"execution": {
"jobs": 2
},
"output": {
"outputOnFailure": true
}
},
{
"name": "ci-windows-latest",
"configurePreset": "ci-windows-latest",
"displayName": "CI Tests on windows",
"description": "Runs all tests on a windows configuration",
"configuration": "RelWithDebInfo",
"execution": {
"jobs": 2
},

View File

@ -8,7 +8,7 @@
* @param argv Command line arguments
* @return 0 on success, non-zero on failure
*/
int TestLDFFormat(int argc, char** argv) {
int TestLDFFormat(int argc, char* *const argv) {
// Create
auto* data = LDFBaseData::DataFromString("KEY=0:VALUE");

View File

@ -3,7 +3,7 @@
#include "NiPoint3.h"
#include "CommonCxxTests.h"
int TestNiPoint3(int argc, char** argv) {
int TestNiPoint3(int argc, char* *const argv) {
// Check that Unitize works
ASSERT_EQ(NiPoint3(3,0,0).Unitize(), NiPoint3::UNIT_X);
// Check what unitize does to a vector of length 0