Ribasim
Ribasim copied to clipboard
Ignore `test_version` on version bump PR
When following the release process and creating #1654, it is impossible to bump the version numbers before we tag the new version and have the test_version in test_cli.py pass.
build.tests.test_cli.test_version
16:54:35 AssertionError: assert '2024.10.0' in 'ribasim 2024.9.0-57-g2e9e1db-dirty\n'
+ where '2024.10.0' = ribasim.__version__
+ and 'ribasim 2024.9.0-57-g2e9e1db-dirty\n' = CompletedProcess(args=[PosixPath('/opt/teamcityagent/work/ecd2b8f9b25b1609/ribasim/build/ribasim/ribasim'), '--version'], returncode=0, stdout='ribasim 2024.9.0-57-g2e9e1db-dirty\n', stderr='').stdout
16:54:35 def test_version():
result = subprocess.run(
[executable, "--version"], check=True, capture_output=True, text=True
)
> assert ribasim.__version__ in result.stdout
E AssertionError: assert '2024.10.0' in 'ribasim 2024.9.0-57-g2e9e1db-dirty\n'
E + where '2024.10.0' = ribasim.__version__
E + and 'ribasim 2024.9.0-57-g2e9e1db-dirty\n' = CompletedProcess(args=[PosixPath('/opt/teamcityagent/work/ecd2b8f9b25b1609/ribasim/build/ribasim/ribasim'), '--version'], returncode=0, stdout='ribasim 2024.9.0-57-g2e9e1db-dirty\n', stderr='').stdout
build/tests/test_cli.py:33: AssertionError
We can ignore this error since the result of ribasim --version is picked up from the git tag. But it would be nice not to have failing tests on the PRs where it is essential that everything is ok.
Check if we can use environment variables to skip this test on a release branch.
Even though the binary builds pass, the test binary workflows are now configured such that they have to pass before the "Make GitHub Release" can start. I tried to adjust this in the TeamCity UI, which gave these two patches: 2750dca0717622729fab3bb179a615ed3655c333 and 328efecd22e8d12ac450eebefe15d90903cc1906
These patches didn't seem to help so they should be removed again.
The version that the rust wrapper gets seems to be wrong when building on tags. This is built on the v2024.11.0 tag:
❯ ribasim --version
ribasim 2024.10.0-128-ge09eeb5
C:\bin\ribasim
❯ ribasim d:\repo\ribasim\Ribasim\generated_testmodels\bucket\ribasim.toml
┌ Warning: The Ribasim version in the TOML config file does not match the used Ribasim CLI version.
│ config.ribasim_version = "something-else"
│ cli.ribasim_version = "2024.11.0"
So the cli.ribasim_version is ok but --version isn't. You can see e09eeb5 in there. If you click it you can see that's the tag.
Man what a rabbithole. In your bump PR, you also update the Cargo.toml. So maybe make sure that in add_metadata, we don't allow to downgrade the version of the Cargo.toml again (which is what happens above I think).