Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 38 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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: preparing to recopy 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.yml LICENSE-MIT.md
git add .
git commit -m "test: preparing to copy 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="[email protected]" \
--data review_team="@first-last/developers" \
--data github_board_number=22

# Clean up any leftover and temporary build files
cleanup:
Expand Down
Loading