Skip to content

Commit

Permalink
update gitignore and hatch for check manifest exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed Nov 29, 2024
1 parent 325b8b8 commit 7e6fdad
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 12 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,30 @@ jobs:
build:
strategy:
matrix:
template: ["python", "cpp", "js", "jupyter", "rust"]
template:
- python
# - cpp
- js
- jupyter
- rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- run: pip install copier
- run: make gen-${{matrix.template}}
- uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy, rustfmt
- run: |
make gen-${{matrix.template}}
make test-${{matrix.template}}
43 changes: 38 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,66 @@ SED = sed -i '' -e
endif


.PHONY: gen-python
.PHONY: gen-python gen-cpp gen-js gen-jupyter gen-rust
gen-python: ## regenerate the python template from scratch
mkdir -p ../python-template && cd ../python-template && rm -rf ./* && rm -rf .copier-answers.yml .gitignore .github .gitattributes
copier copy -w . ../python-template --data-file examples/python.yml
cd ../python-template && $(SED) 's#_src_path: .#_src_path: https://github.com/python-project-templates/base.git#g' ./.copier-answers.yml

.PHONY: gen-cpp
gen-cpp: ## regenerate the c++ template from scratch
mkdir -p ../python-template-cpp && cd ../python-template-cpp && rm -rf ./* && rm -rf .copier-answers.yml .gitignore .github .gitattributes
copier copy -w . ../python-template-cpp --data-file examples/cpp.yml
cd ../python-template-cpp && $(SED) 's#_src_path: .#_src_path: https://github.com/python-project-templates/base.git#g' ./.copier-answers.yml

.PHONY: gen-js
gen-js: ## regenerate the js template from scratch
mkdir -p ../python-template-js && cd ../python-template-js && rm -rf ./* && rm -rf .copier-answers.yml .gitignore .github .gitattributes
copier copy -w . ../python-template-js --data-file examples/js.yml
cd ../python-template-js && $(SED) 's#_src_path: .#_src_path: https://github.com/python-project-templates/base.git#g' ./.copier-answers.yml

.PHONY: gen-jupyter
gen-jupyter: ## regenerate the jupyter template from scratch
mkdir -p ../python-template-jupyter && cd ../python-template-jupyter && rm -rf ./* && rm -rf .copier-answers.yml .gitignore .github .gitattributes
copier copy -w . ../python-template-jupyter --data-file examples/jupyter.yml
cd ../python-template-jupyter && $(SED) 's#_src_path: .#_src_path: https://github.com/python-project-templates/base.git#g' ./.copier-answers.yml

.PHONY: gen-rust
gen-rust: ## regenerate the rust template from scratch
mkdir -p ../python-template-rust && cd ../python-template-rust && rm -rf ./* && rm -rf .copier-answers.yml .gitignore .github .gitattributes
copier copy -w . ../python-template-rust --data-file examples/rust.yml
cd ../python-template-rust && $(SED) 's#_src_path: .#_src_path: https://github.com/python-project-templates/base.git#g' ./.copier-answers.yml

.PHONY: test-python test-cpp test-js test-jupyter test-rust
test-python:
cd ../python-template && git config --global user.name "github-actions" && git config --global user.email "41898282+github-actions[bot]@[email protected]" && git init && git add . && git commit -m "initial commit"
cd ../python-template && make develop
cd ../python-template && make lint
cd ../python-template && make checks
cd ../python-template && make test

test-cpp:
cd ../python-template-cpp && git config --global user.name "github-actions" && git config --global user.email "41898282+github-actions[bot]@[email protected]" && git init && git add . && git commit -m "initial commit"
cd ../python-template-cpp && git init && git add . && git commit -m "initial commit"
cd ../python-template-cpp && make develop
cd ../python-template-cpp && make lint
cd ../python-template-cpp && make checks
cd ../python-template-cpp && make test

test-js:
cd ../python-template-js && git config --global user.name "github-actions" && git config --global user.email "41898282+github-actions[bot]@[email protected]" && git init && git add . && git commit -m "initial commit"
cd ../python-template-js && make develop
cd ../python-template-js && make lint
cd ../python-template-js && make checks
cd ../python-template-js && make test

test-jupyter:
cd ../python-template-jupyter && git config --global user.name "github-actions" && git config --global user.email "41898282+github-actions[bot]@[email protected]" && git init && git add . && git commit -m "initial commit"
cd ../python-template-jupyter && make develop
cd ../python-template-jupyter && make lint
cd ../python-template-jupyter && make checks
cd ../python-template-jupyter && make test

test-rust:
cd ../python-template-rust && git config --global user.name "github-actions" && git config --global user.email "41898282+github-actions[bot]@[email protected]" && git init && git add . && git commit -m "initial commit"
cd ../python-template-rust && make develop
cd ../python-template-rust && make lint
cd ../python-template-rust && make checks
cd ../python-template-rust && make test

8 changes: 6 additions & 2 deletions js/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ ignore = [
"js/pnpm-lock.yaml",
"Makefile",
"setup.py",
"{{module}}/**/*",
"{{module}}/extension/**/*",
"docs/**/*",
"js/dist/**/*",
]

[tool.coverage.run]
Expand Down Expand Up @@ -111,6 +113,7 @@ exclude = [
"/.github",
"/.gitattributes",
"/.gitignore",
"/docs",
"/js/node_modules",
]

Expand All @@ -123,8 +126,9 @@ exclude = [
"/.github",
"/.gitattributes",
"/.gitignore",
"/js/node_modules",
"/pyproject.toml",
"/docs",
"/js/node_modules",
]

[tool.hatch.build.hooks.jupyter-builder]
Expand Down
5 changes: 4 additions & 1 deletion jupyter/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ ignore = [
"setup.py",
"{{module}}/labextension/**",
"{{module}}/nbextension/**",
"docs/**/*",
]
[tool.coverage.run]
Expand Down Expand Up @@ -116,6 +117,7 @@ exclude = [
"/.gitattributes",
"/.gitignore",
"/js/node_modules",
"/docs",
]
[tool.hatch.build.targets.wheel]
Expand All @@ -127,8 +129,9 @@ exclude = [
"/.github",
"/.gitattributes",
"/.gitignore",
"/js/node_modules",
"/pyproject.toml",
"/docs",
"/js/node_modules",
]
[tool.hatch.build.targets.wheel.shared-data]
Expand Down
3 changes: 3 additions & 0 deletions python/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ignore = [
".copier-answers.yml",
"Makefile",
"setup.py",
"docs/**/*",
]

[tool.coverage.run]
Expand Down Expand Up @@ -97,6 +98,7 @@ exclude = [
"/.github",
"/.gitattributes",
"/.gitignore",
"/docs",
]

[tool.hatch.build.targets.wheel]
Expand All @@ -109,6 +111,7 @@ exclude = [
"/.gitattributes",
"/.gitignore",
"/pyproject.toml",
"/docs",
]

[tool.hatch.build.targets.wheel.shared-data]
Expand Down
2 changes: 2 additions & 0 deletions rust/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ ignore = [
".copier-answers.yml",
"Makefile",
"setup.py",
"docs/**/*",
"rust/.config/*",
"rust/Cargo.lock",
"rust/README.md",
]
Expand Down

0 comments on commit 7e6fdad

Please sign in to comment.