Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
* fix/project-builds: generated projects install, start and build, with a uv.lock, the right colorlog package, a working FastAPI lifespan and a pinned uv in the dev container.
* feature/run-script: generated projects ship a run.sh for building, formatting with ruff, testing with pytest and building a wheel and sdist, with starter tests and ruff-clean code.
* feature/github-ci: generated projects ship the shared GitHub CI, a VERSION file and the shared Renovate settings, which copier update leaves alone.
* feature/makefile: generated projects ship a Makefile with build, format, format-dry-run, test and release targets in place of run.sh, with make in the dev container and the shared CI calling make.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ The workflow is read-only apart from the tag job, which needs write access to cr

### Project Tasks

Every generated project has a `run.sh` at its root:
* `./run.sh --build` installs the locked dependencies and byte-compiles the package.
* `./run.sh --format` formats the Python sources with ruff; `--format-dry-run` lists unformatted files and fails if there are any.
* `./run.sh --test` runs the tests with pytest.
* `./run.sh --release` builds a wheel and an sdist into `dist/`.
Every generated project has a `Makefile` at its root:
* `make build` installs the locked dependencies and byte-compiles the package.
* `make format` formats the Python sources with ruff; `make format-dry-run` lists unformatted files and fails if there are any.
* `make test` runs the tests with pytest.
* `make release` builds a wheel and an sdist into `dist/`.


### GitHub CI

Generated projects ship with the shared workflow from [template-github-ci](https://github.com/karshosphere/template-github-ci), vendored into `template/.github/`. It expects the project's `run.sh` and `.devcontainer/`, requires a `VERSION` bump on every pull request, and publishes a GitHub release on each merge to main.
Generated projects ship with the shared workflow from [template-github-ci](https://github.com/karshosphere/template-github-ci), vendored into `template/.github/`. It expects the project's `Makefile` and `.devcontainer/`, requires a `VERSION` bump on every pull request, and publishes a GitHub release on each merge to main.

To bring in a newer release of the workflow, from this repository's root:

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.2.0
v2.0.0
2 changes: 1 addition & 1 deletion template/.github/.copier-ci-answers.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# .github/.copier-ci-answers.yml.jinja
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v1.1.1
_commit: v2.0.0
_src_path: gh:karshosphere/template-github-ci
14 changes: 7 additions & 7 deletions template/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: run.sh is present and executable
- name: Makefile is present
run: |
[ -x run.sh ] || {
echo "::error file=run.sh::run.sh is missing or not executable"
[ -f Makefile ] || {
echo "::error::Makefile is missing from the project root"
exit 1
}
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
Expand All @@ -67,13 +67,13 @@ jobs:
- name: Start the dev container
run: devcontainer up --workspace-folder .
- name: Format
run: devcontainer exec --workspace-folder . ./run.sh --format-dry-run
run: devcontainer exec --workspace-folder . make format-dry-run
- name: Build
run: devcontainer exec --workspace-folder . ./run.sh --build
run: devcontainer exec --workspace-folder . make build
- name: Test
run: devcontainer exec --workspace-folder . ./run.sh --test
run: devcontainer exec --workspace-folder . make test
- name: Release build
run: devcontainer exec --workspace-folder . ./run.sh --release
run: devcontainer exec --workspace-folder . make release
- if: github.event_name == 'push'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
Expand Down
1 change: 1 addition & 0 deletions template/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN apt update && apt upgrade -y \
&& apt install --no-install-recommends -y \
ca-certificates \
bash \
make \
curl \
&& apt clean \
&& apt autoremove \
Expand Down
22 changes: 22 additions & 0 deletions template/Makefile.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Project tasks. CI runs format-dry-run, build, test and release.

PACKAGE := {{ module_slug }}

.PHONY: build format format-dry-run test release

build:
uv sync --locked
uv run --locked python -m compileall -q $(PACKAGE)

format:
uv run --locked ruff format .

format-dry-run:
uv run --locked ruff format --check .

test:
uv run --locked pytest

release:
rm -rf dist
uv build --out-dir dist
10 changes: 5 additions & 5 deletions template/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
### Build

```bash
$ ./run.sh --build
$ make build
```

### Run
Expand All @@ -31,14 +31,14 @@ $ uv run main
### Run all tests

```bash
$ ./run.sh --test
$ make test
```

### Formatting

```bash
$ ./run.sh --format # format in place
$ ./run.sh --format-dry-run # list files that need formatting
$ make format # format in place
$ make format-dry-run # list files that need formatting
```


Expand All @@ -52,7 +52,7 @@ $ ./run.sh --format-dry-run # list files that need formatting

## Release

`./run.sh --release` builds a wheel and an sdist into `dist/`. They install on any platform with Python 3.13.
`make release` builds a wheel and an sdist into `dist/`. They install on any platform with Python 3.13.



Expand Down
51 changes: 0 additions & 51 deletions template/run.sh.jinja

This file was deleted.