Skip to content

Commit 23fd931

Browse files
committed
Add pixi update build to Teamcity (#418)
1 parent 2ced48a commit 23fd931

File tree

5 files changed

+856
-453
lines changed

5 files changed

+856
-453
lines changed

.github/workflows/pixi_auto_update.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.teamcity/Pixi/PixiProject.kt

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package Pixi
2+
3+
import _Self.vcsRoots.ImodCoupler
4+
import jetbrains.buildServer.configs.kotlin.BuildType
5+
import jetbrains.buildServer.configs.kotlin.Project
6+
import jetbrains.buildServer.configs.kotlin.buildSteps.powerShell
7+
import jetbrains.buildServer.configs.kotlin.triggers.schedule
8+
9+
object PixiProject : Project({
10+
name = "Pixi"
11+
12+
buildType(UpdateDependencies)
13+
})
14+
15+
object UpdateDependencies : BuildType({
16+
name = "Update Dependencies"
17+
18+
params {
19+
param("GH_USER", "deltares-service-account")
20+
text("env.GH_TOKEN", "%github_deltares-service-account_access_token%")
21+
}
22+
23+
vcs {
24+
root(ImodCoupler, ". => imod_coupler")
25+
cleanCheckout = true
26+
}
27+
28+
steps {
29+
powerShell {
30+
name = "Update dependencies"
31+
id = "Update_dependencies"
32+
workingDir = "imod_coupler"
33+
scriptMode = script {
34+
content = """
35+
echo "Create update branch"
36+
git remote set-url origin https://%GH_USER%:%env.GH_TOKEN%@github.com/Deltares/imod_coupler.git
37+
git checkout -b pixi_update_%build.counter%
38+
39+
echo "Update dependencies"
40+
pixi run -e pixi-update update
41+
42+
echo "Add any changes"
43+
git add pixi.lock
44+
45+
if (git status -suno pixi.lock)
46+
{
47+
echo "Setup username and email"
48+
git config --global user.name "Teamcity"
49+
git config --global user.email "teamcity@deltares.nl"
50+
51+
echo "Commit changes"
52+
git commit -m "Update pixi.lock"
53+
54+
echo "Push changes"
55+
git push -u origin pixi_update_%build.counter%
56+
57+
echo "Format PR body"
58+
${'$'}diff = Get-Content -Path diff.md
59+
Set-Content body.md 'Teamcity automatically updated the dependencies defined the pixi.toml file. Please verify that all tests succeed before merging'
60+
Add-Content -Path body.md -Value "`r`n"
61+
Add-Content -Path body.md -Value ${'$'}diff
62+
63+
echo "Create PR"
64+
pixi run --environment default gh pr create --title "[TEAMCITY] Update project dependencies" --body-file body.md --reviewer rleander73,HendrikKok,Manangka
65+
echo "Changes pushed and PR created"
66+
}
67+
else
68+
{
69+
echo "No changes found"
70+
}
71+
""".trimIndent()
72+
}
73+
noProfile = false
74+
}
75+
}
76+
77+
triggers {
78+
schedule {
79+
schedulingPolicy = weekly {
80+
hour = 14
81+
}
82+
branchFilter = "+:<default>"
83+
triggerBuild = always()
84+
withPendingChangesOnly = false
85+
}
86+
}
87+
88+
failureConditions {
89+
errorMessage = true
90+
}
91+
})

.teamcity/_Self/Project.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package _Self
22

3+
import Pixi.PixiProject
34
import Templates.GitHubIntegrationTemplate
45
import _Self.buildTypes.TestPrimodWin64
56
import _Self.buildTypes.*
@@ -26,6 +27,7 @@ object Project : Project({
2627
buildType(Main)
2728

2829
subProject(IMODCollector.Project)
30+
subProject(PixiProject)
2931
})
3032

3133
object Main : BuildType({

0 commit comments

Comments
 (0)