diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..ea23730 --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,71 @@ +name: Test, build and publish package + +on: + push: + pull_request: + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + + steps: + - uses: actions/checkout@v6 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + - name: Install some dependencies for testing + run: python3 -m pip install flake8 flake8-bugbear flake8-import-order flake8-simplify flake8-bandit + - name: Install this plugin with pip, too + run: python3 -m pip install . + - name: Run tests + run: python3 -m unittest discover -s ./tests -v + + build: + name: Build a distribution package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.x" + - name: Install pypa/build + run: python3 -m pip install build --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v5 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: Publish to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + - test + runs-on: ubuntu-latest + + environment: + name: pypi + url: https://pypi.org/p/flake8-gl-codeclimate + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v6 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e5608e7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -language: python -env: - # 3.8.4 is shipped with Debian Bullseye - - FLAKE8_VERSION='3.8.*' - - FLAKE8_VERSION='4.*' - - FLAKE8_VERSION='5.*' - - FLAKE8_VERSION='6.*' -python: - - '3.9' -install: - - > - pip install - flake8==${FLAKE8_VERSION} - flake8-bugbear - flake8-import-order - flake8-logging-format - flake8-simplify - # Install flake8-bandit when not running 3.x or 4.x - - if ! flake8 --version | grep -E '^[34]\.[0-9]+\.[0-9]+ \('; then pip install flake8-bandit; fi -script: - - flake8 flake8_gl_codeclimate scripts tests - - pip install . - - python -m unittest discover -s ./tests -v - -jobs: - include: - - stage: deploy - script: echo "Deploying to pypi..." - deploy: - provider: pypi - user: awelzel - on: - tags: true - password: - secure: wE7XH0vbGHC2TzmyWv+CrLna5b+yixliwNLwjCCo2HUgVJdFqvdP3c+t1AeRHaaE+tcXoChMnG5eQfBg0WbsSh0hyGNyTBvDzrj36nBIFkvrvHpSah1ZTtFxBTbX8OI7BVmfepRYkxGcfOZrprFRFShBgVv3sqB9JvVOYfFaEVrZXmoPHBVk+7Wr5AksJTRzIRrGj2OuXOit9mmzumUBF8JAqtHvheEfmA4uJWPWP3VKEwNcnYV0isZBgTGE3K8ycaMWVd5no/EkIrbJqW+ZcnlGNGYfclBKVbFcxkx9Gz5Ho38mH9Cz1JEHcmP71vDKvm++Y7lcrQ+2pJWOk6fwtgdAxqcSioa2Rp2t/VCerO0sjO3Bn2M4HBCVxSqbasRmQnoiSGrNx0O0TZrA/jS+zomv/+HuBY70OZZygNGXQ/nsDiU/+30ZCKl+XunRJQiGYYyQksTJq4BvzWnvc3OChhhTEZzyZW1OecsXplfrxXamLC2VEHXm18lHBhssWFeSq7rocz1mFZVCNo8GcB50WeBQwKD+isllqSOaJTCahjkgHMcammyneuNQ/qP/NkJ6v+ve6S1UW0PSGW8MfLAxGLf+FQ3E2f+qZSp1q2cy0G1SddT3OX7WAg4KOfnGcuN5s3jWM5z1zsd71n8f4w7b3nMPDGeLJYxb0yw2F1C0IZE= diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2707a5d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +[build-system] +requires = ["setuptools >= 77.0.3", "setuptools_scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "flake8-gl-codeclimate" +description = "Gitlab Code Quality artifact Flake8 formatter" +authors = [ + {name = "Arne Welzel", email = "arne.welzel@gmail.com"}, +] +readme = "README.md" +license = "MIT" +license-files = ["LICENSE"] +dynamic = ["version"] +dependencies = [ + "flake8 >= 7.3.0", +] + +[project.entry-points."flake8.report"] +gl-codeclimate = "flake8_gl_codeclimate:GitlabCodeClimateFormatter" + +[tool.setuptools] +packages = ["flake8_gl_codeclimate"] + +[tool.setuptools_scm] diff --git a/setup.py b/setup.py index ba3ceef..8bf1ba9 100644 --- a/setup.py +++ b/setup.py @@ -1,28 +1,2 @@ -import setuptools - -setuptools.setup( - name="flake8-gl-codeclimate", - license="MIT", - use_scm_version=True, - description="Gitlab Code Quality artifact Flake8 formatter.", - author="Arne Welzel", - author_email="arne.welzel@gmail.com", - url="https://github.com/awelzel/flake8-gl-codeclimate", - packages=[ - "flake8_gl_codeclimate", - ], - install_requires=[ - "flake8 > 3.0.0", - ], - setup_requires=[ - "setuptools_scm", - ], - scripts=[ - "scripts/report-to-gl-codeclimate.py", - ], - entry_points={ - "flake8.report": [ - 'gl-codeclimate = flake8_gl_codeclimate:GitlabCodeClimateFormatter', - ], - } -) +from setuptools import setup +setup()