Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Improve CI (#51)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
gaborbernat and pre-commit-ci[bot] authored Sep 18, 2024
1 parent 63c291a commit f5c04de
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 53 deletions.
52 changes: 30 additions & 22 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,50 +27,58 @@ jobs:
- windows-latest
- macos-latest
steps:
- name: setup python for tox
uses: actions/setup-python@v5
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
python-version: "3.12"
- name: install tox-uv
run: python -m pip install tox-uv
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install tox
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
- name: Install Python
if: startsWith(matrix.env, '3.') && matrix.env != '3.13'
run: uv python install --python-preference only-managed ${{ matrix.env }}
- uses: moonrepo/setup-rust@v1
with:
cache-base: main
bins: cargo-tarpaulin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: setup python for test ${{ matrix.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
allow-prereleases: true
- name: setup test suite
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }}
- name: run test suite
run: tox run --skip-pkg-install -e ${{ matrix.py }}
env:
PYTEST_ADDOPTS: "-vv --durations=20"

check:
name: tox env ${{ matrix.tox_env }}
name: tox env ${{ matrix.env }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tox_env:
env:
- type
- dev
- readme
- pkg_meta
steps:
- uses: actions/checkout@v4
- name: setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: install tox-uv
run: python -m pip install tox-uv
- uses: moonrepo/setup-rust@v1
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
cache-base: main
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install tox
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
- name: Setup test suite
run: tox -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }}
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.env }}
- name: Run test suite
run: tox --skip-pkg-install -e ${{ matrix.tox_env }}
run: tox run --skip-pkg-install -e ${{ matrix.env }}
env:
PYTEST_ADDOPTS: "-vv --durations=20"
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/project/pyproject-fmt-rust
url: https://pypi.org/project/pyproject-fmt-rust/${{ github.ref_name }}
permissions:
id-token: write
if: "startsWith(github.ref, 'refs/tags/')"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyproject-fmt-rust?style=flat-square)](https://pypi.org/project/pyproject-fmt-rust)
[![Downloads](https://static.pepy.tech/badge/pyproject-fmt-rust/month)](https://pepy.tech/project/pyproject-fmt-rust)
[![PyPI - License](https://img.shields.io/pypi/l/pyproject-fmt-rust?style=flat-square)](https://opensource.org/licenses/MIT)
[![check](https://github.com/tox-dev/pyproject-fmt-rust/actions/workflows/check.yml/badge.svg)](https://github.com/tox-dev/pyproject-fmt-rust/actions/workflows/check.yml)
[![check](https://github.com/tox-dev/pyproject-fmt-rust/actions/workflows/check.yaml/badge.svg)](https://github.com/tox-dev/pyproject-fmt-rust/actions/workflows/check.yaml)
46 changes: 17 additions & 29 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,29 @@ env_list =
3.9
3.8
type
readme
docs
skip_missing_interpreters = true
pkg_meta

[testenv]
description = run the unit tests with pytest under {basepython}
description = run the unit tests with pytest under {base_python}
package = wheel
wheel_build_env = .pkg
extras =
graphviz
test
pass_env =
PYTEST_*
set_env =
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
COVERAGE_PROCESS_START = {toxinidir}/setup.cfg
_COVERAGE_SRC = {envsitepackagesdir}/sphinx_argparse_cli
COVERAGE_FILE = {work_dir}/.coverage.{env_name}
commands =
cargo tarpaulin --no-default-features --out Html --output-dir {env_dir}
python -m pytest {tty:--color=yes} {posargs: \
--junitxml {toxworkdir}{/}junit.{envname}.xml --cov {envsitepackagesdir}{/}pyproject_fmt_rust \
--cov {toxinidir}{/}tests --cov-fail-under=100 \
--cov {env_site_packages_dir}{/}pyproject_fmt_rust --cov {tox_root}{/}tests \
--cov-config=pyproject.toml --no-cov-on-fail --cov-report term-missing:skip-covered --cov-context=test \
--cov-report html:{envtmpdir}{/}htmlcov --cov-report xml:{toxworkdir}{/}coverage.{envname}.xml \
--cov-report html:{env_tmp_dir}{/}htmlcov --cov-report xml:{work_dir}{/}coverage.{env_name}.xml \
--junitxml {work_dir}{/}junit.{env_name}.xml \
tests}
allowlist_externals =
cargo

[testenv:fix]
description = run static analysis and style check using flake8
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
skip_install = true
deps =
pre-commit-uv>=4.1
Expand All @@ -51,30 +48,21 @@ commands =
mypy src
mypy tests

[testenv:readme]
[testenv:pkg_meta]
description = check that the long description is valid
skip_install = true
deps =
build[uv]>=1.2.2
check-wheel-contents>=0.6
twine>=5.1.1
uv>=0.4.10
commands =
pyproject-build --installer uv --sdist --wheel -o {envtmpdir} .
twine check {envtmpdir}/*

[testenv:docs]
description = build documentation
extras =
docs
commands =
sphinx-build -d "{envtmpdir}{/}doctree" docs "{toxworkdir}{/}docs_out" --color -b html {posargs}
python -c 'print(r"documentation available under file://{toxworkdir}{/}docs_out{/}index.html")'
uv build --sdist --wheel --out-dir {env_tmp_dir} .
twine check {env_tmp_dir}{/}*
check-wheel-contents --no-config {env_tmp_dir}

[testenv:dev]
description = generate a DEV environment
package = editable
extras =
docs
test
commands =
uv pip tree
python -c 'import sys; print(sys.executable)'

0 comments on commit f5c04de

Please sign in to comment.