From 4a2b03a787fb791dc8d693530bcd8a7fe914884f Mon Sep 17 00:00:00 2001 From: Jannik Vogel Date: Fri, 8 Jun 2018 16:05:43 +0200 Subject: [PATCH] Add AppVeyor support --- CMakeLists.txt | 1 + appveyor.yml | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 appveyor.yml diff --git a/CMakeLists.txt b/CMakeLists.txt index 8569da6..a8c049b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.0) +project(swe1r-patcher) add_executable(swe1r-patcher main.c) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..9c04c99 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,92 @@ +# shallow clone +clone_depth: 10 + +version: '{build}' + +os: Visual Studio 2017 Preview + +environment: + # Tell MSYS2 to inherit the current directory when starting the shell + CHERE_INVOKING: 1 + matrix: + - platform: x86 + BUILD_TYPE: mingw + MSYSTEM: MINGW32 + - platform: x86 + BUILD_TYPE: msvc + +configuration: + - Release + +install: + - git submodule update --init --recursive + - ps: | + if ($env:BUILD_TYPE -eq 'mingw') { + # redirect err to null to prevent warnings from becoming errors + C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-cmake 2>&1" + } + +before_build: + - mkdir %BUILD_TYPE%_build + - cd %BUILD_TYPE%_build + - if "%BUILD_TYPE%"=="msvc" if "%platform%"=="x86" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" + - ps: | + if ($env:BUILD_TYPE -eq 'mingw') { + C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DCMAKE_BUILD_TYPE=Release .. 2>&1" + } else { + # redirect stderr and change the exit code to prevent powershell from cancelling the build if cmake prints a warning + cmd /C 'cmake -G "Visual Studio 15 2017 Win64" .. 2>&1 && exit 0' + } + - cd .. + +build_script: + - ps: | + if ($env:BUILD_TYPE -eq 'mingw') { + C:\msys64\usr\bin\bash.exe -lc 'mingw32-make -j4 -C mingw_build/ 2>&1' + } else { + msbuild msvc_build/swe1r-patcher.sln /maxcpucount /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + } + +after_build: + - ps: | + $GITDATE = $(git show -s --date=short --format='%ad') -replace "-","" + $GITREV = $(git show -s --format='%h') + $MINGW_BUILD_ZIP = "swe1r-patcher-mingw-x86-$GITDATE-$GITREV.zip" -replace " ", "" + + # store the build information in env vars so we can use them as artifacts + $env:GITDATE = $GITDATE + $env:GITREV = $GITREV + $env:BUILD_ZIP = $MINGW_BUILD_ZIP + + $CMAKE_SOURCE_DIR = "$env:APPVEYOR_BUILD_FOLDER" + $CMAKE_BINARY_DIR = "$CMAKE_SOURCE_DIR/mingw_build" + $RELEASE_DIST = "mingw_dist" + mkdir $RELEASE_DIST + + # copy the compiled binaries and other release files to the release folder + Get-ChildItem "$CMAKE_BINARY_DIR" -Recurse -Filter "*.data" | Copy-Item -destination $RELEASE_DIST + Get-ChildItem "$CMAKE_BINARY_DIR" -Recurse -Filter "swe1r-*.exe" | Copy-Item -destination $RELEASE_DIST + Copy-Item -path "$CMAKE_SOURCE_DIR/README.md" -destination $RELEASE_DIST + + # Create a zip + 7z a -tzip $MINGW_BUILD_ZIP $RELEASE_DIST\* + + +artifacts: + - path: $(BUILD_ZIP) + name: build + type: zip + +deploy: + - provider: GitHub + tag: version-$(appveyor_build_version) + release: Version $(appveyor_build_version) for $(GITDATE)-$(GITREV) + description: Automatically created. + prerelease: true + repository: JayFoxRox/swe1r-patcher + auth_token: + secure: dt7LXTsIxqTkmXC0FdK7k7K23ifilaIvb0wFXCVDhrNk6u6myk6I0Zgz/FwQ1nFf + on: + appveyor_repo_tag: false + branch: master + BUILD_TYPE: mingw