-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up CI with Azure Pipelines (#11)
* Set up CI with Azure Pipelines * Testing a Windows pipeline * Add CI script * Better Python finding to support Windows * No chocolatey Python install * No libman generator for now * Use Ninja in CI * Don't always run the Docker tests * Source VS environment * No YAML anchors * Get Ninja for Linux * Fix python find failure when Python outputs version to stderr * More tests for CI * Try a PowerShell script * Real PowerShell CI script * Use PowerShell CI in all jobs * Disable `ci/` tests directory for Linux * Add macOS job * tweak path to gcc on macOS * Enable debug output in CI tests * Print vcpkg output when in debug mode * Smarter GCC finding * More verbose GCC finding * Tweak CC and CXX logic * More precise gcc * Auto-determine the target triplet when installing VCPKG packages * Remove misplaced line * Wrong spelling of osx triplet * Fix arch detection when using voidptr size * Remove old CI cmakek script
- Loading branch information
1 parent
ae9a642
commit 6c289c0
Showing
13 changed files
with
307 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Starter pipeline | ||
# Start with a minimal pipeline that you can customize to build and deploy your code. | ||
# Add steps that build, run tests, deploy, and more: | ||
# https://aka.ms/yaml | ||
|
||
jobs: | ||
- job: MSVC | ||
pool: | ||
vmImage: vs2017-win2016 | ||
steps: | ||
- script: choco install ninja | ||
displayName: Install Ninja | ||
- script: > | ||
call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\vsdevcmd" -arch=x64 && | ||
powershell ./ci.ps1 -ForceMSVC | ||
displayName: Run tests | ||
- job: MinGW | ||
pool: | ||
vmImage: vs2017-win2016 | ||
steps: | ||
- script: choco install ninja | ||
displayName: Install Ninja | ||
- script: > | ||
call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\vsdevcmd" -arch=x64 && | ||
powershell ./ci.ps1 | ||
displayName: Run tests | ||
- job: LinuxDocker | ||
pool: | ||
vmImage: ubuntu-16.04 | ||
|
||
steps: | ||
- script: | | ||
curl -Ls https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip -o ninja-linux.zip | ||
unzip ninja-linux.zip | ||
sudo cp -v ninja /usr/local/bin/ | ||
sudo apt-get install -y python3-venv | ||
displayName: Prepare System | ||
- script: pwsh ./ci.ps1 -RunDockerTests -NoCITestDir | ||
displayName: Run tests | ||
|
||
- job: macOS | ||
pool: | ||
vmImage: macos-10.13 | ||
steps: | ||
- script: | | ||
curl -Ls https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip -o ninja-mac.zip | ||
unzip ninja-mac.zip | ||
sudo cp -v ninja /usr/local/bin/ | ||
displayName: Prepare System | ||
- script: pwsh ./ci.ps1 | ||
displayName: Run tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
param( | ||
# Run the Docker tests | ||
[switch] | ||
$RunDockerTests, | ||
# Forcibly set CC and CXX to MSVC cl.exe | ||
[switch] | ||
$ForceMSVC, | ||
# Ignore the `ci/` tests directory | ||
[switch] | ||
$NoCITestDir | ||
) | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
if ($PSVersionTable.OS -and $PSVersionTable.OS.StartsWith("Darwin")) { | ||
# We're on macOS, and we need a newer GCC for the FS TS | ||
& brew install gcc6 | ||
if ($LASTEXITCODE) { | ||
throw "Brew installation failed!" | ||
} | ||
$cc = Get-ChildItem '/usr/local/Cellar/gcc@6/*/bin/gcc-6' | ||
$cxx = Get-ChildItem '/usr/local/Cellar/gcc@6/*/bin/g++-6' | ||
$env:CC = $cc.FullName | ||
$env:CXX = $cxx.FullName | ||
} | ||
|
||
if ($ForceMSVC) { | ||
$env:CC = "cl" | ||
$env:CXX = "cl" | ||
} | ||
|
||
$cmake = (Get-Command -Name cmake).Source | ||
$ninja = (Get-Command -Name ninja).Source | ||
|
||
if (! $cmake) { | ||
throw "No CMake installed?" | ||
} | ||
if (! $ninja) { | ||
throw "No Ninja found?" | ||
} | ||
|
||
$source_dir = $PSScriptRoot | ||
$bin_dir = Join-Path $source_dir "ci-build" | ||
|
||
if (Test-Path $bin_dir) { | ||
Remove-Item -Recurse $bin_dir -Force | ||
} | ||
|
||
$run_docker_tests = "FALSE" | ||
if ($RunDockerTests) { | ||
$run_docker_tests = "TRUE" | ||
} | ||
$no_ci_test_dir = "FALSE" | ||
if ($NoCITestDir) { | ||
$no_ci_test_dir = "TRUE" | ||
} | ||
|
||
& $cmake -GNinja ` | ||
"-DRUN_DOCKER_TESTS:BOOL=$run_docker_tests" ` | ||
"-DNO_CI_TEST_DIR:BOOL=$no_ci_test_dir" ` | ||
"-H$source_dir" "-B$bin_dir" | ||
if ($LASTEXITCODE) { | ||
throw "CMake configure failed [$LASTEXITCODE]" | ||
} | ||
|
||
& $cmake --build $bin_dir | ||
if ($LASTEXITCODE) { | ||
throw "CMake build failed [$LASTEXITCODE]" | ||
} | ||
|
||
$cm_dir = Split-Path $cmake -Parent | ||
$ctest = Join-Path $cm_dir "ctest" | ||
& $cmake -E chdir $bin_dir $ctest -j6 --output-on-failure | ||
if ($LASTEXITCODE) { | ||
throw "CTest failed [$LASTEXITCODE]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
foreach(subdir | ||
conan | ||
vcpkg | ||
) | ||
get_filename_component(fulldir ${subdir} ABSOLUTE) | ||
add_test( | ||
NAME "pmm.test.ci.${subdir}" | ||
COMMAND "${CMAKE_COMMAND}" | ||
-D "PMM_URL=file://${PROJECT_SOURCE_DIR}/pmm" | ||
-D "PMM_INCLUDE=${PROJECT_SOURCE_DIR}/pmm.cmake" | ||
-D GENERATOR=${CMAKE_GENERATOR} | ||
-D "BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR}/${subdir}" | ||
-D SOURCE_DIR=${fulldir} | ||
-P "${CMAKE_CURRENT_SOURCE_DIR}/RunCITest.cmake" | ||
) | ||
endforeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
file(REMOVE_RECURSE "${BUILD_DIR}") | ||
|
||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} | ||
-D PMM_URL=${PMM_URL} | ||
-D PMM_INCLUDE=${PMM_INCLUDE} | ||
-D PMM_DEBUG=TRUE | ||
-G ${GENERATOR} | ||
"-H${SOURCE_DIR}" | ||
"-B${BUILD_DIR}" | ||
RESULT_VARIABLE retc | ||
) | ||
|
||
if(retc) | ||
message(FATAL_ERROR "Configure failed [${retc}]") | ||
endif() | ||
|
||
exec_program( | ||
COMMAND ${CMAKE_COMMAND} --build ${BUILD_DIR} | ||
RESULT_VARIABLE retc | ||
) | ||
|
||
if(retc) | ||
message(FATAL_ERROR "Build failed [${retc}]") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(TestProject) | ||
|
||
message(STATUS "PMM URL is ${PMM_URL}") | ||
include(${PMM_INCLUDE}) | ||
pmm(CONAN DEBUG) | ||
|
||
add_executable(dummy main.cpp) | ||
target_link_libraries(dummy PRIVATE CONAN_PKG::spdlog) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import conans | ||
|
||
|
||
class CITestConanProject(conans.ConanFile): | ||
name = 'CITestProject' | ||
version = '1.2.3' | ||
generators = 'cmake' | ||
requires = ('spdlog/1.1.0@bincrafters/stable') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <spdlog/spdlog.h> | ||
|
||
int main() { | ||
auto console = spdlog::stdout_color_mt("console"); | ||
console->info("Hello!"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(TestProject) | ||
|
||
message(STATUS "PMM URL is ${PMM_URL}") | ||
include(${PMM_INCLUDE}) | ||
pmm(VCPKG | ||
REVISION 2a283bd5224b5335a90539faa1b0ac7260411465 | ||
REQUIRES spdlog | ||
DEBUG | ||
) | ||
|
||
find_package(spdlog REQUIRED CONFIG) | ||
|
||
add_executable(dummy main.cpp) | ||
target_link_libraries(dummy PRIVATE spdlog::spdlog) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import conans | ||
|
||
|
||
class CITestConanProject(conans.ConanFile): | ||
name = 'CITestProject' | ||
version = '1.2.3' | ||
generators = 'cmake' | ||
requires = ('spdlog/1.1.0@bincrafters/stable') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <spdlog/spdlog.h> | ||
|
||
int main() { | ||
auto console = spdlog::stdout_color_mt("console"); | ||
console->info("Hello!"); | ||
} |