Skip to content
This repository was archived by the owner on Apr 6, 2024. It is now read-only.

Commit 15d9ea0

Browse files
committed
Run integration tests in separate Azure Pipeline jobs
1 parent 70038d3 commit 15d9ea0

File tree

9 files changed

+67
-52
lines changed

9 files changed

+67
-52
lines changed

azure-pipelines.yml

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,34 @@ pr:
1010
- hotfix/*
1111

1212
jobs:
13-
- job: Windows
13+
# Build
14+
- job: Build
1415
pool:
1516
vmImage: 'windows-2022'
1617
steps:
17-
- powershell: |
18-
$ENV:CAKE_SKIP_GITVERSION=([string]::IsNullOrEmpty($ENV:SYSTEM_PULLREQUEST_PULLREQUESTID) -eq $False).ToString()
19-
.\build.ps1 --target=Buildserver
20-
exit $LASTEXITCODE
21-
displayName: 'Cake Build'
22-
- job: macOS
18+
- powershell: ./build.ps1
19+
displayName: 'Build'
20+
- publish: $(Build.SourcesDirectory)/BuildArtifacts/Packages/NuGet
21+
artifact: NuGet Package
22+
displayName: 'Publish NuGet package as build artifact'
23+
# Integration Tests Windows Server 2019 (.NET Core tool)
24+
- job: Test_Windows_2019_DotNetCoreTool
25+
displayName: Integration Tests Windows Server 2019 (.NET Core tool)
26+
dependsOn: Build
2327
pool:
24-
vmImage: 'macOS-11'
28+
vmImage: 'windows-2019'
2529
steps:
26-
- bash: |
27-
./build.sh --target=Buildserver
28-
displayName: 'Cake Build'
29-
- job: Ubuntu
30-
pool:
31-
vmImage: 'ubuntu-18.04'
32-
steps:
33-
- bash: |
34-
./build.sh --target=Buildserver
35-
displayName: 'Cake Build'
30+
- download: current
31+
artifact: NuGet Package
32+
displayName: 'Download build artifact'
33+
- task: CopyFiles@2
34+
inputs:
35+
sourceFolder: $(Pipeline.Workspace)/NuGet Package
36+
targetFolder: $(Build.SourcesDirectory)/BuildArtifacts/Packages/NuGet
37+
displayName: 'Copy build artifact for test run'
38+
- powershell: ./build.ps1
39+
workingDirectory: ./tests/script-runner/
40+
displayName: 'Run integration tests'
41+
- publish: $(Build.SourcesDirectory)/docs/templates
42+
artifact: Integration Tests Windows Server 2019 (.NET Core tool)
43+
displayName: 'Publish generated reports as build artifact'

recipe.cake

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ BuildParameters.SetParameters(
1616
appVeyorAccountName: "cakecontrib",
1717
shouldRunCoveralls: false, // Disabled because it's currently failing
1818
shouldGenerateDocumentation: false,
19-
shouldRunIntegrationTests: true,
2019
integrationTestScriptPath: "./tests/integration/tests.cake");
2120

2221
BuildParameters.PrintParameters(Context);
@@ -27,35 +26,6 @@ ToolSettings.SetToolSettings(
2726
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
2827
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
2928

30-
//*************************************************************************************************
31-
// Extensions
32-
//*************************************************************************************************
33-
34-
Task("Prepare-Integration-Tests")
35-
.IsDependentOn("Create-NuGet-Packages")
36-
.Does<BuildVersion>((context, buildVersion) =>
37-
{
38-
// Clean addin directory
39-
var addinDir = MakeAbsolute(Directory("./tools/Addins/" + BuildParameters.RepositoryName));
40-
if (DirectoryExists(addinDir))
41-
{
42-
DeleteDirectory(addinDir, new DeleteDirectorySettings {
43-
Recursive = true,
44-
Force = true
45-
});
46-
}
47-
48-
// Unzip package from current build into addin directory
49-
var packagePath =
50-
BuildParameters.Paths.Directories.NuGetPackages.CombineWithFilePath("Cake.Issues.GitRepository." + buildVersion.SemVersion + ".nupkg");
51-
Unzip(packagePath, addinDir);
52-
});
53-
54-
Task("Buildserver")
55-
.IsDependentOn("Run-Integration-Tests");
56-
57-
BuildParameters.Tasks.IntegrationTestTask.IsDependentOn("Prepare-Integration-Tests");
58-
5929
//*************************************************************************************************
6030
// Execution
6131
//*************************************************************************************************

tests/script-runner/build.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$SCRIPT_NAME = "tests.cake"
4+
5+
Write-Host "Restoring .NET Core tools"
6+
dotnet tool restore
7+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
8+
9+
Write-Host "Bootstrapping Cake"
10+
dotnet cake $SCRIPT_NAME --bootstrap
11+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
12+
13+
Write-Host "Running Build"
14+
dotnet cake $SCRIPT_NAME @args
15+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

tests/script-runner/build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
SCRIPT_NAME="tests.cake"
3+
4+
echo "Restoring .NET Core tools"
5+
dotnet tool restore
6+
7+
echo "Bootstrapping Cake"
8+
dotnet cake $SCRIPT_NAME --bootstrap
9+
10+
echo "Running Build"
11+
dotnet cake $SCRIPT_NAME "$@"

tests/script-runner/nuget.config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="Integration" value="../../BuildArtifacts/Packages/NuGet" />
6+
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
7+
</packageSources>
8+
<disabledPackageSources>
9+
<clear />
10+
</disabledPackageSources>
11+
</configuration>
File renamed without changes.

tests/integration/tests.cake renamed to tests/script-runner/tests.cake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#addin nuget:?package=Cake.Issues&prerelease
2-
#addin nuget:?package=Cake.Issues.Reporting&prerelease
3-
#addin nuget:?package=Cake.Issues.Reporting.Generic&prerelease
4-
#reference "../../tools/Addins/Cake.Issues.GitRepository/lib/netstandard2.0/Cake.Issues.GitRepository.dll"
1+
#addin Cake.Issues&prerelease
2+
#addin Cake.Issues.Reporting&prerelease
3+
#addin Cake.Issues.Reporting.Generic&prerelease
4+
#addin Cake.Issues.GitRepository&prerelease
55

66
//////////////////////////////////////////////////
77
// ARGUMENTS

0 commit comments

Comments
 (0)