diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 100334c..efa982c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb345dd..ca7bdc6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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/')" diff --git a/README.md b/README.md index 98562c0..518ac31 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/tox.ini b/tox.ini index b6ead3b..f12b4ad 100644 --- a/tox.ini +++ b/tox.ini @@ -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 @@ -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)'