Reintroduce appveyor-build.py

This commit is contained in:
Elias Kosunen 2018-05-15 10:21:08 +03:00
parent 58991c7404
commit ed839c4a9b
6 changed files with 101 additions and 39 deletions

View File

@ -7,13 +7,6 @@ os: linux
git:
depth: 1
addons:
apt:
update: true
sources: &apt_sources
- ubuntu-toolchain-r-test
packages:
- g++-6
env:
global:
@ -30,8 +23,22 @@ matrix:
# g++ 6 on Linux with C++14
- env: CXX_COMPILER=g++-6 BUILD=Debug STANDARD=14
compiler: gcc
addons:
apt:
update: true
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
- env: CXX_COMPILER=g++-6 BUILD=Release STANDARD=14
compiler: gcc
addons:
apt:
update: true
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
# Apple clang on OS X with C++14
- env: BUILD=Debug STANDARD=14
compiler: clang
@ -79,6 +86,9 @@ matrix:
# Android
- language: android
android:
addons:
apt:
update: true
components:
- tools
- platform-tools

View File

@ -140,13 +140,21 @@ inline void vprint(std::basic_ostream<Char> &os,
template <typename... Args>
inline void print(std::ostream &os, string_view format_str,
const Args & ... args) {
#if FMT_GCC_VERSION && FMT_GCC_VERSION <= 440
vprint<char>(os, format_str, make_format_args<format_context>(args...));
#else
vprint(os, format_str, make_format_args<format_context>(args...));
#endif
}
template <typename... Args>
inline void print(std::wostream &os, wstring_view format_str,
const Args & ... args) {
#if FMT_GCC_VERSION && FMT_GCC_VERSION <= 440
vprint<wchar_t>(os, format_str, make_format_args<wformat_context>(args...));
#else
vprint(os, format_str, make_format_args<wformat_context>(args...));
#endif
}
FMT_END_NAMESPACE

View File

@ -625,14 +625,23 @@ template <typename... Args>
inline int fprintf(std::FILE *f, string_view format_str, const Args & ... args) {
auto vargs = make_format_args<
typename printf_context<internal::buffer>::type>(args...);
#if FMT_GCC_VERSION && FMT_GCC_VERSION <= 440
return vfprintf<char>(f, format_str, vargs);
#else
return vfprintf(f, format_str, vargs);
#endif
}
template <typename... Args>
inline int fprintf(std::FILE *f, wstring_view format_str,
const Args & ... args) {
#if FMT_GCC_VERSION && FMT_GCC_VERSION <= 440
return vfprintf<wchar_t>(f, format_str,
make_format_args<typename printf_context<internal::wbuffer>::type>(args...));
#else
return vfprintf(f, format_str,
make_format_args<typename printf_context<internal::wbuffer>::type>(args...));
#endif
}
inline int vprintf(string_view format, printf_args args) {

47
support/appveyor-build.py Normal file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env python
# Build the project on AppVeyor.
import os
from subprocess import check_call
build = os.environ['BUILD']
config = os.environ['CONFIGURATION']
platform = os.environ['PLATFORM']
path = os.environ['PATH']
image = os.environ['APPVEYOR_BUILD_WORKER_IMAGE']
jobid = os.environ['APPVEYOR_JOB_ID']
cmake_command = ['cmake', '-DFMT_PEDANTIC=ON', '-DCMAKE_BUILD_TYPE=' + config, '..']
if build == 'mingw':
cmake_command.append('-GMinGW Makefiles')
build_command = ['mingw32-make', '-j4']
test_command = ['mingw32-make', 'test']
# Remove the path to Git bin directory from $PATH because it breaks
# MinGW config.
path = path.replace(r'C:\Program Files (x86)\Git\bin', '')
os.environ['PATH'] = r'C:\MinGW\bin;' + path
else:
# Add MSBuild 14.0 to PATH as described in
# http://help.appveyor.com/discussions/problems/2229-v140-not-found-on-vs2105rc.
os.environ['PATH'] = r'C:\Program Files (x86)\MSBuild\15.0\Bin;' + path
if image == 'Visual Studio 2013':
generator = 'Visual Studio 12 2013'
elif image == 'Visual Studio 2015':
generator = 'Visual Studio 14 2015'
elif image == 'Visual Studio 2017':
generator = 'Visual Studio 15 2017'
if platform == 'x64':
generator += ' Win64'
cmake_command.append('-G' + generator)
# build_command = ['msbuild', r'C:\projects\fmt\build\fmt.sln', '/m:4',
# r'/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"']
build_command = ['cmake', '--build', '.', '--config', config, '--', '/m:4']
test_command = ['ctest', '-C', config, '-T', 'Test']
with open('DartConfiguration.tcl', 'w+') as file:
pass
check_call(cmake_command)
check_call(build_command)
check_call(test_command)
# Upload test results
# check_call([r'../support/appveyor-test-upload.ps1', '-configuration', config, '-jobid', jobid])

View File

@ -0,0 +1,11 @@
param (
[Parameter(Mandatory=$true)][string]$configuration,
[Parameter(Mandatory=$true)][string]$jobid
)
$XSLInputElement = New-Object System.Xml.Xsl.XslCompiledTransform
$XslInputElement.Load("https://raw.githubusercontent.com/rpavlik/jenkins-ctest-plugin/master/ctest-to-junit.xsl")
$file = $(ls Testing\*\Test.xml) | Select -first 1
$XSLInputElement.Transform((Resolve-Path $file), (Join-Path (Resolve-Path .) "ctest-to-junit-results.xml"))
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$jobid", (Resolve-Path .\ctest-to-junit-results.xml))

View File

@ -8,49 +8,26 @@ platform:
- Win32
- x64
image:
- Visual Studio 2013
- Visual Studio 2015
- Visual Studio 2017
environment:
CTEST_OUTPUT_ON_FAILURE: 1
MSVC_DEFAULT_OPTIONS: ON
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
CMAKE_GENERATOR: Visual Studio 12 2013
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CMAKE_GENERATOR: Visual Studio 14 2015
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_GENERATOR: Visual Studio 15 2017
BUILD: msvc
matrix:
allow_failures:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
CMAKE_GENERATOR: Visual Studio 12 2013
init:
- ps: |
If ($env:Platform -Match "x64") {
$env:CMAKE_GENERATOR_SUFFIX=" Win64"
}
- image: Visual Studio 2013
before_build:
- mkdir build
- cd build
- ps: cmake -G "$($env:CMAKE_GENERATOR)$($env:CMAKE_GENERATOR_SUFFIX)" -DFMT_WERROR=OFF -DFMT_PEDANTIC=ON -DCMAKE_BUILD_TYPE="$($env:configuration)" ..
build:
project: C:\projects\fmt\build\fmt.sln
parallel: true
verbosity: normal
test_script:
- ps: |
New-Item .\DartConfiguration.tcl -ItemType file
ctest -C "$($env:configuration)" -T Test
$XSLInputElement = New-Object System.Xml.Xsl.XslCompiledTransform
$XslInputElement.Load("https://raw.githubusercontent.com/rpavlik/jenkins-ctest-plugin/master/ctest-to-junit.xsl")
$file = $(ls Testing\*\Test.xml) | Select -first 1
$XSLInputElement.Transform((Resolve-Path $file), (Join-Path (Resolve-Path .) "ctest-to-junit-results.xml"))
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\ctest-to-junit-results.xml))
build_script:
- python ../support/appveyor-build.py
on_failure:
- appveyor PushArtifact Testing/Temporary/LastTest.log