From fe995baed6e402b9283af2bdc251304b6b90d8d5 Mon Sep 17 00:00:00 2001 From: Yax Date: Sat, 5 Apr 2025 17:28:31 +0200 Subject: [PATCH] Remove coveralls.io and generate coverage badge locally --- .github/workflows/docker.yml | 29 ----------------------------- .github/workflows/pytest.yml | 29 ----------------------------- Makefile | 3 +++ README.md | 17 +++++++---------- coverage.svg | 21 +++++++++++++++++++++ pyproject.toml | 3 ++- src/stacosys/i18n/messages.py | 3 ++- uv.lock | 27 ++++++++++++++++++++++++++- 8 files changed, 61 insertions(+), 71 deletions(-) delete mode 100644 .github/workflows/docker.yml delete mode 100644 .github/workflows/pytest.yml create mode 100644 coverage.svg diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 11592ab..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: docker -on: - push: - branches: [ main ] -jobs: - build_docker: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - python-version: [3.13.1] - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Install the latest version of uv - uses: astral-sh/setup-uv@v4 - with: - version: "latest" - - name: Sync dependencies using uv - run: | - uv python pin ${{ matrix.python-version }} - uv sync - rm -rf build/* dist/* *.egg-info - uv build --wheel --out-dir dist - - name: Build the Docker image - run: | - echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin docker.io - docker build . --file Dockerfile --tag docker.io/${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.DOCKER_HUB_REPOSITORY }}:latest - docker push docker.io/${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.DOCKER_HUB_REPOSITORY }}:latest diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml deleted file mode 100644 index defd939..0000000 --- a/.github/workflows/pytest.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: pytest -on: push - -jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - python-version: [3.13.1] - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Install the latest version of uv - uses: astral-sh/setup-uv@v4 - with: - version: "latest" - - name: Sync dependencies using uv - run: | - uv python pin ${{ matrix.python-version }} - uv sync - - name: Pytest and Coverage - run: | - PYTHONPATH=src/ uv run coverage run -m --source=stacosys pytest tests - uv run coverage report - - name: Send report to Coveralls - run: uv run coveralls - env: - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} diff --git a/Makefile b/Makefile index 0650450..74573e7 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,7 @@ check: all test: PYTHONPATH=src/ uv run coverage run -m --source=stacosys pytest tests uv run coverage report + uv run coverage-badge -f -o coverage.svg # build build: @@ -35,6 +36,8 @@ build: uv sync uv build --wheel --out-dir dist docker build -t source.madyanne.fr/yax/stacosys . + +publish: docker push source.madyanne.fr/yax/stacosys # run diff --git a/README.md b/README.md index 160ab37..45be15e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ -To be updated. Moved to ~CodeBerg~ Zaclys - [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![Python version](https://img.shields.io/badge/Python-3.13-blue.svg)](https://www.python.org/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Flask version](https://img.shields.io/badge/Flask-3.1-green.svg)](https://flask.palletsprojects.com) -[![Build Status - pytest](https://github.com/kianby/stacosys/workflows/pytest/badge.svg)](https://github.com/kianby/stacosys) [![Coverage Status](https://coveralls.io/repos/github/kianby/stacosys/badge.svg?branch=main)](https://coveralls.io/github/kianby/stacosys?branch=main) [![Build status - docker image](https://github.com/kianby/stacosys/workflows/docker/badge.svg)](https://hub.docker.com/r/kianby/stacosys) +[![Build Status - pytest](https://github.com/kianby/stacosys/workflows/pytest/badge.svg)](https://github.com/kianby/stacosys) ![Coverage Status](https://gitea.zaclys.com/yannic/stacosys/coverage.svg) ## Stacosys @@ -47,17 +45,16 @@ Stacosys offers a REST API to retrieve and post comments. Static blog is HTML-ba ### Installation -Build and Dependency management relies on [Rye](https://rye-up.com/) but you can also use [Docker image](https://hub.docker.com/r/kianby/stacosys). +Build and Dependency management relies on [uv](https://docs.astral.sh/uv/) -Build executable with pyinstaller +Run tests and coverage + + make test + +Build docker image make build -Update dependencies and sync virtual env - - rye lock --update-all - rye sync - ### Improvements Stacosys fits my needs, and it manages comments on [my blog](https://blogduyax.madyanne.fr) for a while. I don't have any plan to make big changes, it's more a python playground for me. So I strongly encourage you to fork and enhance the project if you need additional features. diff --git a/coverage.svg b/coverage.svg new file mode 100644 index 0000000..6963b3e --- /dev/null +++ b/coverage.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + coverage + coverage + 87% + 87% + + diff --git a/pyproject.toml b/pyproject.toml index e59cc7c..85a93b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,7 @@ authors = [ requires-python = ">=3.13.1" dependencies = [ "background>=0.2.1", + "coverage-badge>=1.1.2", "flask>=3.1.0", "markdown>=3.7", "pydal>=20241204.1", @@ -38,4 +39,4 @@ packages = ["stacosys", "stacosys.db", "stacosys.i18n", "stacosys.interface", "s [build-system] requires = ["setuptools>=61.0"] -build-backend = "setuptools.build_meta" \ No newline at end of file +build-backend = "setuptools.build_meta" diff --git a/src/stacosys/i18n/messages.py b/src/stacosys/i18n/messages.py index 375506f..374d066 100644 --- a/src/stacosys/i18n/messages.py +++ b/src/stacosys/i18n/messages.py @@ -1,6 +1,7 @@ import configparser -import os import importlib.resources +import os + class Messages: def __init__(self): diff --git a/uv.lock b/uv.lock index afb15b0..aeef7a6 100644 --- a/uv.lock +++ b/uv.lock @@ -1,4 +1,5 @@ version = 1 +revision = 1 requires-python = ">=3.13.1" [[package]] @@ -86,7 +87,7 @@ name = "click" version = "8.1.7" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "platform_system == 'Windows'" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de", size = 336121 } wheels = [ @@ -130,6 +131,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/26/74/b0729f196f328ac55e42b1e22ec2f16d8bcafe4b8158a26ec9f1cdd1d93e/coverage-7.6.9-cp313-cp313t-win_amd64.whl", hash = "sha256:97ddc94d46088304772d21b060041c97fc16bdda13c6c7f9d8fcd8d5ae0d8611", size = 211815 }, ] +[[package]] +name = "coverage-badge" +version = "1.1.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "coverage" }, + { name = "setuptools" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/be/8f/e92b0a010c76b0da82709838b3f3ae9aec638d0c44dbfb1186a5751f5d2e/coverage_badge-1.1.2.tar.gz", hash = "sha256:fe7ed58a3b72dad85a553b64a99e963dea3847dcd0b8ddd2b38a00333618642c", size = 6335 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/90/3d/5642a1a06191b2e1e0f87a2e824e6d3eb7c32c589a68ed4d1dcbd3324d63/coverage_badge-1.1.2-py2.py3-none-any.whl", hash = "sha256:d8413ce51c91043a1692b943616b450868cbeeb0ea6a0c54a32f8318c9c96ff7", size = 6493 }, +] + [[package]] name = "coveralls" version = "4.0.1" @@ -408,12 +422,22 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6", size = 64928 }, ] +[[package]] +name = "setuptools" +version = "78.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a9/5a/0db4da3bc908df06e5efae42b44e75c81dd52716e10192ff36d0c1c8e379/setuptools-78.1.0.tar.gz", hash = "sha256:18fd474d4a82a5f83dac888df697af65afa82dec7323d09c3e37d1f14288da54", size = 1367827 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/54/21/f43f0a1fa8b06b32812e0975981f4677d28e0f3271601dc88ac5a5b83220/setuptools-78.1.0-py3-none-any.whl", hash = "sha256:3e386e96793c8702ae83d17b853fb93d3e09ef82ec62722e61da5cd22376dcd8", size = 1256108 }, +] + [[package]] name = "stacosys" version = "3.4" source = { editable = "." } dependencies = [ { name = "background" }, + { name = "coverage-badge" }, { name = "flask" }, { name = "markdown" }, { name = "pydal" }, @@ -435,6 +459,7 @@ dev = [ [package.metadata] requires-dist = [ { name = "background", specifier = ">=0.2.1" }, + { name = "coverage-badge", specifier = ">=1.1.2" }, { name = "flask", specifier = ">=3.1.0" }, { name = "markdown", specifier = ">=3.7" }, { name = "pydal", specifier = ">=20241204.1" },