forked from 51Degrees/common-ci
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnightly-pull-request.build-and-test.ps1
66 lines (56 loc) · 2.14 KB
/
nightly-pull-request.build-and-test.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
param (
[Parameter(Mandatory=$true)]
[string]$RepoName,
[Parameter(Mandatory=$true)]
[string]$OrgName,
[string]$Branch = "main",
[Parameter(Mandatory=$true)]
[string]$GitHubToken,
[string]$GitHubUser,
[string]$GitHubEmail,
[Parameter(Mandatory=$true)]
[string]$GitHubOutput,
[Parameter(Mandatory=$true)]
[string]$PullRequestId,
[Parameter(Mandatory=$true)]
[hashtable]$Options,
[bool]$DryRun
)
$ErrorActionPreference = "Stop"
$Options += $PSBoundParameters # Add RepoName, DryRun etc.
if ($Options.Keys) {
$Options += $Options.Keys # Expand keys into options
}
Write-Output "::group::Configure Git"
./steps/configure-git.ps1 -GitHubToken $GitHubToken -GitHubUser $GitHubUser -GitHubEmail $GitHubEmail
Write-Output "::endgroup::"
Write-Output "::group::Clone $RepoName"
./steps/clone-repo.ps1 -RepoName $RepoName -OrgName $OrgName -Branch $Branch
Write-Output "::endgroup::"
Write-Output "::group::Checkout PR"
./steps/checkout-pr.ps1 -RepoName $RepoName -Branch $Branch -PullRequestId $PullRequestId -SetVariable PullRequestSha
Write-Output "pr-sha=$PullRequestSha" | Out-File $GitHubOutput -Append
Write-Output "::endgroup::"
Write-Output "::group::Fetch Assets"
./steps/run-script.ps1 ./$RepoName/ci/fetch-assets.ps1 $Options
Write-Output "::endgroup::"
Write-Output "::group::Setup Environment"
./steps/run-script.ps1 ./$RepoName/ci/setup-environment.ps1 $Options
Write-Output "::endgroup::"
Write-Output "::group::Build Project"
./steps/run-script.ps1 ./$RepoName/ci/build-project.ps1 $Options
Write-Output "::endgroup::"
Write-Output "::group::Run Unit Tests"
./steps/run-script.ps1 ./$RepoName/ci/run-unit-tests.ps1 $Options
Write-Output "::endgroup::"
Write-Output "::group::Run Integration Tests"
./steps/run-script.ps1 ./$RepoName/ci/run-integration-tests.ps1 $Options
Write-Output "::endgroup::"
if ($Options.RunPerformance -eq $True) {
Write-Output "::group::Run Performance Tests"
./steps/run-script.ps1 ./$RepoName/ci/run-performance-tests.ps1 $Options
Write-Output "::endgroup::"
}
else {
Write-Output "Skipping performance tests as they are not configured for '$($Options.Name)'"
}