From c2f9505e3015cfd807ee35134517105152126d0f Mon Sep 17 00:00:00 2001 From: Sunny Titus Date: Thu, 1 Feb 2024 16:08:41 +0100 Subject: [PATCH 1/2] Add pipeline which periodically updates the projects dependencies to the latest version --- .teamcity/settings.kts | 89 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index eaf9add0b..0cdd1f1e9 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -7,6 +7,7 @@ import jetbrains.buildServer.configs.kotlin.buildSteps.script import jetbrains.buildServer.configs.kotlin.projectFeatures.ProjectReportTab import jetbrains.buildServer.configs.kotlin.projectFeatures.projectReportTab import jetbrains.buildServer.configs.kotlin.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.triggers.schedule import jetbrains.buildServer.configs.kotlin.triggers.vcs /* @@ -66,6 +67,7 @@ project { } subProject(Nightly) + subProject(Pixi) } object GitHubIntegrationTemplate : Template({ @@ -422,4 +424,89 @@ object NightlyTests : BuildType({ } } } -}) \ No newline at end of file +}) + +object Pixi : Project({ + name = "Pixi" + + buildType(UpdateDependencies) +}) + +object UpdateDependencies : BuildType({ + name = "Update Dependencies" + + params { + param("GT_USER", "deltares-service-account") + password("env.GH_TOKEN", "credentialsJSON:ced4991a-a11d-463b-b79a-a657eea89523") + } + + vcs { + root(AbsoluteId("iMOD6_IMODPython_ImodPython"), "+:. => imod-python") + + cleanCheckout = true + } + + steps { + powerShell { + name = "Download Github CLI" + id = "Download_Github_CLI" + formatStderrAsError = true + scriptMode = script { + content = """ + Invoke-WebRequest -Uri https://github.com/cli/cli/releases/download/v2.42.1/gh_2.42.1_windows_amd64.zip -OutFile gh.zip + Expand-Archive gh.zip -DestinationPath gh + """.trimIndent() + } + } + powerShell { + name = "Update dependencies" + id = "Update_dependencies" + workingDir = "imod-python" + scriptMode = script { + content = """ + ${'$'}env:Path = '%system.teamcity.build.checkoutDir%\gh\bin;' + ${'$'}env:Path + + echo "Create update branch" + + git remote set-url origin https://%GT_USER%:%env.GH_TOKEN%@github.com/Deltares/imod-python.git + git checkout -b pixi_update_%build.counter% + + echo "Update dependencies" + del pixi.lock + pixi install + + echo "Add any changes" + git add pixi.lock + + if (git status -suno) + { + git commit -m "Update pixi.lock" + git push -u origin pixi_update_%build.counter% + gh pr create --title "[TEAMCITY] Update project dependencies" --body "Teamcity automatically updated the dependencies defined the pixi.toml file. Please verify that all tests succeed before merging" --reviewer JoerivanEngelen,luitjansl + echo "Changes pushed and PR created" + } + else + { + echo "No changes found" + } + """.trimIndent() + } + noProfile = false + } + } + + triggers { + schedule { + schedulingPolicy = weekly { + hour = 15 + } + branchFilter = "+:" + triggerBuild = always() + withPendingChangesOnly = false + } + } + + failureConditions { + errorMessage = true + } +}) From c22132c539afc33dfaf7af78119abbcd173e21b4 Mon Sep 17 00:00:00 2001 From: Sunny Titus Date: Thu, 1 Feb 2024 16:53:07 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=EF=BB=BFApply=20review=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .teamcity/settings.kts | 13 +----- pixi.lock | 98 ++++++++++++++++++++++++++++++++++++------ pixi.toml | 1 + 3 files changed, 88 insertions(+), 24 deletions(-) diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts index 0cdd1f1e9..f4bec0105 100644 --- a/.teamcity/settings.kts +++ b/.teamcity/settings.kts @@ -447,17 +447,6 @@ object UpdateDependencies : BuildType({ } steps { - powerShell { - name = "Download Github CLI" - id = "Download_Github_CLI" - formatStderrAsError = true - scriptMode = script { - content = """ - Invoke-WebRequest -Uri https://github.com/cli/cli/releases/download/v2.42.1/gh_2.42.1_windows_amd64.zip -OutFile gh.zip - Expand-Archive gh.zip -DestinationPath gh - """.trimIndent() - } - } powerShell { name = "Update dependencies" id = "Update_dependencies" @@ -482,7 +471,7 @@ object UpdateDependencies : BuildType({ { git commit -m "Update pixi.lock" git push -u origin pixi_update_%build.counter% - gh pr create --title "[TEAMCITY] Update project dependencies" --body "Teamcity automatically updated the dependencies defined the pixi.toml file. Please verify that all tests succeed before merging" --reviewer JoerivanEngelen,luitjansl + pixi run gh pr create --title "[TEAMCITY] Update project dependencies" --body "Teamcity automatically updated the dependencies defined the pixi.toml file. Please verify that all tests succeed before merging" --reviewer JoerivanEngelen,luitjansl echo "Changes pushed and PR created" } else diff --git a/pixi.lock b/pixi.lock index 2f63a8bfc..a03af4850 100644 --- a/pixi.lock +++ b/pixi.lock @@ -9177,6 +9177,80 @@ package: license_family: BSD size: 86690 timestamp: 1599590990520 +- platform: linux-64 + name: gh + version: 2.43.1 + category: main + manager: conda + dependencies: [] + url: https://conda.anaconda.org/conda-forge/linux-64/gh-2.43.1-ha8f183a_0.conda + hash: + md5: adaa9131473d962cc1521d2169d59c60 + sha256: f7a7918096362a9f197c1b043a6e1d524fc8e077be6797972be910b4482c7693 + build: ha8f183a_0 + arch: x86_64 + subdir: linux-64 + build_number: 0 + license: Apache-2.0 + license_family: APACHE + size: 16858494 + timestamp: 1706752640334 +- platform: osx-64 + name: gh + version: 2.43.1 + category: main + manager: conda + dependencies: [] + url: https://conda.anaconda.org/conda-forge/osx-64/gh-2.43.1-h990441c_0.conda + hash: + md5: 620d1c108bc7f37c22102d181816eb19 + sha256: 8087704d81711ea3e9254d84cab3cf560ac2e79a668e2e2f9d875f1053707e70 + build: h990441c_0 + arch: x86_64 + subdir: osx-64 + build_number: 0 + constrains: + - __osx>=10.12 + license: Apache-2.0 + license_family: APACHE + size: 16650708 + timestamp: 1706752915101 +- platform: osx-arm64 + name: gh + version: 2.43.1 + category: main + manager: conda + dependencies: [] + url: https://conda.anaconda.org/conda-forge/osx-arm64/gh-2.43.1-h75b854d_0.conda + hash: + md5: 2fafc8df33219ebcc5a3eb69afef5f12 + sha256: 34783d293ab1db89469faa156e0c8e28fd213fa1d2414fdaaa008f7e4e31b45e + build: h75b854d_0 + arch: aarch64 + subdir: osx-arm64 + build_number: 0 + license: Apache-2.0 + license_family: APACHE + size: 16033884 + timestamp: 1706752975233 +- platform: win-64 + name: gh + version: 2.43.1 + category: main + manager: conda + dependencies: [] + url: https://conda.anaconda.org/conda-forge/win-64/gh-2.43.1-hd02998f_0.conda + hash: + md5: 229cbf4b096a468d30085cb9eead7a20 + sha256: 210b5dc8dcf91a9d528922b0ed9697a75a332f6c501dc95b806ee0f1ee6eda10 + build: hd02998f_0 + arch: x86_64 + subdir: win-64 + build_number: 0 + license: Apache-2.0 + license_family: APACHE + size: 16789533 + timestamp: 1706753295429 - platform: linux-64 name: giflib version: 5.2.1 @@ -33590,40 +33664,40 @@ package: timestamp: 1703250978164 - platform: osx-64 name: tzcode - version: 2023d + version: 2024a category: main manager: conda dependencies: [] - url: https://conda.anaconda.org/conda-forge/osx-64/tzcode-2023d-h10d778d_0.conda + url: https://conda.anaconda.org/conda-forge/osx-64/tzcode-2024a-h10d778d_0.conda hash: - md5: 6ae344465457da354af4d35b567fb141 - sha256: e312a782d139884c6399c45c3218eda11ac17d12dc0d0711623d07c7751e97ab + md5: 8d50ba6668dbd193cd42ccd9099fa2ae + sha256: e3ee34b2711500f3b1d38309d47cfd7e4d05c0144f0b2b2bdfbc271a28cfdd76 build: h10d778d_0 arch: x86_64 subdir: osx-64 build_number: 0 license: BSD-3-Clause license_family: BSD - size: 63744 - timestamp: 1703251160420 + size: 63341 + timestamp: 1706869081062 - platform: osx-arm64 name: tzcode - version: 2023d + version: 2024a category: main manager: conda dependencies: [] - url: https://conda.anaconda.org/conda-forge/osx-arm64/tzcode-2023d-h93a5062_0.conda + url: https://conda.anaconda.org/conda-forge/osx-arm64/tzcode-2024a-h93a5062_0.conda hash: - md5: 8f6c1eef62c660bfb43897fe14b2ca95 - sha256: a4bed39a41b26d5f8134fd0cb0df15bc0b9e645e3ee6f88ee81c8d24651eb8cd + md5: 33ebc94eb6420500a4aeb0fc45112bba + sha256: 70bce0410d77b6ba3c32079aa87a98877ea970d8e96f2e4503e9b81198ece1f4 build: h93a5062_0 arch: aarch64 subdir: osx-arm64 build_number: 0 license: BSD-3-Clause license_family: BSD - size: 63558 - timestamp: 1703251392865 + size: 63845 + timestamp: 1706869030258 - platform: linux-64 name: tzdata version: 2023d diff --git a/pixi.toml b/pixi.toml index 105fdb608..e0347aab5 100644 --- a/pixi.toml +++ b/pixi.toml @@ -60,6 +60,7 @@ dask = "<2024.1.0" # Newer version incompatible with rasterio fastcore = "*" flopy = "*" geopandas = "*" +gh = "*" graphviz = "*" hypothesis = "*" jinja2 = "*"