Repository navigation
Support release-candidate builds as a first-class mode #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1dd86ba
Support explicit release candidate versions
msarahan 4ad4c79
fix: preserve candidate source version across redirection
msarahan ea3aca9
Make release candidate a first-class build type
msarahan 28965aa
Support component candidate versions
msarahan 79ac786
Address release candidate version review
msarahan 96bcbfa
Add comment about BASH_REMATCH
msarahan 477fbf0
Limit version regex to YY.MM format
msarahan 111fbca
Support UCXX candidate version formats
msarahan 754bd2f
Merge branch 'main' into codex/release-candidate-version
msarahan 24c8485
Document release candidate version inputs
msarahan 3901b0e
Derive release candidate version from source
msarahan 08318d6
update error message when VERSION file missing
msarahan f6051cb
Update release candidate error assertion
msarahan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import os | ||
| import subprocess | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| TOOLS_DIRECTORY = Path(__file__).resolve().parents[1] / "tools" | ||
|
|
||
|
|
||
| def _generate_version( | ||
| tmp_path: Path, | ||
| ) -> subprocess.CompletedProcess[str]: | ||
| environment = os.environ.copy() | ||
| environment["RAPIDS_BUILD_TYPE"] = "release-candidate" | ||
| return subprocess.run( | ||
| [TOOLS_DIRECTORY / "rapids-generate-version"], | ||
| cwd=tmp_path, | ||
| env=environment, | ||
| text=True, | ||
| capture_output=True, | ||
| check=False, | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("source_version", ["26.10.00", "0.3.0", "0.52", "00.52", "00.52.01"]) | ||
| def test_release_candidate_version_returns_source_version(tmp_path, source_version): | ||
| tmp_path.joinpath("VERSION").write_text(f"{source_version}\n") | ||
|
|
||
| result = _generate_version(tmp_path) | ||
|
|
||
| assert result.returncode == 0 | ||
| assert result.stdout == source_version | ||
| assert result.stderr == "" | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("source_version", ["v26.10.00", "26", "26.10.00.1", "26.10.00rc0"]) | ||
| def test_release_candidate_version_rejects_non_final_formats(tmp_path, source_version): | ||
| tmp_path.joinpath("VERSION").write_text(f"{source_version}\n") | ||
|
|
||
| result = _generate_version(tmp_path) | ||
|
|
||
| assert result.returncode == 1 | ||
| assert "VERSION file must use a numeric YY.MM or YY.MM.XX format" in result.stderr | ||
|
|
||
|
|
||
| def test_release_candidate_version_uses_committed_version_when_output_redirect_truncates_file(tmp_path): | ||
| tmp_path.joinpath("VERSION").write_text("26.10.00\n") | ||
| subprocess.run(["git", "init"], cwd=tmp_path, check=True, capture_output=True) | ||
| subprocess.run(["git", "add", "VERSION"], cwd=tmp_path, check=True, capture_output=True) | ||
| subprocess.run( | ||
| [ | ||
| "git", | ||
| "-c", | ||
| "user.name=Test", | ||
| "-c", | ||
| "user.email=test@example.com", | ||
| "-c", | ||
| "commit.gpgsign=false", | ||
| "commit", | ||
| "-m", | ||
| "Add version", | ||
| ], | ||
| cwd=tmp_path, | ||
| check=True, | ||
| capture_output=True, | ||
| ) | ||
| environment = os.environ.copy() | ||
| environment["RAPIDS_BUILD_TYPE"] = "release-candidate" | ||
|
|
||
| result = subprocess.run( | ||
| ["bash", "-c", f'"{TOOLS_DIRECTORY / "rapids-generate-version"}" > VERSION'], | ||
| cwd=tmp_path, | ||
| env=environment, | ||
| text=True, | ||
| capture_output=True, | ||
| check=False, | ||
| ) | ||
|
|
||
| assert result.returncode == 0 | ||
| assert tmp_path.joinpath("VERSION").read_text() == "26.10.00" | ||
|
|
||
|
|
||
| def test_release_candidate_version_requires_version_file(tmp_path): | ||
| result = _generate_version(tmp_path) | ||
|
|
||
| assert result.returncode == 1 | ||
| assert "require a non-empty VERSION file in the working tree or at HEAD" in result.stderr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import os | ||
| import subprocess | ||
| from pathlib import Path | ||
|
|
||
| TOOLS_DIRECTORY = Path(__file__).resolve().parents[1] / "tools" | ||
|
|
||
|
|
||
| def _environment(**updates: str) -> dict[str, str]: | ||
| environment = os.environ.copy() | ||
| environment["PATH"] = f"{TOOLS_DIRECTORY}:{environment['PATH']}" | ||
| environment.update(updates) | ||
| return environment | ||
|
|
||
|
|
||
| def test_release_candidate_is_a_release_build(): | ||
| result = subprocess.run( | ||
| [TOOLS_DIRECTORY / "rapids-is-release-build"], | ||
| env=_environment(RAPIDS_BUILD_TYPE="release-candidate", GITHUB_REF="refs/heads/main"), | ||
| text=True, | ||
| capture_output=True, | ||
| check=False, | ||
| ) | ||
|
|
||
| assert result.returncode == 0 | ||
| assert "is release build" in result.stderr | ||
|
|
||
|
|
||
| def test_release_candidate_rattler_channels_exclude_public_rapids_channels(): | ||
| command = f'source "{TOOLS_DIRECTORY / "rapids-rattler-channel-string"}"; printf "%s\\n" "${{RATTLER_CHANNELS[*]}}"' | ||
| result = subprocess.run( | ||
| ["bash", "-c", command], | ||
| env=_environment( | ||
| RAPIDS_BUILD_TYPE="release-candidate", | ||
| GITHUB_REF="refs/heads/main", | ||
| RAPIDS_CONDA_BLD_OUTPUT_DIR="/tmp/conda-output", | ||
| ), | ||
| text=True, | ||
| capture_output=True, | ||
| check=False, | ||
| ) | ||
|
|
||
| assert result.returncode == 0 | ||
| assert result.stdout.splitlines()[-1] == "--channel conda-forge" | ||
| assert "rapidsai" not in result.stdout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't understand how we arrive at this gate, but if it does ever happen, I think the handling here is correct.