Remove coveralls.io and generate coverage badge locally

This commit is contained in:
Yax 2025-04-05 17:28:31 +02:00
parent 030fd258d0
commit fe995baed6
8 changed files with 61 additions and 71 deletions

View file

@ -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

View file

@ -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 }}

View file

@ -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

View file

@ -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.

21
coverage.svg Normal file
View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="99" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<mask id="a">
<rect width="99" height="20" rx="3" fill="#fff"/>
</mask>
<g mask="url(#a)">
<path fill="#555" d="M0 0h63v20H0z"/>
<path fill="#a4a61d" d="M63 0h36v20H63z"/>
<path fill="url(#b)" d="M0 0h99v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="31.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
<text x="31.5" y="14">coverage</text>
<text x="80" y="15" fill="#010101" fill-opacity=".3">87%</text>
<text x="80" y="14">87%</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 904 B

View file

@ -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"
build-backend = "setuptools.build_meta"

View file

@ -1,6 +1,7 @@
import configparser
import os
import importlib.resources
import os
class Messages:
def __init__(self):

27
uv.lock generated
View file

@ -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" },