Skip to content

Commit

Permalink
Merge pull request #1041 from Windos/GH-3342/separate-teamcity-builds
Browse files Browse the repository at this point in the history
 (ENGTASKS-3098) Create TC build for Unit, Integration, and QA
  • Loading branch information
gep13 authored Apr 3, 2024
2 parents 1058d7f + 037cb65 commit 4b532f4
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }}

- name: Build project
shell: powershell
run: |
./build.ps1 --target=CI
Expand Down
152 changes: 142 additions & 10 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.powerShell
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.pullRequests
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.ScheduleTrigger
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.schedule
import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot

project {
buildType(ChocolateyGUI)
buildType(ChocolateyGUISchd)
buildType(ChocolateyGUIQA)
}

object ChocolateyGUI : BuildType({
id = AbsoluteId("ChocolateyGUI")
name = "Build"
name = "Chocolatey GUI (Built with Unit Tests)"

artifactRules = """
code_drop/MsBuild.log
Expand Down Expand Up @@ -62,8 +65,7 @@ object ChocolateyGUI : BuildType({
script {
name = "Call Cake"
scriptContent = """
IF "%teamcity.build.triggeredBy%" == "Schedule Trigger" (SET TestType=all) ELSE (SET TestType=unit)
call build.official.bat --verbosity=diagnostic --target=CI --testExecutionType=%%TestType%% --shouldRunOpenCover=false
build.official.bat --verbosity=diagnostic --target=CI --testExecutionType=unit --shouldRunOpenCover=false
""".trimIndent()
}
}
Expand All @@ -72,6 +74,77 @@ object ChocolateyGUI : BuildType({
vcs {
branchFilter = ""
}
}

features {
pullRequests {
provider = github {
authType = token {
token = "%system.GitHubPAT%"
}
}
}
}
})

object ChocolateyGUISchd : BuildType({
id = AbsoluteId("ChocolateyGUISchd")
name = "Chocolatey GUI (Scheduled Integration Testing)"

artifactRules = """
code_drop/MsBuild.log
code_drop/MSBuild.msi.log
code_drop/ChocolateyGUI.msi
code_drop/TestResults/issues-report.html
code_drop/Packages/**/*.nupkg
""".trimIndent()

params {
param("env.vcsroot.branch", "%vcsroot.branch%")
param("env.Git_Branch", "%teamcity.build.vcs.branch.ChocolateyGUI_ChocolateyGuiVcsRoot%")
param("teamcity.git.fetchAllHeads", "true")
password("env.TRANSIFEX_API_TOKEN", "credentialsJSON:c81283e6-cf59-5c9e-9766-6f465018a295", display = ParameterDisplay.HIDDEN, readOnly = true)
password("env.GITHUB_PAT", "%system.GitHubPAT%", display = ParameterDisplay.HIDDEN, readOnly = true)
}

vcs {
root(DslContext.settingsRoot)

branchFilter = """
+:*
""".trimIndent()
}

steps {
powerShell {
name = "Prerequisites"
scriptMode = script {
content = """
# Install Chocolatey Requirements
if ((Get-WindowsFeature -Name NET-Framework-Features).InstallState -ne 'Installed') {
Install-WindowsFeature -Name NET-Framework-Features
}
choco install windows-sdk-7.1 netfx-4.0.3-devpack visualstudio2019buildtools netfx-4.8-devpack --confirm --no-progress
exit ${'$'}LastExitCode
""".trimIndent()
}
}

step {
name = "Include Signing Keys"
type = "PrepareSigningEnvironment"
}

script {
name = "Call Cake"
scriptContent = """
build.official.bat --verbosity=diagnostic --target=CI --testExecutionType=all --shouldRunOpenCover=false --shouldRunAnalyze=false --shouldRunIlMerge=false --shouldObfuscateOutputAssemblies=false --shouldRunChocolatey=false --shouldRunNuGet=false
""".trimIndent()
}
}

triggers {
schedule {
schedulingPolicy = daily {
hour = 2
Expand All @@ -81,17 +154,76 @@ object ChocolateyGUI : BuildType({
+:<default>
""".trimIndent()
triggerBuild = always()
withPendingChangesOnly = false
withPendingChangesOnly = false
}
}
})

features {
pullRequests {
provider = github {
authType = token {
token = "%system.GitHubPAT%"
}
object ChocolateyGUIQA : BuildType({
id = AbsoluteId("ChocolateyGUIQA")
name = "Chocolatey GUI (SonarQube)"

artifactRules = """
""".trimIndent()

params {
param("env.vcsroot.branch", "%vcsroot.branch%")
param("env.Git_Branch", "%teamcity.build.vcs.branch.ChocolateyGUI_ChocolateyGuiVcsRoot%")
param("env.SONARQUBE_ID", "chocolateygui")
param("teamcity.git.fetchAllHeads", "true")
password("env.TRANSIFEX_API_TOKEN", "credentialsJSON:c81283e6-cf59-5c9e-9766-6f465018a295", display = ParameterDisplay.HIDDEN, readOnly = true)
password("env.GITHUB_PAT", "%system.GitHubPAT%", display = ParameterDisplay.HIDDEN, readOnly = true)
}

vcs {
root(DslContext.settingsRoot)

branchFilter = """
+:*
""".trimIndent()
}

steps {
powerShell {
name = "Prerequisites"
scriptMode = script {
content = """
# Install Chocolatey Requirements
if ((Get-WindowsFeature -Name NET-Framework-Features).InstallState -ne 'Installed') {
Install-WindowsFeature -Name NET-Framework-Features
}
choco install windows-sdk-7.1 netfx-4.0.3-devpack visualstudio2019buildtools netfx-4.8-devpack --confirm --no-progress
exit ${'$'}LastExitCode
""".trimIndent()
}
}

step {
name = "Include Signing Keys"
type = "PrepareSigningEnvironment"
}

script {
name = "Call Cake"
scriptContent = """
build.official.bat --verbosity=diagnostic --target=CI --testExecutionType=none --shouldRunAnalyze=false --shouldRunIlMerge=false --shouldObfuscateOutputAssemblies=false --shouldRunChocolatey=false --shouldRunNuGet=false --shouldRunSonarQube=true --shouldRunDependencyCheck=true
""".trimIndent()
}
}

triggers {
schedule {
schedulingPolicy = weekly {
dayOfWeek = ScheduleTrigger.DAY.Saturday
hour = 2
minute = 45
}
branchFilter = """
+:<default>
""".trimIndent()
triggerBuild = always()
withPendingChangesOnly = false
}
}
})
4 changes: 2 additions & 2 deletions recipe.cake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#load nuget:?package=Chocolatey.Cake.Recipe&version=0.25.0
#load nuget:?package=Chocolatey.Cake.Recipe&version=0.26.3

///////////////////////////////////////////////////////////////////////////////
// MODULES
Expand All @@ -13,7 +13,7 @@
if (BuildSystem.IsLocalBuild)
{
Environment.SetVariableNames(
gitHubTokenVariable: "CHOCOLATEYGUI_GITHUB_PAT",
gitReleaseManagerTokenVariable: "CHOCOLATEYGUI_GITHUB_PAT",
transifexApiTokenVariable: "CHOCOLATEYGUI_TRANSIFEX_API_TOKEN"
);
}
Expand Down

0 comments on commit 4b532f4

Please sign in to comment.