diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4253104..3bd857e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,6 +2,7 @@ name: Build on: push: + tags: ["*"] jobs: build: @@ -17,7 +18,6 @@ jobs: publish: name: Publish to PyPI - if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-24.04 needs: [build] environment: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 984309c..768265f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,47 +18,56 @@ env: FORCE_COLOR: 1 jobs: + build-package: + name: Build & verify package + runs-on: ubuntu-latest + outputs: + supported-python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }} + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + persist-credentials: false + + - uses: hynek/build-and-inspect-python-package@efb823f52190ad02594531168b7a2d5790e66516 # v2.14.0 + id: baipp + actionlint: + name: Static analysis of GitHub Actions runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: reviewdog/action-actionlint@0d952c597ef8459f634d7145b0b044a9699e5e43 # v1.71.0 - - name: Run actionlint - uses: reviewdog/action-actionlint@0d952c597ef8459f634d7145b0b044a9699e5e43 # v1.71.0 + lint: + name: Static analysis of code + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0 + - name: Install tox + run: uv tool install --with tox-uv tox + - name: Type checks + run: tox -e typing + - name: Lint code + run: tox -e lint test: name: Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} + needs: build-package strategy: fail-fast: false matrix: os: [ubuntu-24.04] - python-version: - - "3.8" - - "3.9" - - "3.10" - - "3.11" - - "3.12" - - "3.13" - - "3.14" - - "3.15" + python-version: ${{ fromJson(needs.build-package.outputs.supported-python-versions) }} steps: - - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Set up Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - with: - python-version: ${{ matrix.python-version }} - allow-prereleases: true - - - name: Install uv - uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0 - + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0 - name: Run tests - run: uvx --with tox-gh --with tox-uv tox - + env: + PYTHON: ${{ matrix.python-version }} + run: uvx --with tox-uv tox -e "$PYTHON" - name: Upload coverage data uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: @@ -71,20 +80,11 @@ jobs: runs-on: ubuntu-latest needs: test steps: - - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - - name: Download coverage data - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: pattern: coverage-data-* merge-multiple: true - - - name: Set up Python - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 - - - name: Install uv - uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0 - + - uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0 - name: Combine coverage data and generate report run: uvx --with tox-uv tox -e coverage diff --git a/pyproject.toml b/pyproject.toml index 3b456b9..c7c6d2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ keywords = [ classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", @@ -74,18 +73,13 @@ include = ["backoff", "tests"] include = ["backoff"] [tool.tox] -min_version = "4.22" -requires = [ "tox", "tox-gh", "tox-uv" ] +min_version = "4.43" +requires = [ "tox>=4.43", "tox-uv" ] env_list = [ "format", - "3.8", - "3.9", - "3.10", - "3.11", - "3.12", - "3.13", - "3.14", - "3.15", + { product = [ + { prefix = "3.", start = 8 }, + ] }, "coverage", "lint", "typing", @@ -102,16 +96,7 @@ commands = [ [tool.tox.env.coverage] description = "generate coverage report" -depends = [ - "3.8", - "3.9", - "3.10", - "3.11", - "3.12", - "3.13", - "3.14", - "3.15", -] +depends = ["3.*"] dependency_groups = [ "test" ] commands = [ [ "coverage", "combine" ], @@ -131,7 +116,12 @@ commands = [ description = "lint code" dependency_groups = [ "lint" ] commands = [ - [ "ruff", "check", { replace = "posargs", default = [ "backoff", "tests", "docs" ], extend = true } ], + [ + "ruff", + "check", + { replace = "if", condition = "env.GITHUB_ACTIONS == 'true'", then = ["--output-format=github"], extend = true }, + { replace = "posargs", default = [ "backoff", "tests", "docs" ], extend = true }, + ], ] [tool.tox.env.typing] @@ -155,16 +145,6 @@ commands = [ [ "zensical", { replace = "posargs", default = [ "build" ], extend = true } ], ] -[tool.tox.gh.python] -"3.15" = ["3.15"] -"3.14" = ["3.14", "lint", "typing"] -"3.13" = ["3.13"] -"3.12" = ["3.12"] -"3.11" = ["3.11"] -"3.10" = ["3.10"] -"3.9" = ["3.9"] -"3.8" = ["3.8"] - [tool.pytest.ini_options] filterwarnings = [ "error", @@ -181,7 +161,6 @@ extend-include = ["docs/**/*.md"] line-length = 88 preview = true required-version = ">=0.15.2" -target-version = "py38" [tool.ruff.format] docstring-code-format = true