Skip to content
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

Modernize CI #61

Merged
merged 7 commits into from
Sep 2, 2024
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
39 changes: 21 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ jobs:
redis-version: [6]

steps:
- uses: "actions/checkout@v3"
- uses: "actions/checkout@v4"

- uses: "actions/setup-python@v4"
- uses: "pdm-project/setup-pdm@v4"
with:
python-version: "${{ matrix.python-version }}"
allow-prereleases: true
allow-python-prereleases: true
cache: true
version: "2.18.1"

- name: "Start Redis"
uses: "supercharge/[email protected]"
Expand All @@ -33,37 +35,37 @@ jobs:

- name: "Run Tox"
run: |
set -xe
python -VV
python -Im site
python -Im pip install --upgrade pip wheel pdm
python -Im pip install --upgrade tox tox-gh-actions
python -Im tox
- name: "Upload coverage data"
uses: "actions/upload-artifact@v3"

- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: "coverage-data"
path: ".coverage.*"
if-no-files-found: "ignore"
name: coverage-data-${{ matrix.python-version }}
path: .coverage.*
if-no-files-found: ignore
include-hidden-files: true

coverage:
name: "Combine & check coverage."
needs: "tests"
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v3"
- uses: "actions/checkout@v4"

- uses: "actions/setup-python@v4"
- uses: "actions/setup-python@v5"
with:
cache: "pip"
python-version: "3.11"
python-version: "3.12"

- run: "python -Im pip install --upgrade coverage[toml]"

- uses: "actions/download-artifact@v3"
- name: Download coverage data
uses: actions/download-artifact@v4
with:
name: "coverage-data"
pattern: coverage-data-*
merge-multiple: true

- name: "Combine coverage"
run: |
Expand All @@ -81,13 +83,14 @@ jobs:
python -Im coverage report --fail-under=97

- name: "Upload HTML report."
uses: "actions/upload-artifact@v3"
uses: "actions/upload-artifact@v4"
with:
name: "html-report"
path: "htmlcov"
if: always()

- name: "Make badge"
if: github.ref == 'refs/heads/main'
uses: "schneegans/[email protected]"
with:
# GIST_TOKEN is a GitHub personal access token with scope "gist".
Expand Down
88 changes: 54 additions & 34 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ lint = [
"mypy>=1.4.1",
]
test = [
"coverage",
"coverage>=7.6.1",
"pytest-asyncio",
"httpx",
"hypercorn",
Expand Down
25 changes: 22 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
[gh-actions]
python =
3.10: py310
3.11: py311
3.11: py311, docs
3.12: py312, lint
3.13: py313

[tox]
envlist = py310, py311, py312, py313, lint
envlist = py310, py311, py312, py313, lint, docs
isolated_build = True
skipsdist = true

[testenv:lint]
basepython = python3.12
Expand All @@ -27,7 +28,25 @@ commands_pre =
pdm sync -G test
python -c 'import pathlib; pathlib.Path("{env_site_packages_dir}/cov.pth").write_text("import coverage; coverage.process_startup()")'
commands =
pdm run coverage run -m pytest tests --mypy-only-local-stub -n auto {posargs}
pdm run coverage run -m pytest tests --mypy-only-local-stub {posargs:-n auto}
allowlist_externals = pdm
package = wheel
wheel_build_env = .pkg

[testenv:py312]
setenv =
PDM_IGNORE_SAVED_PYTHON="1"
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
COVERAGE_CORE=sysmon

[testenv:docs]
basepython = python3.11
setenv =
PYTHONHASHSEED = 0
commands_pre =
pdm sync -G :all,docs
commands =
make docs
allowlist_externals =
make
pdm
Loading