Merge pull request #352 from DarkflameUniverse/feature/windows-ci

Add windows CI
This commit is contained in:
Xiphoseer 2022-01-09 00:54:24 +01:00 committed by GitHub
commit 77826c8691
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 90 additions and 31 deletions

View File

@ -1,4 +1,4 @@
name: Cmake CI name: CI
on: on:
push: push:
@ -8,27 +8,45 @@ on:
jobs: jobs:
build-and-test: build-and-test:
name: Build & Test (${{ matrix.os }})
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-2022, ubuntu-20.04 ]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: true submodules: true
- name: Add msbuild to PATH (windows only)
if: ${{ matrix.os == 'windows-2022' }}
uses: microsoft/setup-msbuild@v1.1
with:
vs-version: '[17,18)'
msbuild-architecture: x64
- name: cmake - name: cmake
uses: lukka/run-cmake@v10 uses: lukka/run-cmake@v10
with: with:
configurePreset: 'default' configurePreset: "ci-${{matrix.os}}"
buildPreset: 'default' buildPreset: "ci-${{matrix.os}}"
testPreset: 'default' testPreset: "ci-${{matrix.os}}"
- name: artifacts - name: artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: linux-build name: build-${{matrix.os}}
path: | path: |
build build
!build/tests
!build/Testing
!build/CMakeFiles
!build/DartConfiguration.tcl
!build/CTestTestfile.cmake
!build/CMakeCache.txt !build/CMakeCache.txt
!build/build.ninja !build/build.ninja
!build/_deps !build/_deps
!build/cmake_install.cmake !build/cmake_install.cmake
!build/*.a !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 ${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: # 3rdparty static libraries:
#add_library(zlib ${SOURCES_ZLIB}) #add_library(zlib ${SOURCES_ZLIB})
add_library(raknet ${SOURCES_RAKNET}) 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 ZLIB::ZLIB)
target_link_libraries(dCommon libbcrypt) target_link_libraries(dCommon libbcrypt)
if(WIN32)
target_link_libraries(raknet ws2_32)
endif(WIN32)
# Our executables: # Our executables:
add_executable(WorldServer ${SOURCES}) add_executable(WorldServer ${SOURCES})
add_executable(AuthServer ${SOURCES_AUTH}) add_executable(AuthServer ${SOURCES_AUTH})
@ -421,9 +430,6 @@ target_link_libraries(ChatServer backtrace)
endif() endif()
endif(UNIX) endif(UNIX)
if(WIN32)
target_link_libraries(WorldServer ws2_32)
endif(WIN32)
target_link_libraries(WorldServer tinyxml2) target_link_libraries(WorldServer tinyxml2)
# Target libraries for Auth: # Target libraries for Auth:
@ -436,9 +442,6 @@ if(UNIX)
target_link_libraries(AuthServer pthread) target_link_libraries(AuthServer pthread)
target_link_libraries(AuthServer dl) target_link_libraries(AuthServer dl)
endif(UNIX) endif(UNIX)
if(WIN32)
target_link_libraries(AuthServer ws2_32)
endif(WIN32)
# Target libraries for Master: # Target libraries for Master:
target_link_libraries(MasterServer dCommon) target_link_libraries(MasterServer dCommon)
@ -450,9 +453,6 @@ if(UNIX)
target_link_libraries(MasterServer pthread) target_link_libraries(MasterServer pthread)
target_link_libraries(MasterServer dl) target_link_libraries(MasterServer dl)
endif(UNIX) endif(UNIX)
if(WIN32)
target_link_libraries(MasterServer ws2_32)
endif(WIN32)
# Target libraries for Chat: # Target libraries for Chat:
target_link_libraries(ChatServer dCommon) target_link_libraries(ChatServer dCommon)
@ -465,9 +465,6 @@ if(UNIX)
target_link_libraries(ChatServer pthread) target_link_libraries(ChatServer pthread)
target_link_libraries(ChatServer dl) target_link_libraries(ChatServer dl)
endif(UNIX) endif(UNIX)
if(WIN32)
target_link_libraries(ChatServer ws2_32)
endif(WIN32)
# Compiler flags: # Compiler flags:
# Disabled deprecated warnings as the MySQL includes have deprecated code in them. # Disabled deprecated warnings as the MySQL includes have deprecated code in them.

View File

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

View File

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

View File

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