PR build definitions in YAML (#1)

PR build definitions for MSBuild (Windows) and .NET Core (all operating systems)
This commit is contained in:
Sergey B. Berezin 2018-10-03 00:30:01 +03:00 коммит произвёл GitHub
Родитель 933fb3183b
Коммит b50f69a477
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 158 добавлений и 62 удалений

Просмотреть файл

@ -1,33 +0,0 @@
# Build and test Infer.NET using .NET Core
resources:
- repo: self
clean: true
variables:
buildConfiguration: 'Release'
steps:
- task: DotNetCoreInstaller@0
inputs:
packageType: 'sdk'
version: '2.1.202'
- script: |
dotnet build --configuration $(buildConfiguration)Core Infer2.sln
displayName: Build Solution
- task: Bash@3
inputs:
filePath: test/netcoretest.sh
workingDirectory: test
arguments: |
Tests/bin/$(buildConfiguration)Core/netcoreapp2.0/Microsoft.ML.Probabilistic.Tests.dll
Learners/LearnersTests/bin/$(buildConfiguration)Core/netcoreapp2.0/Microsoft.ML.Probabilistic.Learners.Tests.dll
TestPublic/bin/$(buildConfiguration)Core/netcoreapp2.0/TestPublic.dll
displayName: Run Tests
continueOnError: true
- task: PublishTestResults@2
inputs:
testRunner: XUnit
testResultsFiles: 'test/*core-tests.xml'

Просмотреть файл

@ -0,0 +1,24 @@
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
# Template for running fast test suite (~30 minutes) on .NET Core platform
parameters:
Configuration: 'ReleaseCore'
steps:
- task: Bash@3
displayName: 'Running tests'
inputs:
filePath: test/netcoretest.sh
workingDirectory: test
arguments: ${{ parameters.Configuration }}
displayName: Run tests
continueOnError: true
- task: PublishTestResults@2
displayName: 'Publishing test results'
inputs:
testRunner: XUnit
testResultsFiles: 'test/netcoretest-result*.xml'

31
build/pr-msbuild.yml Normal file
Просмотреть файл

@ -0,0 +1,31 @@
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
# PR build for Infer.NET using MSBuild
resources:
- repo: self
clean: true
trigger: none # disable CI build
steps:
- task: NuGetToolInstaller@0
inputs:
versionSpec: '4.7.0'
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '**/*.sln'
- task: MSBuild@1
inputs:
solution: '**/*.sln'
clean: true
configuration: 'Release'
- template: vstest-fast.yml
parameters:
Platform: 'x64'

28
build/pr-netcore.yml Normal file
Просмотреть файл

@ -0,0 +1,28 @@
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
# PR build and test Infer.NET using .NET Core
resources:
- repo: self
clean: true
trigger: none # disable CI build
variables:
buildConfiguration: 'Release'
steps:
- task: DotNetCoreInstaller@0
inputs:
packageType: 'sdk'
version: '2.1.202'
- script: |
dotnet build --configuration $(buildConfiguration)Core Infer2.sln
displayName: Build Solution
- template: netcoretest-fast.yml
parameters:
Configuration: '$(buildConfiguration)Core'

52
build/vstest-fast.yml Normal file
Просмотреть файл

@ -0,0 +1,52 @@
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
# Template for running fast test suite (~30 minutes) using vstest in Windows environment (.NET 4.6.1)
parameters:
Platform: 'x64' # or 'x86' or both
steps:
- ${{ if contains(parameters.Platform, 'x64') }}:
# Run fast test suite on x64
- task: VSTest@2
displayName: Unit tests x64 (sequential)
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: test/Tests/bin/*/net461/Microsoft.ML.Probabilistic.Tests.dll
testFiltercriteria: '(Platform!=x86)&(((Category=CsoftModel)|(Category=ModifiesGlobals)|(Category=DistributedTests)|(Category=Performance))&(Category!=OpenBug)&(Category!=BadTest)&(Category!=CompilerOptionsTest))'
runInParallel: false
runSettingsFile: test.runsettings
- task: VSTest@2
displayName: Unit tests x64 (parallel)
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
test/Tests/bin/*/net461/Microsoft.ML.Probabilistic.Tests.dll
test/Learners/LearnersTests/bin/*/net461/Microsoft.ML.Probabilistic.Learners.Tests.dll
test/TestPublic/bin/*/net461/TestPublic.dll
testFiltercriteria: '(Platform!=x86)&(Category!=OpenBug)&(Category!=BadTest)&(Category!=CompilerOptionsTest)&(Category!=CsoftModel)&(Category!=ModifiesGlobals)&(Category!=DistributedTest)&(Category!=Performance)'
runInParallel: true
runSettingsFile: test.runsettings
- ${{ if contains(parameters.Platform, 'x32') }}:
# Run fast test suite on x86
- task: VSTest@2
displayName: Unit tests x86 (sequential)
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: test/Tests/bin/*/net461/Microsoft.ML.Probabilistic.Tests.dll
testFiltercriteria: '(Platform!=x64)&(((Category=CsoftModel)|(Category=ModifiesGlobals)|(Category=DistributedTests)|(Category=Performance))&(Category!=OpenBug)&(Category!=BadTest)&(Category!=CompilerOptionsTest))'
runInParallel: false
runSettingsFile: x86.runsettings
- task: VSTest@2
displayName: Unit tests x86
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
test/Tests/bin/*/net461/Microsoft.ML.Probabilistic.Tests.dll
test/Learners/LearnersTests/bin/*/net461/Microsoft.ML.Probabilistic.Learners.Tests.dll
test/TestPublic/bin/*/net461/TestPublic.dll
testFiltercriteria: '(Platform!=x64)&(Category!=OpenBug)&(Category!=BadTest)&(Category!=CompilerOptionsTest)&(Category!=CsoftModel)&(Category!=ModifiesGlobals)&(Category!=DistributedTest)&(Category!=Performance)'
runInParallel: true
runSettingsFile: x86.runsettings

Просмотреть файл

@ -5,30 +5,18 @@
# See the LICENSE file in the project root for more information.
# Script for testing Infer.Net on net core.
# Input parameters: test dll list.
# It saves results of testing in the `seqcore.xml` and `seqcore.xml` files
# in executing directory.
# Input parameters: build configuration ('Release' by default)
# It saves results of testing in the `netcoretest-result*.xml` files
# in the working directory.
if [ -z $1 ]
configuration=$1
if [ -z $configuration ]
then
echo -e "\033[5;41;1;37mEmpty dll list!\033[0m"
echo -e "Give\033[33;40m -h \033[0mor\033[33;40m --help \033[0margument to get reference"
exit 1
configuration=Release
fi
if [ $1 = "-h" -o $1 = "--help" ]
then
echo "Script for running xUnit tests."
echo -e "Usage: \033[33;40m ./netcoretest.sh <dll list>\033[0m"
echo -e "Script stores info"
echo -e " about parallel test running in \033[35;40mparcore-tests.xml\033[0m"
echo -e " about sequential test running in \033[35;40mseqcore-tests.xml\033[0m"
exit 0
fi
# files to save results
xml_parallel=parcore-tests.xml
xml_sequential=seqcore-tests.xml
compath=/bin/${configuration}/netcoreapp2.0/
dlls="Learners/LearnersTests${compath}Microsoft.ML.Probabilistic.Learners.Tests.dll Tests${compath}Microsoft.ML.Probabilistic.Tests.dll TestPublic${compath}TestPublic.dll"
# path to the xunit runner
runner=~/.nuget/packages/xunit.runner.console/2.3.1/tools/netcoreapp2.0/xunit.console.dll
@ -40,19 +28,25 @@ parallel_filter='-notrait Platform=x86 -notrait Category=OpenBug -notrait Catego
sequential_filter='-notrait Platform=x86 -trait Category=CsoftModel -trait Category=ModifiesGlobals -trait Category=DistributedTests -trait Category=Performance -notrait Category=OpenBug -notrait Category=BadTest -notrait Category=CompilerOptionsTest'
exitcode=0
index=0
echo -e "\033[44;37m=====================PARALLEL TESTS RUNNING============================\033[0m"
dotnet "$runner" $@ $parallel_filter -xml $xml_parallel
if [ 0 -ne $? ]
then
echo -e "\033[5;41;1;37mParallel running failure!\033[0m"
exitcode=1
else
echo -e "\033[32;1mParallel running success!\033[0m"
fi
for assembly in Learners/LearnersTests${compath}Microsoft.ML.Probabilistic.Learners.Tests.dll Tests${compath}Microsoft.ML.Probabilistic.Tests.dll TestPublic${compath}TestPublic.dll
do
# Please note that due to xUnit issue we need to run tests for each assembly separately
dotnet "$runner" "$assembly" $parallel_filter -xml "netcoretest-result${index}.xml"
if [ 0 -ne $? ]
then
echo -e "\033[5;41;1;37mParallel running failure!\033[0m"
exitcode=1
else
echo -e "\033[32;1mParallel running success!\033[0m"
fi
(( index++ ))
done
echo -e "\033[44;37m=====================SEQUENTIAL TESTS RUNNING=========================\033[0m"
dotnet "$runner" $@ $sequential_filter -parallel none -xml $xml_sequential
dotnet "$runner" "Tests${compath}Microsoft.ML.Probabilistic.Tests.dll" $sequential_filter -parallel none -xml "netcoretest-result${index}.xml"
if [ 0 -ne $? ]
then
echo -e "\033[5;41;1;37mSequential running failure!\033[0m"