From 138a62b7715ed9a5463ef67e6fa6e84d5e811863 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Fri, 25 Jul 2025 15:22:58 +0200 Subject: [PATCH 1/3] build: :hammer: add test of recopy and copy in existing project --- justfile | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/justfile b/justfile index dd28c88..8f1b297 100644 --- a/justfile +++ b/justfile @@ -32,12 +32,14 @@ check-spelling: # Test and check that a data package can be created from the template test: #!/bin/zsh - test_dir="$(pwd)/_temp" test_name="test-data-package" + test_dir="$(pwd)/_temp/$test_name" + template_dir="$(pwd)" + commit=$(git rev-parse HEAD) rm -rf $test_dir # vcs-ref means the current commit/head, not a tag. - # `.` means the current directory contains the template. - uvx copier copy --vcs-ref=HEAD . $test_dir/$test_name \ + uvx copier copy $template_dir $test_dir \ + --vcs-ref=$commit \ --defaults \ --trust \ --data package_abbrev=$test_name \ @@ -48,7 +50,39 @@ test: --data review_team="@first-last/developers" \ --data github_board_number=22 # Run checks in the generated test data package - (cd $test_dir/$test_name && just check-python check-spelling) + cd $test_dir + git add . + git commit -m "test: initial copy" + just check-python check-spelling + # TODO: Find some way to test the `update` command + # Check that recopy works + echo "Testing recopy command -----------" + rm .cz.toml + git add . + git commit -m "test: recopying from the template" + uvx copier recopy \ + --vcs-ref=$commit \ + --defaults \ + --overwrite \ + --trust + # Check that copying onto an existing data package works + echo "Using the template in an existing package command -----------" + rm .cz.toml .copier-answers.yaml LICENSE-MIT.md + git add . + git commit -m "test: copying onto an existing package" + uvx copier copy \ + $template_dir $test_dir \ + --vcs-ref=$commit \ + --defaults \ + --trust \ + --overwrite \ + --data package_abbrev=$test_name \ + --data package_github_repo="first-last/${test_name}" \ + --data author_given_name="First" \ + --data author_family_name="Last" \ + --data author_email="first.last@example.com" \ + --data review_team="@first-last/developers" \ + --data github_board_number=22 # Clean up any leftover and temporary build files cleanup: From e238225bf6b780b7bcb2bcda6b2e6a3812b3b6bc Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Fri, 25 Jul 2025 17:12:52 +0200 Subject: [PATCH 2/3] build: :pencil2: typo! Co-authored-by: martonvago <57952344+martonvago@users.noreply.github.com> --- justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/justfile b/justfile index 8f1b297..15cf67c 100644 --- a/justfile +++ b/justfile @@ -67,7 +67,7 @@ test: --trust # Check that copying onto an existing data package works echo "Using the template in an existing package command -----------" - rm .cz.toml .copier-answers.yaml LICENSE-MIT.md + rm .cz.toml .copier-answers.yml LICENSE-MIT.md git add . git commit -m "test: copying onto an existing package" uvx copier copy \ From 5333eb0f5da2f1247104fe34b3dbc574a57f563f Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Fri, 25 Jul 2025 17:24:01 +0200 Subject: [PATCH 3/3] build: :pencil2: clarify messages --- justfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index 15cf67c..583d180 100644 --- a/justfile +++ b/justfile @@ -59,7 +59,7 @@ test: echo "Testing recopy command -----------" rm .cz.toml git add . - git commit -m "test: recopying from the template" + git commit -m "test: preparing to recopy from the template" uvx copier recopy \ --vcs-ref=$commit \ --defaults \ @@ -69,7 +69,7 @@ test: echo "Using the template in an existing package command -----------" rm .cz.toml .copier-answers.yml LICENSE-MIT.md git add . - git commit -m "test: copying onto an existing package" + git commit -m "test: preparing to copy onto an existing package" uvx copier copy \ $template_dir $test_dir \ --vcs-ref=$commit \