-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: ♻️ match template-website copier and justfile setup
#140
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b568f37
refactor: :recycle: match template-website copier setup
martonvago 98988a6
docs: :memo: match post-copy message
martonvago e491055
docs: :memo: fix help message
martonvago fc09281
refactor: :recycle: move template test into own file
martonvago 7c68557
docs: :memo: update guide
martonvago 312af6b
refactor: :recycle: make _publish.yml conditional
martonvago 99b89c1
build: :wrench: add default github_user
martonvago 46a6e3f
build: :wrench: reorder copier variables
martonvago 7d49efe
fix: :bug: remove duplicate site-url
martonvago 5752d9c
style: :art: fix whitespace
martonvago 7b3d643
Merge branch 'main' into refactor/copier-setup
martonvago 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
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 |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
|
|
||
| @_checks: check-spelling check-commits | ||
| # Test Seedcase and non-Seedcase projects | ||
| @_tests: (test "true") (test "false") | ||
| @_tests: (test "true" "netlify") (test "false" "netlify") (test "true" "gh-pages") (test "false" "gh-pages") | ||
| @_builds: build-contributors build-website build-readme | ||
|
|
||
| # Run all build-related recipes in the justfile | ||
|
|
@@ -46,60 +46,9 @@ check-commits: | |
| check-spelling: | ||
| uvx typos | ||
|
|
||
| # Test and check that a Python package can be created from the template | ||
| test is_seedcase_project: | ||
| #!/bin/zsh | ||
| test_name="test-python-package" | ||
| test_dir="$(pwd)/_temp/{{ is_seedcase_project }}/$test_name" | ||
| template_dir="$(pwd)" | ||
| commit=$(git rev-parse HEAD) | ||
| rm -rf $test_dir | ||
| # vcs-ref means the current commit/head, not a tag. | ||
| uvx copier copy $template_dir $test_dir \ | ||
| --vcs-ref=$commit \ | ||
| --defaults \ | ||
| --trust \ | ||
| --data package_github_repo="first-last/repo" \ | ||
| --data is_seedcase_project={{ is_seedcase_project }} \ | ||
| --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 | ||
| # Run checks in the generated test Python package | ||
| 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 Python package works | ||
| echo "Using the template in an existing package command -----------" | ||
| rm .cz.toml .copier-answers.yml LICENSE.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_github_repo="first-last/repo" \ | ||
| --data is_seedcase_project={{ is_seedcase_project }} \ | ||
| --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 | ||
| # Test that a Python package can be created from the template, with parameters for: `is_seedcase_project` (true or false) and `hosting_provider` (either "gh-pages" or "netlify") | ||
| test is_seedcase_project="true" hosting_provider="netlify": | ||
| sh ./test-template.sh {{ is_seedcase_project }} {{ hosting_provider }} | ||
|
|
||
| # Clean up any leftover and temporary build files | ||
| cleanup: | ||
|
|
||
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
| name: Build website | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| # Limit token permissions for security | ||
| permissions: read-all | ||
|
|
||
| jobs: | ||
| build-website: | ||
| uses: seedcase-project/.github/.github/workflows/reusable-build-docs-with-python.yml@main | ||
| {% if hosting_provider == 'gh-pages' -%} | ||
| with: | ||
| hosting-provider: gh-pages | ||
| permissions: | ||
| contents: write | ||
| pages: write | ||
| {%- endif %} | ||
| secrets: | ||
| {% if hosting_provider == 'gh-pages' -%} | ||
| github-token: {{ '${{ secrets.GITHUB_TOKEN }}' }} | ||
| {%- elif hosting_provider == 'netlify' -%} | ||
| netlify-token: {{ '${{ secrets.NETLIFY_AUTH_TOKEN }}' }} | ||
| {%- endif %} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
|
|
||
|
|
||
| # {{ package_name }} | ||
| # {{ github_repo }} |
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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| # {{ package_name }} | ||
| # {{ github_repo }} | ||
|
|
||
| <!-- TODO: Add README for project. --> |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| <!-- TODO: Set up GoatCounter --> | ||
| <script data-goatcounter="https://{{ github_user }}-{{ package_name }}.goatcounter.com/count" async | ||
| <script data-goatcounter="https://{{ github_user }}-{{ github_repo }}.goatcounter.com/count" async | ||
| src="//gc.zgo.at/count.js"></script> |
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
File renamed without changes.
File renamed without changes.
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.
Assuming this, like in
template-website