Skip to content

Commit

Permalink
ci: only update one channel when updating test channel (#2502)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian authored Nov 18, 2024
1 parent a884600 commit 4c1cb86
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
4 changes: 2 additions & 2 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ test-integration-slow = { cmd = "pytest --numprocesses=auto --durations=10 tests
# you can also pass a specific test function, like this:
# /path/to/test.py::test_function
test-specific-test = { cmd = "pytest", depends-on = ["build-release"] }
# Update one test channel by passing on key of `mappings.toml`
# e.g. "trampoline/trampoline_2.yaml"
# Update one test channel by passing on value of `mappings.toml`
# e.g. "multiple_versions_channel_1"
update-test-channel = { cmd = "python update-channels.py", cwd = "tests/data/channels" }

[feature.dev.dependencies]
Expand Down
45 changes: 25 additions & 20 deletions tests/data/channels/update-channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,40 @@
from pathlib import Path
import shutil
import tomllib
import argparse


def main() -> None:
parser = argparse.ArgumentParser(description="Update a single channel.")
parser.add_argument("channel", help="The channel to update")
args = parser.parse_args()

platforms = ["win-64", "linux-64", "osx-arm64", "osx-64"]
mappings = tomllib.loads(Path("mappings.toml").read_text())
channels_dir = Path("channels")
channels_dir = Path("channels", args.channel)
shutil.rmtree(channels_dir, ignore_errors=True)
channels_dir.mkdir()

for recipe, channel in mappings.items():
print(recipe, channel)
for platform in platforms:
subprocess.run(
[
"rattler-build",
"build",
"--target-platform",
platform,
"--no-include-recipe",
"--output-dir",
f"channels/{channel}",
"--recipe",
f"recipes/{recipe}",
],
check=True,
)
if channel == args.channel:
print(recipe, channel)
for platform in platforms:
subprocess.run(
[
"rattler-build",
"build",
"--target-platform",
platform,
"--no-include-recipe",
"--output-dir",
f"channels/{channel}",
"--recipe",
f"recipes/{recipe}",
],
check=True,
)

# Remove the build directory using shutil
shutil.rmtree(Path(channel, "bld"), ignore_errors=True)
# Remove the build directory using shutil
shutil.rmtree(channels_dir.joinpath("bld"), ignore_errors=True)


if __name__ == "__main__":
Expand Down

0 comments on commit 4c1cb86

Please sign in to comment.