diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 2a23e4e..7caac54 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -22,11 +22,11 @@ jobs: - name: Install coverage dependencies run: | - pip install -e ".[dev]" + pip install ".[dev]" pip install ".[coverage]" - name: Run coverage tests - run: nox -s coverage + run: make coverage - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a81e31c..3b38887 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,7 +22,7 @@ jobs: - name: Install test dependencies run: | - pip install -e ".[dev]" + pip install ".[dev]" - name: Lint with ruff - run: nox -s lint + run: make lint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a8b25f8..97f5b52 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,11 +20,7 @@ jobs: python-version: "3.*" - name: Install pypa/build - run: >- - python3 -m - pip install - build - --user + run: pip install ".[build]" - name: Build a binary wheel and a source tarball run: python3 -m build @@ -39,7 +35,8 @@ jobs: name: >- Publish Python 🐍 distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + # only publish to PyPI on tag pushes + if: startsWith(github.ref, 'refs/tags/') needs: - build runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d3cee50..dcee7a3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install test dependencies - run: pip install -e ".[dev]" + run: pip install ".[dev]" - name: Run tests - run: nox -s tests + run: make test diff --git a/noxfile.py b/noxfile.py deleted file mode 100644 index 74d174e..0000000 --- a/noxfile.py +++ /dev/null @@ -1,49 +0,0 @@ -import nox - -nox.options.sessions = ["tests", "lint"] - - -@nox.session -def tests(session: nox.Session) -> None: - """ - Run the unit and regular tests. - """ - session.install("-e.[dev]") - session.run("pytest") - - -@nox.session -def lint(session: nox.Session) -> None: - """ - Run lint with ruff. - """ - session.install("-e.[dev]") - session.run("ruff", "check", "brazilcep") - - -@nox.session -def coverage(session: nox.Session) -> None: - """ - Run coverage. - """ - session.install("-e.[coverage]") - session.run("pytest", "--cov", "brazilcep") - - -@nox.session -def check_manifest(session: nox.Session) -> None: - """ - Ensure all needed files are included in the manifest. - """ - - session.install("check-manifest") - session.run("check-manifest", *session.posargs) - - -@nox.session -def docs(session: nox.Session) -> None: - """ - Build the docs. Will serve unless --non-interactive - """ - session.install("-e.[docs]") - session.run("mkdocs", "serve" if session.interactive else "build") diff --git a/pyproject.toml b/pyproject.toml index ee88c68..811d82b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ dev = [ coverage = ["coveralls>=3.3.1", "pytest-cov>=4.0.0", "requests-mock>=1.10.0"] docs = ["mkdocs-material>=9.1.6", "mkdocs>=1.4.2"] +build = ["build==1.2.2.post1"] [project.urls] Documentation = "https://github.com/mstuttgart/brazilcep/tree/main#readme" diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..5e72f3b --- /dev/null +++ b/tox.ini @@ -0,0 +1,21 @@ +[tox] +requires = + tox>=4.2 +env_list = + pre-commit + python3.{13, 12, 11, 10, 9} +skip_missing_interpreters = true + +[testenv] +deps = + -e ".[dev]" +commands = + pytest + +[testenv:pre-commit] +base_python = python +deps = + pre-commit +commands = + pre-commit autoupdate + pre-commit run --all-files