1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Replace App Veyor

This commit is contained in:
Andrii Danylchenko 2021-07-27 21:26:17 +03:00 committed by Andrii Danylchenko
parent cd10be875d
commit 27b3a88dda
8 changed files with 72 additions and 149 deletions

View File

@ -1,7 +1,11 @@
name: CMake
on: [ push ]
name: VCMI
on:
push:
branches:
- features/*
- develop
pull_request:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
@ -16,16 +20,19 @@ jobs:
cc: clang-10
cxx: clang++-10
test: 0
cmake_args: -G Ninja
- platform: linux
os: ubuntu-20.04
cc: gcc-9
cxx: g++-9
test: 0
cmake_args: -G Ninja
- platform: mac
os: macos-latest
test: 0
pack: 1
extension: dmg
cmake_args: -G Ninja
- platform: mxe
os: ubuntu-20.04
mxe: i686-w64-mingw32.shared
@ -33,8 +40,18 @@ jobs:
pack: 1
cpack_args: -D CPACK_NSIS_EXECUTABLE=`which makensis`
extension: exe
cmake_args: -G Ninja
- platform: msvc
os: windows-latest
test: 0
pack: 1
extension: exe
cmake_args: -G "Visual Studio 16 2019" -A x64 '-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake'
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
@ -42,9 +59,10 @@ jobs:
submodules: recursive
- name: Dependencies
run: source ${{github.workspace}}/CI/${{matrix.platform}}/before_install.sh
run: source '${{github.workspace}}/CI/${{matrix.platform}}/before_install.sh'
env:
MXE_TARGET: ${{ matrix.mxe }}
VCMI_BUILD_PLATFORM: x64
- name: Git branch name
id: git-branch-name
@ -52,7 +70,7 @@ jobs:
- name: Build Number
run: |
source ${{github.workspace}}/CI/get_package_name.sh
source '${{github.workspace}}/CI/get_package_name.sh'
echo VCMI_PACKAGE_FILE_NAME="$VCMI_PACKAGE_FILE_NAME" >> $GITHUB_ENV
echo VCMI_PACKAGE_NAME_SUFFIX="$VCMI_PACKAGE_NAME_SUFFIX" >> $GITHUB_ENV
env:
@ -60,9 +78,9 @@ jobs:
- name: Configure CMake
run: |
mkdir ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake -G Ninja .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
mkdir '${{github.workspace}}/build'
cd '${{github.workspace}}/build'
cmake ${{matrix.cmake_args}} .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DENABLE_TEST=${{matrix.test}} \
-DPACKAGE_NAME_SUFFIX:STRING="$VCMI_PACKAGE_NAME_SUFFIX" \
-DPACKAGE_FILE_NAME:STRING="$VCMI_PACKAGE_FILE_NAME"
@ -71,28 +89,35 @@ jobs:
CXX: ${{ matrix.cxx }}
- name: Build
if: ${{ matrix.platform != 'msvc' }}
run: |
cd ${{github.workspace}}/build
cd '${{github.workspace}}/build'
ninja
- name: Build MSVC
if: ${{ matrix.platform == 'msvc' }}
run: |
cd '${{github.workspace}}/build'
cmake --build . --config ${{env.BUILD_TYPE}}
- name: Test
if: ${{ matrix.test == 1 }}
run: |
cd ${{github.workspace}}/build
cd '${{github.workspace}}/build'
ctest -C Release -V
- name: Pack
id: cpack
if: ${{ matrix.pack == 1 }}
run: |
cd ${{github.workspace}}/build
cpack ${{ matrix.cpack_args }}
cd '${{github.workspace}}/build'
cpack -C Release ${{ matrix.cpack_args }}
- name: Additional logs
if: ${{ failure() && steps.cpack.outcome == 'failure' && matrix.platform == 'mxe' }}
run: |
cat ${{github.workspace}}/build/_CPack_Packages/win32/NSIS/project.nsi
cat ${{github.workspace}}/build/_CPack_Packages/win32/NSIS/NSISOutput.log
cat '${{github.workspace}}/build/_CPack_Packages/win32/NSIS/project.nsi'
cat '${{github.workspace}}/build/_CPack_Packages/win32/NSIS/NSISOutput.log'
- name: Artifacts
if: ${{ matrix.pack == 1 }}
@ -102,10 +127,10 @@ jobs:
path: ${{github.workspace}}/build/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }}
- name: Upload build
if: ${{ matrix.pack == 1 && github.ref == 'refs/heads/develop' }}
if: ${{ matrix.pack == 1 && github.ref == 'refs/heads/develop' && matrix.platform != 'msvc' }}
run: |
cd ${{github.workspace}}/build
source ${{github.workspace}}/CI/upload_package.sh
cd '${{github.workspace}}/build'
source '${{github.workspace}}/CI/upload_package.sh'
env:
DEPLOY_RSA: ${{ secrets.DEPLOY_RSA }}
PACKAGE_EXTENSION: ${{ matrix.extension }}

View File

@ -14,7 +14,22 @@ else()
set(FL_FOUND FALSE)
endif()
if(NOT FL_FOUND)
if(TBB_FOUND AND MSVC)
get_target_property(TBB_LIB_LOCATION TBB::tbb LOCATION)
get_filename_component(TBB_LIB_FOLDER ${TBB_LIB_LOCATION} PATH)
get_filename_component(TBB_DLL ${TBB_LIB_FOLDER}/../bin/tbb.dll ABSOLUTE)
message("${TBB_DLL}")
install(FILES ${TBB_DLL} DESTINATION ${BIN_DIR})
endif()
if(FL_FOUND)
if(MSVC)
get_filename_component(FL_LIB_FOLDER ${FL_LIBRARIES} PATH)
get_filename_component(FL_DLL ${FL_LIB_FOLDER}/../bin/fuzzylite.dll ABSOLUTE)
message("${FL_DLL}")
install(FILES ${FL_DLL} DESTINATION ${BIN_DIR})
endif()
else()
set(FL_BUILD_BINARY OFF CACHE BOOL "")
set(FL_BUILD_SHARED OFF CACHE BOOL "")
set(FL_BUILD_TESTS OFF CACHE BOOL "")

View File

@ -1,105 +0,0 @@
# Common configuration for all branches
version: 1.0.{build}
max_jobs: 2
clone_depth: 10
clone_folder: c:\projects\vcmi\source
install:
- bash c:\projects\vcmi\source\CI\msvc\install.sh
build_script:
- cmd: c:\projects\vcmi\source\CI\msvc\build_script.bat
artifacts:
- path: build_$(VCMI_BUILD_PLATFORM)\*.exe
notifications:
- provider: Slack
incoming_webhook:
secure: zxT3HTnxL744HiSv7ig7sjGL4LmJ8n3MsY8PEA/kinbVMkmcxrSgVBVkHV79RfSWSyq4oLMSRvMMpG8SuDWnf6oK/qvgaiAWfwwlCIiA7uQ=
# Branch-specific configuration
for:
# Extended configuration for toolchain_test branch
-
branches:
only:
- toolchain_test
environment:
matrix:
- NAME: MSVS 2015 x86 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VCMI_GENERATOR: Visual Studio 14 2015
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Release
- NAME: MSVS 2015 x86 - Debug
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VCMI_GENERATOR: Visual Studio 14 2015
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Debug
- NAME: MSVS 2015 x64 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VCMI_GENERATOR: Visual Studio 14 2015 Win64
VCMI_BUILD_PLATFORM: x64
VCMI_BUILD_CONFIGURATION: Release
- NAME: MSVS 2015 x64 - Debug
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VCMI_GENERATOR: Visual Studio 14 2015 Win64
VCMI_BUILD_PLATFORM: x64
VCMI_BUILD_CONFIGURATION: Debug
- NAME: MSVS 2017 x86 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Release
- NAME: MSVS 2017 x86 - Debug
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Debug
- NAME: MSVS 2017 x64 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017 Win64
VCMI_BUILD_PLATFORM: x64
VCMI_BUILD_CONFIGURATION: Release
- NAME: MSVS 2017 x64 - Debug
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017 Win64
VCMI_BUILD_PLATFORM: x64
VCMI_BUILD_CONFIGURATION: Debug
# Special configuration for coverity_scan branch
-
branches:
only:
- coverity_scan
environment:
matrix:
- NAME: Coverity - MSVS 2017 x86 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Release
environment:
coverity_token:
secure: XNnpYevnZxGmXW1zLu+3js2S+pqfWPQmL26hVgOTBTI=
coverity_email:
secure: JDd5yXvYaq/yJEVjoadEhA==
build_script:
- cmd: c:\projects\vcmi\source\CI\msvc\coverity_build_script.bat
after_test:
- ps: c:\projects\vcmi\source\CI\msvc\coverity_upload_script.ps
# Default configuration for all other branches
-
environment:
matrix:
- NAME: MSVS 2017 x86 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Release
- NAME: MSVS 2017 x64 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017 Win64
VCMI_BUILD_PLATFORM: x64
VCMI_BUILD_CONFIGURATION: Release

View File

@ -17,7 +17,7 @@ elif [ ! -z "${GITHUB_RUN_ID}" ];
then
echo "Using Github environment variables!"
TMP_JOBID="$GITHUB_RUN_ID"
TMP_BRANCH=${GITHUB_REF#refs/heads/}
TMP_BRANCH=$(basename ${GITHUB_REF#refs/heads/})
TMP_PRID="$PULL_REQUEST"
TMP_COMMIT=$(git rev-parse --short "$GITHUB_SHA")
else

View File

@ -0,0 +1,7 @@
curl -LfsS -o "vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z" \
"https://github.com/vcmi/vcmi-deps-windows/releases/download/v1.4/vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z"
7z x "vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z"
rm -r -f vcpkg/installed/${VCMI_BUILD_PLATFORM}-windows/debug
mkdir -p vcpkg/installed/${VCMI_BUILD_PLATFORM}-windows/debug/bin
cp vcpkg/installed/${VCMI_BUILD_PLATFORM}-windows/bin/* vcpkg/installed/${VCMI_BUILD_PLATFORM}-windows/debug/bin

View File

@ -1,20 +0,0 @@
cd $APPVEYOR_BUILD_FOLDER
git submodule update --init --recursive
cd ..
curl -LfsS -o "vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z" \
"https://github.com/vcmi/vcmi-deps-windows/releases/download/v1.3/vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z"
7z x "vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z"
rmdir vcpkg\installed\${VCMI_BUILD_PLATFORM}-windows\debug /S/Q
xcopy vcpkg\installed\${VCMI_BUILD_PLATFORM}-windows\bin vcpkg\installed\${VCMI_BUILD_PLATFORM}-windows\debug\bin /S/I/Q
cd $APPVEYOR_BUILD_FOLDER
mkdir build_$VCMI_BUILD_PLATFORM
cd build_$VCMI_BUILD_PLATFORM
source $APPVEYOR_BUILD_FOLDER/CI/get_package_name.sh
cmake -G "$VCMI_GENERATOR" .. -DCMAKE_TOOLCHAIN_FILE=$APPVEYOR_BUILD_FOLDER/../vcpkg/scripts/buildsystems/vcpkg.cmake \
-DPACKAGE_NAME_SUFFIX:STRING="$VCMI_PACKAGE_NAME_SUFFIX" \
-DPACKAGE_FILE_NAME:STRING="$VCMI_PACKAGE_FILE_NAME"

View File

@ -122,7 +122,7 @@ if(APPLE)
set(CMAKE_MACOSX_RPATH 0)
endif(APPLE)
if(WIN32)
if(MINGW OR MSVC)
# Windows Vista or newer for FuzzyLite 6 to compile
add_definitions(-D_WIN32_WINNT=0x0600)
@ -177,7 +177,7 @@ if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og")
endif()
endif(MINGW)
endif(WIN32)
endif(MINGW OR MSVC)
if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32) #so far all *nix compilers support such parameters
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wpointer-arith -Wuninitialized")
@ -345,7 +345,8 @@ if(NOT WIN32)
WORLD_READ WORLD_EXECUTE)
endif()
if(MINGW)
if(WIN32)
file(GLOB dep_files
${dep_files}
"${CMAKE_FIND_ROOT_PATH}/bin/*.dll")
@ -378,7 +379,7 @@ if(MINGW)
install(FILES ${dep_files} DESTINATION ${BIN_DIR})
install(FILES ${dep_qwindows} DESTINATION ${BIN_DIR}/platforms)
endif(MINGW)
endif(WIN32)
#######################################
# Packaging section #

View File

@ -178,7 +178,7 @@ target_link_libraries(vcmiclient PRIVATE
${FFMPEG_LIBRARIES} ${FFMPEG_EXTRA_LINKING_OPTIONS} ${TBB_LIBRARIES}
)
target_include_directories(vcmi
target_include_directories(vcmiclient
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${SDL2_INCLUDE_DIR}
PRIVATE ${SDL2_TTF_INCLUDE_DIR}