aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-08-22 14:56:51 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-08-22 15:13:54 +0300
commit406f00777503e698ecfca8142fc197eda44452d2 (patch)
tree0dd512e203cae476c1abd66fb66919d16340d120
parentAppVeyor: fix build numbering & only build master (diff)
downloadaes-tools-406f00777503e698ecfca8142fc197eda44452d2.tar.gz
aes-tools-406f00777503e698ecfca8142fc197eda44452d2.zip
AppVeyor: better practices
Diffstat (limited to '')
-rw-r--r--.appveyor/build.ps171
-rw-r--r--.appveyor/test.ps155
-rw-r--r--appveyor.yml18
3 files changed, 91 insertions, 53 deletions
diff --git a/.appveyor/build.ps1 b/.appveyor/build.ps1
index 173ba3c..3016b42 100644
--- a/.appveyor/build.ps1
+++ b/.appveyor/build.ps1
@@ -1,7 +1,8 @@
param(
- [string] $BuildDir = 'C:\Projects\build',
+ [string] $BuildDir = $null,
[string] $ProjectDir = $null,
[string] $Platform = $null,
+ [string] $Generator = $null,
[string] $Configuration = $null,
[string] $BoostDir = $null,
[string] $BoostLibraryDir = $null,
@@ -9,6 +10,7 @@ param(
)
$ErrorActionPreference = "Stop";
+Set-PSDebug -Strict
function Invoke-Exe {
param(
@@ -55,6 +57,22 @@ function Get-AppVeyorBoostLibraryDir {
}
}
+function Set-AppVeyorDefaults {
+ $script:ProjectDir = $env:APPVEYOR_BUILD_FOLDER
+ $script:BuildDir = 'C:\Projects\build'
+ $script:Generator = switch ($env:APPVEYOR_BUILD_WORKER_IMAGE) {
+ 'Visual Studio 2013' { 'Visual Studio 12 2013' }
+ 'Visual Studio 2015' { 'Visual Studio 14 2015' }
+ 'Visual Studio 2017' { 'Visual Studio 15 2017' }
+ default { throw "Unsupported AppVeyor image: $env:APPVEYOR_BUILD_WORKER_IMAGE" }
+ }
+ $script:Platform = $env:PLATFORM
+ $script:Configuration = $env:CONFIGURATION
+ $script:BoostDir = Get-AppVeyorBoostDir
+ $script:BoostLibraryDir = Get-AppVeyorBoostLibraryDir -Platform $script:Platform
+ $script:UseAsm = -not ($env:appveyor_asm -eq '0')
+}
+
function Build-Project {
param(
[Parameter(Mandatory=$true)]
@@ -62,6 +80,8 @@ function Build-Project {
[Parameter(Mandatory=$true)]
[string] $BuildDir,
[Parameter(Mandatory=$true)]
+ [string] $Generator,
+ [Parameter(Mandatory=$true)]
[string] $Platform,
[Parameter(Mandatory=$true)]
[string] $Configuration,
@@ -84,8 +104,8 @@ function Build-Project {
mkdir $BuildDir
cd $BuildDir
- Invoke-Exe { cmake -Wno-dev `
- -G "Visual Studio 15 2017" -A $Platform `
+ Invoke-Exe { cmake.exe -Wno-dev `
+ -G $Generator -A $Platform `
-D "AES_TOOLS_ASM=$cmake_asm" `
-D "BOOST_ROOT=$BoostDir" `
-D "BOOST_LIBRARYDIR=$BoostLibraryDir" `
@@ -94,29 +114,30 @@ function Build-Project {
$ProjectDir
}
- Invoke-Exe { cmake --build . --config "$Configuration" -- /m }
+ Invoke-Exe { cmake.exe --build . --config $Configuration -- /m }
}
-if (Test-AppVeyor) {
- $cwd = pwd
- $ProjectDir = $env:APPVEYOR_BUILD_FOLDER
- $BuildDir = 'C:\Projects\build'
- $Platform = $env:PLATFORM
- $Configuration = $env:CONFIGURATION
- $BoostDir = Get-AppVeyorBoostDir
- $BoostLibraryDir = Get-AppVeyorBoostLibraryDir -Platform $Platform
- $UseAsm = -not ($env:appveyor_asm -eq '0')
+function Build-ProjectAppVeyor {
+ if (Test-AppVeyor) {
+ Set-AppVeyorDefaults
+ $appveyor_cwd = pwd
+ }
+
+ try {
+ Build-Project `
+ -ProjectDir $script:ProjectDir `
+ -BuildDir $script:BuildDir `
+ -Generator $script:Generator `
+ -Platform $script:Platform `
+ -Configuration $script:Configuration `
+ -BoostDir $script:BoostDir `
+ -BoostLibraryDir $script:BoostLibraryDir `
+ -UseAsm $UseAsm
+ } finally {
+ if (Test-AppVeyor) {
+ cd $appveyor_cwd
+ }
+ }
}
-Build-Project `
- -ProjectDir $ProjectDir `
- -BuildDir $BuildDir `
- -Platform $Platform `
- -Configuration $Configuration `
- -BoostDir $BoostDir `
- -BoostLibraryDir $BoostLibraryDir `
- -UseAsm $UseAsm
-
-if (Test-AppVeyor) {
- cd $cwd
-}
+Build-ProjectAppVeyor
diff --git a/.appveyor/test.ps1 b/.appveyor/test.ps1
index 88ad8a9..6eced27 100644
--- a/.appveyor/test.ps1
+++ b/.appveyor/test.ps1
@@ -5,6 +5,7 @@ param(
)
$ErrorActionPreference = "Stop";
+Set-PSDebug -Strict
function Invoke-Exe {
param(
@@ -47,6 +48,12 @@ function Get-AppVeyorPythonDir {
}
}
+function Set-AppVeyorDefaults {
+ $script:ProjectDir = $env:APPVEYOR_BUILD_FOLDER
+ $script:UtilsDir = Get-AppVeyorUtilsDir
+ $script:PythonDir = Get-AppVeyorPythonDir
+}
+
function Run-ProjectTests {
param(
[Parameter(Mandatory=$true)]
@@ -58,33 +65,37 @@ function Run-ProjectTests {
$test_dir = "$ProjectDir\test"
cd $test_dir
- Invoke-Exe { python nist.py --path $UtilsDir --log nist.log }
- Get-Content nist.log -Tail 5
- Invoke-Exe { python cavp.py --path $UtilsDir --log cavp.log }
- Get-Content cavp.log -Tail 5
- Invoke-Exe { python nist.py --path $UtilsDir --log nist.log --boxes }
+ Invoke-Exe { python.exe nist.py --path $UtilsDir --log nist.log }
Get-Content nist.log -Tail 5
- Invoke-Exe { python cavp.py --path $UtilsDir --log cavp.log --boxes }
+ Invoke-Exe { python.exe cavp.py --path $UtilsDir --log cavp.log }
Get-Content cavp.log -Tail 5
- Invoke-Exe { python file.py --path $UtilsDir --log file.log }
+ Invoke-Exe { python.exe nist.py --path $UtilsDir --log nist_boxes.log --boxes }
+ Get-Content nist_boxes.log -Tail 5
+ Invoke-Exe { python.exe cavp.py --path $UtilsDir --log cavp_boxes.log --boxes }
+ Get-Content cavp_boxes.log -Tail 5
+ Invoke-Exe { python.exe file.py --path $UtilsDir --log file.log }
Get-Content file.log -Tail 5
}
-if (Test-AppVeyor) {
- $cwd = pwd
- $ProjectDir = $env:APPVEYOR_BUILD_FOLDER
- $UtilsDir = Get-AppVeyorUtilsDir
- $PythonDir = Get-AppVeyorPythonDir
-}
-
-if ($PythonDir) {
- $env:PATH = "${PythonDir};${env:PATH}"
-}
+function Run-ProjectTestsAppVeyor {
+ if (Test-AppVeyor) {
+ Set-AppVeyorDefaults
+ $appveyor_cwd = pwd
+ }
-Run-ProjectTests `
- -ProjectDir $ProjectDir `
- -UtilsDir $UtilsDir
+ try {
+ if ($script:PythonDir) {
+ $env:PATH = "${script:PythonDir};${env:PATH}"
+ }
-if (Test-AppVeyor) {
- cd $cwd
+ Run-ProjectTests `
+ -ProjectDir $script:ProjectDir `
+ -UtilsDir $script:UtilsDir
+ } finally {
+ if (Test-AppVeyor) {
+ cd $appveyor_cwd
+ }
+ }
}
+
+Run-ProjectTestsAppVeyor
diff --git a/appveyor.yml b/appveyor.yml
index 58d0005..85ba310 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,17 +1,23 @@
version: '{build}'
-image:
- - Visual Studio 2017
-
branches:
only:
- master
environment:
- appveyor_boost_version: 1.69.0
matrix:
- - appveyor_asm: 1
- - appveyor_asm: 0
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ appveyor_boost_version: 1.62.0
+ appveyor_asm: 1
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ appveyor_boost_version: 1.62.0
+ appveyor_asm: 0
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+ appveyor_boost_version: 1.69.0
+ appveyor_asm: 1
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+ appveyor_boost_version: 1.69.0
+ appveyor_asm: 0
platform:
- Win32