22 just --list --unsorted
33
44@_ checks : check-spelling check-commits
5+ # Test Seedcase and non-Seedcase projects
6+ @_ tests : (test " true" ) (test " false" )
57@_ builds : build-contributors build-website build-readme
68
79# Run all build-related recipes in the justfile
8- run-all : update-quarto-theme update-template _checks test _builds
10+ run-all : update-quarto-theme update-template _checks _tests _builds
911
1012# Install the pre-commit hooks
1113install-precommit :
@@ -26,7 +28,7 @@ update-template:
2628 mkdir -p template/ tools
2729 cp tools/ get-contributors.sh template/ tools/
2830 cp .github/ pull_request_template.md template/ .github/
29- cp .github/ workflows/ build-website.yml .github / workflows / dependency-review.yml template/ .github/ workflows/
31+ cp .github/ workflows/ dependency-review.yml template/ .github/ workflows/
3032
3133# Check the commit messages on the current branch that are not on the main branch
3234check-commits :
@@ -45,9 +47,59 @@ check-spelling:
4547 uvx typos
4648
4749# Test and check that a Python package can be created from the template
48- # TODO: add test for copier
49- test :
50- echo " copier test"
50+ test is_seedcase_project :
51+ #!/ bin/ zsh
52+ test_name=" test-python-package"
53+ test_dir=" $(pwd)/_temp/{{ is_seedcase_project }} /$test_name"
54+ template_dir=" $(pwd)"
55+ commit=$(git rev-parse HEAD)
56+ rm -rf $test_dir
57+ # vcs-ref means the current commit/head, not a tag.
58+ uvx copier copy $template_dir $test_dir \
59+ - -vcs-ref=$commit \
60+ - -defaults \
61+ - -trust \
62+ - -data package_github_repo=" first-last/repo" \
63+ - -data is_seedcase_project={{ is_seedcase_project }} \
64+ - -data author_given_name=" First" \
65+ - -data author_family_name=" Last" \
66+ - -data author_email=
" [email protected] " \
67+ - -data review_team=" @first-last/developers" \
68+ - -data github_board_number=22
69+ # Run checks in the generated test Python package
70+ cd $test_dir
71+ git add .
72+ git commit -m " test: initial copy"
73+ just check-python check-spelling
74+ # TODO: Find some way to test the `update` command
75+ # Check that recopy works
76+ echo " Testing recopy command -----------"
77+ rm .cz.toml
78+ git add .
79+ git commit -m " test: preparing to recopy from the template"
80+ uvx copier recopy \
81+ - -vcs-ref=$commit \
82+ - -defaults \
83+ - -overwrite \
84+ - -trust
85+ # Check that copying onto an existing Python package works
86+ echo " Using the template in an existing package command -----------"
87+ rm .cz.toml .copier-answers.yml LICENSE.md
88+ git add .
89+ git commit -m " test: preparing to copy onto an existing package"
90+ uvx copier copy \
91+ $template_dir $test_dir \
92+ - -vcs-ref=$commit \
93+ - -defaults \
94+ - -trust \
95+ - -overwrite \
96+ - -data package_github_repo=" first-last/repo" \
97+ - -data is_seedcase_project={{ is_seedcase_project }} \
98+ - -data author_given_name=" First" \
99+ - -data author_family_name=" Last" \
100+ - -data author_email=
" [email protected] " \
101+ - -data review_team=" @first-last/developers" \
102+ - -data github_board_number=22
51103
52104# Clean up any leftover and temporary build files
53105cleanup :
@@ -64,4 +116,4 @@ build-readme:
64116
65117# Generate a Quarto include file with the contributors
66118build-contributors :
67- sh ./ tools/ get-contributors.sh seedcase-project/ template-workshop
119+ sh ./ tools/ get-contributors.sh seedcase-project/ template-python-project
0 commit comments