Skip to content

Commit 608e3ea

Browse files
committed
CI build on macOS (#82)
* [WIP] try CI on macOS * [WIP] try CI on macOS * Update azure-pipelines.yml for Azure Pipelines * Update azure-pipelines.yml for Azure Pipelines * [WIP] try CI on macOS * Update azure-pipelines.yml for Azure Pipelines * [WIP] try CI on macOS * [WIP] try CI on macOS * Update azure-pipelines.yml for Azure Pipelines * [WIP] try CI on macOS * fix tests for macOS logs format * [WIP] try CI on macOS * fix tests matcher * [WIP] try CI on macOS * Update azure-pipelines.yml for Azure Pipelines * [WIP] try CI on macOS * [WIP] try CI on macOS * [WIP] try CI on macOS, fix cache issue * update README.md * [WIP] try CI on macOS, cache seems not working * add macOS appveyor build, cache not working appveyor issue(?). Fix #60 * add macOS appveyor build, cache not working appveyor issue(?). Fix #60 * appveyors cleanups #60 * Update azure-pipelines.yml for Azure Pipelines appveyor fix macOS build appveyor fix2 macOS build appveyor fix3 macOS build [appveyor] fix ci-macos (#84)
1 parent 11ea1d3 commit 608e3ea

File tree

4 files changed

+96
-23
lines changed

4 files changed

+96
-23
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/83e178fb7d9343b78be651f2797fe3f8)](https://app.codacy.com/manual/Raffaello/sdl2-vga-terminal?utm_source=github.com&utm_medium=referral&utm_content=Raffaello/sdl2-vga-terminal&utm_campaign=Badge_Grade_Settings)
44

5-
| Windows (x86, x64) / Linux (x64) |
6-
|----------------------------------|
5+
| Windows (x86, x64) / Linux (x64) / macOS (x64) |
6+
|------------------------------------------------|
77
|[![Build status](https://ci.appveyor.com/api/projects/status/67mildjynhnlekk5/branch/master?svg=true)](https://ci.appveyor.com/project/Raffaello/sdl2-vga-terminal/branch/master)|
88
|[![Build Status](https://dev.azure.com/raffaellobertini/sdl2-vga-terminal/_apis/build/status/Raffaello.sdl2-vga-terminal?branchName=master)](https://dev.azure.com/raffaellobertini/sdl2-vga-terminal/_build/latest?definitionId=2&branchName=master)|
99

appveyor.yml

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ skip_branch_with_pr: false
77
image:
88
- Visual Studio 2019
99
- Ubuntu
10+
- macOS
1011

1112
platform:
1213
- x86
@@ -23,16 +24,41 @@ matrix:
2324
allow_failures:
2425
- platform: x86
2526
image: Ubuntu
27+
- platform: x86
28+
image: macOS
2629

2730
for:
2831
-
2932
matrix:
3033
only:
3134
- image: Ubuntu
35+
environment:
36+
WS: /home/appveyor
37+
TRIPLET: $PLATFORM-linux
38+
cache:
39+
#- $WS/vcpkg/vcpkg
40+
- $WS/vcpkg/packages
41+
- $WS/vcpkg/installed
42+
init:
43+
- sh: if [ $PLATFORM = "x86" ]; then exit 1; fi
44+
-
45+
matrix:
46+
only:
47+
- image: macOS
48+
environment:
49+
WS: /Users/appveyor/projects
50+
TRIPLET: $PLATFORM-osx
3251
cache:
33-
- /home/appveyor/vcpkg/vcpkg
34-
- /home/appveyor/vcpkg/packages
35-
- /home/appveyor/vcpkg/installed
52+
- $WS/vcpkg/packages
53+
- $WS/vcpkg/installed
54+
init:
55+
- sh: if [ $PLATFORM = "x86" ]; then exit 1; fi
56+
- sh: brew install p7zip
57+
- sh: cd $WS && git clone https://github.com/Microsoft/vcpkg.git
58+
- sh: cd $APPVEYOR_BUILD_FOLDER
59+
60+
test_script:
61+
- sh: ctest -V
3662

3763

3864
skip_commits:
@@ -42,43 +68,45 @@ skip_commits:
4268
- README.md
4369
- azure-pipelines.yml
4470

45-
init:
46-
- sh: if [ $PLATFORM = "x86" ]; then exit 1; fi
71+
cache:
72+
#- C:\tools\vcpkg\vcpkg.exe
73+
- C:\tools\vcpkg\packages
74+
- C:\tools\vcpkg\installed
75+
4776

4877
install:
4978
- cmd: if "%PLATFORM%" == "x64" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
5079
- cmd: if "%PLATFORM%" == "x86" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"
51-
- ninja --version
80+
- cmd: ninja --version
5281

5382
before_build:
5483
- cmd: cd C:\tools\vcpkg
55-
- sh : cd /home/appveyor/vcpkg
84+
- sh : cd $WS/vcpkg
5685
- git pull
5786
- cmd: .\bootstrap-vcpkg.bat
5887
- sh : ./bootstrap-vcpkg.sh
5988
- cmd: vcpkg install sdl2 sdl2-image gtest --triplet %PLATFORM%-windows
60-
- sh : vcpkg install sdl2 sdl2-image gtest --triplet $PLATFORM-linux
61-
- vcpkg integrate install
89+
- sh : ./vcpkg install sdl2 sdl2-image gtest --triplet $TRIPLET
90+
- cmd: vcpkg integrate install
91+
- sh: ./vcpkg integrate install
6292
- cmd: cd %APPVEYOR_BUILD_FOLDER%
6393
- sh : cd $APPVEYOR_BUILD_FOLDER
6494

65-
cache:
66-
- C:\tools\vcpkg\vcpkg.exe
67-
- C:\tools\vcpkg\packages
68-
- C:\tools\vcpkg\installed
69-
7095
build_script:
7196
- mkdir out
7297
- cd out
7398
- cmd: cmake -G "Ninja" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DWITH_SDL2_STATIC=OFF -DBUILD_SNAPSHOT=OFF -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/%VCPKG_SCRIPT% ..
74-
- sh : cmake -DCMAKE_BUILD_TYPE=$CONFIGURATION -DWITH_SDL2_STATIC=ON -DBUILD_SNAPSHOT=OFF -DCMAKE_TOOLCHAIN_FILE=/home/appveyor/vcpkg/scripts/buildsystems/vcpkg.cmake ..
99+
- sh : cmake -DCMAKE_BUILD_TYPE=$CONFIGURATION -DWITH_SDL2_STATIC=ON -DBUILD_SNAPSHOT=OFF -DCMAKE_TOOLCHAIN_FILE=$WS/vcpkg/$VCPKG_SCRIPT ..
100+
- cmake --build .
75101

76102
test_script:
77-
- cmake --build .
78-
- cmd: ctest -V # ubuntu image is headless, no video driver.
103+
- cmd: ctest -V # ubuntu image is headless, no video driver.
104+
105+
after_test:
79106
- cmd: cmake --build . --target install # skip linux, as the current path might not be ok, is more package related.
80107
- cmake --build . --target package
81108

109+
82110
artifacts:
83111
- path: "out/*.zip"
84112
type: zip

azure-pipelines.yml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,48 @@ stages:
136136
displayName: cmake install
137137
- script: cmake --build . --target package
138138
workingDirectory: build
139-
displayName: cmake package
139+
displayName: cmake package
140+
141+
- job: macOS
142+
strategy:
143+
matrix:
144+
Debug:
145+
CONFIGURATION: Debug
146+
Release:
147+
CONFIGURATION: Release
148+
pool:
149+
vmImage: 'macOS-10.15'
150+
steps:
151+
- bash: |
152+
git clone https://github.com/Microsoft/vcpkg.git
153+
mkdir build && echo "create build dir"
154+
displayName: clone vcpkg, mkdir build
155+
- task: Cache@2
156+
inputs:
157+
key: 'vcpkg-packages | "$(Agent.OS)-$(Agent.OSArchitecture)"'
158+
path: "vcpkg/packages"
159+
displayName: "(cache) vcpkg-packages"
160+
- task: Cache@2
161+
inputs:
162+
key: 'vcpkg-installed | "$(Agent.OS)-$(Agent.OSArchitecture)"'
163+
path: "vcpkg/installed"
164+
displayName: "(cache) vcpkg-installed"
165+
- script: |
166+
./bootstrap-vcpkg.sh
167+
./vcpkg install sdl2 sdl2-image gtest
168+
./vcpkg integrate install
169+
workingDirectory: vcpkg
170+
displayName: vcpkg
171+
- script: |
172+
cmake -DCMAKE_BUILD_TYPE=${CONFIGURATION} -DWITH_SDL2_STATIC=ON -DBUILD_SNAPSHOT=OFF -DCMAKE_TOOLCHAIN_FILE=${BUILD_REPOSITORY_LOCALPATH}/vcpkg/scripts/buildsystems/vcpkg.cmake ..
173+
workingDirectory: build
174+
displayName: cmake generator
175+
- script: cd build && cmake --build .
176+
displayName: cmake build
177+
- script: cd build && ctest -V
178+
displayName: cmake test (ctest)
179+
#- script: cd build && cmake --build . --target install
180+
# displayName: cmake --target install
181+
- script: cd build && cmake --build . --target package
182+
displayName: cmake --target package
183+

sdl2-vga-terminal/test/tests.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "Environment.hpp"
77
#include <cstring>
88

9+
910
void cmpViewportCheck(const SDL_Rect& vp, const SDL_Rect& exp)
1011
{
1112
EXPECT_EQ(vp.x, exp.x);
@@ -48,7 +49,7 @@ TEST(VgaTerminal, TimerNotInitedWarning)
4849
VgaTerminal term = VgaTerminal(title, SDL_WINDOW_HIDDEN, -1, 0);
4950
std::string output = testing::internal::GetCapturedStderr();
5051
EXPECT_THAT(output, testing::EndsWith("TIMER or EVENTS not inited.\n"));
51-
EXPECT_THAT(output, testing::StartsWith("WARN:"));
52+
EXPECT_THAT(output, testing::HasSubstr("WARN:"));
5253
}
5354
Environment::tearDown();
5455
Environment::setUp();
@@ -263,7 +264,7 @@ INSTANTIATE_TEST_SUITE_P(
263264
class SetViewportNullErrTests: public ::testing::TestWithParam<std::tuple<int, int, int, int>> {};
264265
TEST_P(SetViewportNullErrTests, setViewportNullError)
265266
{
266-
using ::testing::StartsWith;
267+
using ::testing::HasSubstr;
267268
using ::testing::EndsWith;
268269

269270
SDL_Rect vp;
@@ -277,7 +278,7 @@ TEST_P(SetViewportNullErrTests, setViewportNullError)
277278
testing::internal::CaptureStderr();
278279
EXPECT_FALSE(term.setViewPort(vp));
279280
std::string output = testing::internal::GetCapturedStderr();
280-
EXPECT_THAT(output, StartsWith("WARN: ["));
281+
EXPECT_THAT(output, HasSubstr("WARN: ["));
281282
EXPECT_THAT(output, EndsWith("VgaTerminal] setViewPort: viewport too small.\n"));
282283
}
283284
INSTANTIATE_TEST_SUITE_P(

0 commit comments

Comments
 (0)