Skip to content

Commit bf0ae29

Browse files
authored
Issue #996 Add Weekly CI job that runs the acceptance tests (#1673)
Fixes #988 # Description This commit adds a weekly job that runs the acceptance tests. A main "Test" job is created that is triggered every sunday. This job triggers its dependencies. For now that is only the "acceptance tests" job. However any future weekly jobs can be attached to it. I would also make sense to eventually put the "Pixi update" under this job as that is a weekly job as well # Checklist <!--- Before requesting review, please go through this checklist: --> - [x] Links to correct issue - [ ] Update changelog, if changes affect users - [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737`` - [ ] Unit tests were added - [ ] **If feature added**: Added/extended example - [ ] **If feature added**: Added feature to API documentation - [ ] **If pixi.lock was changed**: Ran `pixi run generate-sbom` and committed changes
1 parent e214c7a commit bf0ae29

File tree

4 files changed

+135
-2
lines changed

4 files changed

+135
-2
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package Templates
2+
3+
import jetbrains.buildServer.configs.kotlin.DslContext
4+
import jetbrains.buildServer.configs.kotlin.Template
5+
import jetbrains.buildServer.configs.kotlin.buildSteps.ScriptBuildStep
6+
import jetbrains.buildServer.configs.kotlin.buildSteps.script
7+
8+
object AcceptanceTestsTemplate : Template({
9+
name = "AcceptanceTestsTemplate"
10+
11+
allowExternalStatus = true
12+
13+
vcs {
14+
root(DslContext.settingsRoot, "+:. => imod-python")
15+
cleanCheckout = true
16+
}
17+
18+
19+
params {
20+
param("env.access_key", "%credentialsJSON:2978988a-493b-44ed-9fcb-6cd6d2c2c673%")
21+
param("env.secret_access_key", "%credentialsJSON:409a55c0-b2e7-438c-98dd-f0404b83cabb%")
22+
}
23+
24+
25+
steps {
26+
script {
27+
name = "Run acceptance tests"
28+
id = "Run_acceptance_tests"
29+
workingDir = "imod-python"
30+
scriptContent = """
31+
SET PATH=%%PATH%%;%system.teamcity.build.checkoutDir%\modflow6
32+
33+
pixi run --environment user-acceptance --frozen dvc remote modify --local minio access_key_id %env.access_key%
34+
pixi run --environment user-acceptance --frozen dvc remote modify --local minio secret_access_key %env.secret_access_key%
35+
36+
pixi run --environment user-acceptance --frozen user_acceptance
37+
""".trimIndent()
38+
formatStderrAsError = true
39+
dockerImage = "%DockerContainer%:%DockerVersion%"
40+
dockerImagePlatform = ScriptBuildStep.ImagePlatform.Windows
41+
dockerRunParameters = """--cpus=8 --memory=32g"""
42+
dockerPull = false
43+
}
44+
}
45+
46+
})

.teamcity/Weekly/WeeklyProject.kt

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package Weekly
2+
3+
import Templates.*
4+
import jetbrains.buildServer.configs.kotlin.AbsoluteId
5+
import jetbrains.buildServer.configs.kotlin.BuildType
6+
import jetbrains.buildServer.configs.kotlin.DslContext
7+
import jetbrains.buildServer.configs.kotlin.FailureAction
8+
import jetbrains.buildServer.configs.kotlin.Project
9+
import jetbrains.buildServer.configs.kotlin.buildFeatures.notifications
10+
import jetbrains.buildServer.configs.kotlin.triggers.ScheduleTrigger
11+
import jetbrains.buildServer.configs.kotlin.triggers.schedule
12+
13+
object WeeklyProject : Project({
14+
name = "Weekly"
15+
16+
buildType(WeeklyTests)
17+
18+
})
19+
20+
object AcceptanceTests : BuildType({
21+
name = "AcceptanceTests"
22+
23+
templates(AcceptanceTestsTemplate)
24+
25+
dependencies {
26+
dependency(AbsoluteId("iMOD6_Modflow6buildWin64")) {
27+
snapshot {
28+
onDependencyFailure = FailureAction.FAIL_TO_START
29+
}
30+
31+
artifacts {
32+
artifactRules = "+:MODFLOW6.zip!** => modflow6"
33+
}
34+
}
35+
}
36+
})
37+
38+
object WeeklyTests : BuildType({
39+
name = "Tests"
40+
41+
allowExternalStatus = true
42+
type = Type.COMPOSITE
43+
44+
vcs {
45+
root(DslContext.settingsRoot)
46+
47+
branchFilter = """
48+
+:*
49+
-:release_imod56
50+
""".trimIndent()
51+
showDependenciesChanges = true
52+
}
53+
54+
55+
triggers {
56+
schedule {
57+
schedulingPolicy = weekly {
58+
dayOfWeek = ScheduleTrigger.DAY.Sunday
59+
hour = 16
60+
minute = 0
61+
}
62+
branchFilter = "+:<default>"
63+
triggerBuild = always()
64+
withPendingChangesOnly = false
65+
}
66+
}
67+
68+
failureConditions {
69+
errorMessage = true
70+
}
71+
72+
features {
73+
notifications {
74+
notifierSettings = emailNotifier {
75+
email = """
76+
77+
78+
79+
""".trimIndent()
80+
}
81+
buildFailedToStart = true
82+
buildFailed = true
83+
}
84+
}
85+
})

.teamcity/_Self/MainProject.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Deploy.DeployProject
44
import Nightly.NightlyProject
55
import Pixi.PixiProject
66
import Templates.*
7+
import Weekly.WeeklyProject
78
import jetbrains.buildServer.configs.kotlin.*
89
import jetbrains.buildServer.configs.kotlin.buildFeatures.PullRequests
910
import jetbrains.buildServer.configs.kotlin.buildFeatures.pullRequests
@@ -63,6 +64,7 @@ object MainProject : Project({
6364

6465
subProject(DeployProject)
6566
subProject(NightlyProject)
67+
subProject(WeeklyProject)
6668
subProject(PixiProject)
6769
})
6870

pixi.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ dvc-s3 = "*"
177177

178178
[feature.user-acceptance.tasks]
179179
pull_data = "dvc pull --remote minio"
180-
fetch_lhm = {cmd = "7z x LHM_transient.zip -oLHM_transient -y", depends-on = ["pull_data"], cwd = "imod/tests/user_acceptance_data"}
180+
fetch_lhm = {cmd = "7z x LHM_transient.zip -o. -y", depends-on = ["pull_data"], cwd = "imod/tests/user_acceptance_data"}
181181
user_acceptance = { cmd = [
182182
"pytest",
183183
"-m", "user_acceptance",
184184
"--cache-clear",
185185
"--verbose",
186186
"--junitxml=user_acceptance_report.xml",
187-
], depends-on = ["install"], cwd = "imod/tests", env = { USER_ACCEPTANCE_DIR = "user_acceptance_data"} }
187+
], depends-on = ["install", "fetch_lhm"], cwd = "imod/tests", env = { USER_ACCEPTANCE_DIR = "user_acceptance_data"} }
188188
run_imod5 = {cmd = ["prepare_mf6_transient_imod5.bat"], cwd = "imod/tests/user_acceptance_data/LHM_transient/scripts_imod-5"}
189189
qgis_export ={ cmd = [
190190
"pytest", "-s",

0 commit comments

Comments
 (0)