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
7 changes: 5 additions & 2 deletions .github/workflows/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ jobs:
with:
enable-cache: false
version: ">=0.13,<0.14"
- name: Install just
# Tools the rendered project's ci-lint needs
- name: Install just, actionlint, and yamllint
run: |
uv tool install rust-just
uv tool install rust-just==1.59.0
uv tool install actionlint-py==1.7.12.25
uv tool install yamllint==1.38.0
- name: Render a project and run its checks
run: |
just check
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Template Checks](https://github.com/ahcodedev/python-project-template/actions/workflows/template.yml/badge.svg?branch=main)](https://github.com/ahcodedev/python-project-template/actions/workflows/template.yml)
[![Security](https://github.com/ahcodedev/python-project-template/actions/workflows/security.yml/badge.svg?branch=main)](https://github.com/ahcodedev/python-project-template/actions/workflows/security.yml)
[![zizmor](https://img.shields.io/badge/%F0%9F%8C%88-zizmor-white?labelColor=white)](https://zizmor.sh/)

A [Copier](https://copier.readthedocs.io/) template for Python projects. Projects created from it can pull in later
template changes with `copier update`.
Expand Down
5 changes: 3 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ render:
# Install Homebrew tools from the Brewfile
setup:
brew bundle install
# Render a demo project and run its lint, tests, docs build, dependency audit, and workflow audit
# Render a demo project and run its lint, spell check, tests, docs build, dependency audit, and workflow audit
check: render
cd {{ rendered }} && just sync
cd {{ rendered }} && just ci-lint
cd {{ rendered }} && just test
cd {{ rendered }} && uvx typos
cd {{ rendered }} && just coverage
cd {{ rendered }} && just docs-build
cd {{ rendered }} && just audit
cd {{ rendered }} && uvx zizmor --offline .
Expand Down
9 changes: 9 additions & 0 deletions template/.devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {
"version": "1.1.3",
"resolved": "ghcr.io/devcontainers/features/github-cli@sha256:bd7ab48a832228f633239277552c30b353867fef2e5b037e064b4e64f0b843f2",
"integrity": "sha256:bd7ab48a832228f633239277552c30b353867fef2e5b037e064b4e64f0b843f2"
}
}
}
10 changes: 5 additions & 5 deletions template/.github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
interval: "weekly"
cooldown:
default-days: 7
labels: ["dependencies"]
groups:
github-actions:
patterns: ["*"]
update-types: ["minor", "patch"]

# Python dependencies in pyproject.toml / uv.lock
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "monthly"
interval: "weekly"
cooldown:
default-days: 7
labels: ["dependencies"]
Expand All @@ -31,7 +31,7 @@ updates:
- package-ecosystem: "docker"
directory: "/.devcontainer"
schedule:
interval: "monthly"
interval: "weekly"
cooldown:
default-days: 7
labels: ["dependencies"]
Expand All @@ -40,7 +40,7 @@ updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: "monthly"
interval: "weekly"
cooldown:
default-days: 7
labels: ["dependencies"]
2 changes: 1 addition & 1 deletion template/.github/pull_request_template.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Add a release label to this PR from the Labels section of the PR sidebar
## Checklist

- [ ] `just lint` passes
- [ ] `just test` passes
- [ ] `just coverage` passes
- [ ] Tests added or updated for the change
- [ ] `README.md` updated if needed
{%- if use_releases %}
Expand Down
7 changes: 6 additions & 1 deletion template/.github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ on:

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
auto-merge:
if: github.event.pull_request.user.login == 'dependabot[bot]'
runs-on: ubuntu-slim
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
pull-requests: write
Expand Down
18 changes: 14 additions & 4 deletions template/.github/workflows/python.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ on:

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
code-check-and-unit-test:
runs-on: ubuntu-slim
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
Expand All @@ -25,21 +30,26 @@ jobs:
version: ">=0.13,<0.14"
- name: Setup environment
run: |
uv tool install rust-just
uv tool install rust-just==1.59.0
uv tool install actionlint-py==1.7.12.25
uv tool install yamllint==1.38.0
just sync
- name: Lint
run: |
just ci-lint
- name: Spell check
uses: crate-ci/typos@276087d9a4f06398b3e04825487805e2d7375888 # v1.52.2
- name: Unit tests
run: |
just test
just coverage
{%- endraw %}{% if use_docs %}{% raw %}
- name: Docs build
run: |
just docs-build
{%- endraw %}{% endif %}{% raw %}
markdownlint:
runs-on: ubuntu-slim
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
Expand Down
12 changes: 10 additions & 2 deletions template/.github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
update-draft:
if: github.event_name == 'push'
runs-on: ubuntu-slim
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
Expand All @@ -22,7 +27,8 @@ jobs:

autolabel:
if: github.event_name == 'pull_request' && github.event.action != 'labeled' && github.event.action != 'unlabeled'
runs-on: ubuntu-slim
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
pull-requests: write
steps:
Expand All @@ -37,12 +43,14 @@ jobs:
# Run even when autolabel is skipped (labeled/unlabeled events)
if: ${{ always() && github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
pull-requests: read
steps:
- uses: mheap/github-action-required-labels@23e10fde7e062233401931a0eece796cd9bf3177 # v5.6.0
with:
mode: minimum
count: 1
# yamllint disable-line rule:line-length
labels: "breaking, feature, enhancement, bug, fix, chore, ci, dependencies, documentation, refactor, skip-changelog"
use_api: true
1 change: 1 addition & 0 deletions template/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ permissions:
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
Expand Down
40 changes: 28 additions & 12 deletions template/.github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ on:

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
zizmor:
runs-on: ubuntu-slim
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read # only needed for private or internal repos
actions: read # only needed for private or internal repos
Expand All @@ -25,7 +30,8 @@ jobs:
with:
advanced-security: false
pip-audit:
runs-on: ubuntu-slim
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
Expand All @@ -40,20 +46,30 @@ jobs:
version: ">=0.13,<0.14"
- name: Setup environment
run: |
uv tool install rust-just
uv tool install rust-just==1.59.0
just sync
- name: Audit dependencies
run: |
just audit
gitleaks:
runs-on: ubuntu-slim
betterleaks:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read # needed to check out a private repo
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- name: Check gitleaks
uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_ENABLE_COMMENTS: false
persist-credentials: false
fetch-depth: 0
# betterleaks has no official action or PyPI package, so it is built from source
- name: Install Go
uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version: stable
cache: false
- name: Install betterleaks
run: |
go install github.com/betterleaks/betterleaks@v1.10.1
- name: Scan git history for secrets
run: |
"$(go env GOPATH)/bin/betterleaks" git --redact .
Loading
Loading