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
4 changes: 2 additions & 2 deletions .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
version: '${{ github.run_number }}.0.0'
repository: testpypi
secrets:
twine_username: ${{ secrets.TESTPYPI_USERNAME }}
twine_password: ${{ secrets.TESTPYPI_TOKEN }}
twine_token: ${{ secrets.TESTPYPI_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

build_image:
# TODO: remove this entire job if an image does not make sense (ie: just a library, no CLI)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
# so easy to forget bumping the version to match the tag, just override it!
version: ${{ github.ref_name }}
secrets:
twine_username: ${{ secrets.PYPI_USERNAME }}
twine_password: ${{ secrets.PYPI_TOKEN }}
twine_token: ${{ secrets.PYPI_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

build_image:
# TODO: remove this entire job if an image does not make sense (ie: just a library, no CLI)
Expand Down
34 changes: 24 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,31 @@ on:
default: pypi
type: string
secrets:
twine_username:
twine_token:
required: true
twine_password:
CODECOV_TOKEN:
required: false
workflow_dispatch:
inputs:
version:
description: 'Version to publish (for example: 1.2.3)'
type: string
required: true
repository:
description: 'Package index repository'
type: choice
options:
- pypi
- testpypi
default: pypi

run-name: publish to ${{ inputs.repository }}

jobs:
test:
uses: ./.github/workflows/test.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

publish:
name: publish to ${{ inputs.repository }}
Expand All @@ -36,21 +51,20 @@ jobs:

- name: Install dependencies
run: |
pip install pipenv
pipenv requirements --dev > reqs.txt
pip install -r reqs.txt
pip install uv
uv sync --group dev
- name: force right version
run: |
.github/change_version.py --set '${{ inputs.version }}'
- name: Build
run: pyproject-build
run: uv run pyproject-build
- name: Publish
env:
TWINE_USERNAME: ${{ secrets.twine_username }}
TWINE_PASSWORD: ${{ secrets.twine_password }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.twine_token }}
run: |
pyproject-build
twine upload --repository ${{ inputs.repository }} dist/*
uv run pyproject-build
uv run twine upload --verbose --repository ${{ inputs.repository }} dist/*
- name: highlight
# TODO: update package name in summary text
run: |
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: 🧪 tests

on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: false
push:
branches-ignore:
# these are already tested by publish-dev
Expand All @@ -23,9 +26,8 @@ jobs:

- name: Install dependencies
run: |
pip install pipenv
pipenv requirements --dev > reqs.txt
pip install -r reqs.txt
pip install uv
uv sync --group dev

- name: Lint check
id: lint-check
Expand All @@ -39,15 +41,10 @@ jobs:
make test

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results

- name: Final check
if: ${{ steps.lint-check.outcome == 'failure' }}
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Build

This project uses a `Pipfile`, so set up the virtualenv by running
This project uses `uv`, so set up the virtualenv by running

```
pipenv install --dev
uv sync --group dev
```

Use `make test` to make sure all tests pass before pushing.
Expand All @@ -12,4 +12,4 @@ Use `make lint` to make sure lint check passes before pushing.

## Guidelines

...
...
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ FROM python:3.10-alpine AS base
# --- builder
FROM base AS builder
WORKDIR /app
WORKDIR /

COPY Pipfile.lock .
RUN pip install pipenv
RUN pipenv requirements > requirements.txt
RUN pip install --target=/app -r requirements.txt
RUN pip install uv
# TODO: replace with your package name
COPY example /src/example
COPY pyproject.toml README.md /src/
RUN uv pip install --target=/app /src

# --- main
FROM base
COPY --from=builder /app /app
ENV PYTHONPATH=/app
# TODO: replace with your package name
COPY example /app/example

# TODO: replace with your package name
ENTRYPOINT ["python3", "-m", "example"]
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
lint:
ruff format
ruff check --fix
pyproject-pipenv --fix
uv run ruff format
uv run ruff check --fix

lint-check:
ruff format --diff
ruff check
pyproject-pipenv
uv run ruff format --diff
uv run ruff check

test:
if [ -n "$(GITHUB_RUN_ID)" ]; then \
pytest --cov --cov-report=xml --junitxml=junit.xml -o junit_family=legacy; \
uv run pytest --cov --cov-report=xml --junitxml=junit.xml -o junit_family=legacy; \
else \
python -m pytest --cov; \
uv run python -m pytest --cov; \
fi

testpub:
rm -fr dist
pyproject-build
twine upload --repository testpypi dist/*
uv run pyproject-build
uv run twine upload --repository testpypi dist/*
13 changes: 0 additions & 13 deletions Pipfile

This file was deleted.

Loading