Skip to content

Commit 7ff70ea

Browse files
author
Gunther Klessinger
committed
github action renovate
1 parent 06ed404 commit 7ff70ea

6 files changed

Lines changed: 183 additions & 110 deletions

File tree

.github/workflows/ci.yml

Lines changed: 143 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,166 @@
1-
name: ci
1+
name: CI
22

33
on:
44
push:
55
branches:
6+
- main
67
- master
78
pull_request:
89
branches:
10+
- main
911
- master
1012

11-
defaults:
12-
run:
13-
shell: bash
14-
1513
env:
1614
LANG: "en_US.utf-8"
1715
LC_ALL: "en_US.utf-8"
18-
POETRY_VIRTUALENVS_IN_PROJECT: "true"
1916
PYTHONIOENCODING: "UTF-8"
20-
PROJECT: "docutools"
21-
MC: "/home/runner/miniconda3"
22-
PATH: "$(MC)/bin:/home/runner/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:"
23-
conda_project_tools: "tmux poetry graphviz imagemagick"
24-
versioning: calver # for git-changelog
2517

2618
jobs:
27-
tests:
28-
name: Tests (${{ matrix.python-version }}, ${{ matrix.os }})
29-
runs-on: ${{ matrix.os }}
19+
test:
20+
name: Tests (Python ${{ matrix.python-version }})
21+
runs-on: ubuntu-latest
3022
strategy:
3123
fail-fast: false
32-
max-parallel: 6
3324
matrix:
34-
os: ["ubuntu-latest"]
35-
python-version: ["3.7", "3.8"]
25+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Install system dependencies
32+
run: |
33+
sudo apt-get update
34+
sudo apt-get install -y graphviz imagemagick
35+
36+
- name: Set up Python ${{ matrix.python-version }}
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
41+
- name: Install uv
42+
uses: astral-sh/setup-uv@v4
43+
with:
44+
version: "latest"
45+
46+
- name: Install just
47+
uses: extractions/setup-just@v2
48+
with:
49+
just-version: "latest"
50+
51+
- name: Install dependencies
52+
run: uv sync
53+
54+
- name: Run tests with coverage
55+
run: |
56+
uv run coverage run --rcfile=config/coverage.pytest.ini -m pytest tests -c config/pytest.ini
57+
uv run coverage combine
58+
uv run coverage report --precision=2
59+
uv run coverage xml
60+
61+
- name: Upload coverage to Codecov
62+
uses: codecov/codecov-action@v4
63+
with:
64+
file: ./coverage.xml
65+
fail_ci_if_error: false
66+
67+
docs:
68+
name: Build and Deploy Documentation
69+
runs-on: ubuntu-latest
70+
needs: test
71+
# Only run on main/master branch pushes
72+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
3673

3774
steps:
38-
- uses: actions/checkout@v2
75+
- name: Checkout code
76+
uses: actions/checkout@v4
77+
with:
78+
fetch-depth: 0 # Fetch all history for git-changelog
79+
80+
- name: Install system dependencies
81+
run: |
82+
sudo apt-get update
83+
sudo apt-get install -y graphviz imagemagick
3984
40-
- name: Set up the Miniconda Root Cache
41-
uses: actions/cache@v2
42-
env:
43-
cache_name: miniconda-root-2
85+
- name: Set up Python
86+
uses: actions/setup-python@v5
4487
with:
45-
path: ~/miniconda3
46-
key: ${{ runner.os }}-build-${{ env.cache_name }}
47-
- name: Install Miniconda Root
48-
shell: bash -l {0}
49-
run: "source ./make && make ci-conda-root-env"
50-
- name: Conda info
51-
shell: bash -l {0}
52-
run: conda info
53-
54-
- name: Set up the Miniconda Envs Cache
55-
# they delete unused ones after 7 days.
56-
uses: actions/cache@v2
57-
env:
58-
cache_name: miniconda-envs-3-${{ env.PROJECT }}_py${{ matrix.python-version }}_${{ hashFiles('pyproject.toml', 'scripts/**') }}
88+
python-version: "3.11"
89+
90+
- name: Install uv
91+
uses: astral-sh/setup-uv@v4
92+
with:
93+
version: "latest"
94+
95+
- name: Install just
96+
uses: extractions/setup-just@v2
97+
with:
98+
just-version: "latest"
99+
100+
- name: Install dependencies
101+
run: uv sync
102+
103+
- name: Build documentation
104+
run: just docs
105+
106+
- name: Deploy to GitHub Pages
107+
uses: peaceiris/actions-gh-pages@v4
108+
with:
109+
github_token: ${{ secrets.GITHUB_TOKEN }}
110+
publish_dir: ./site
111+
cname: ${{ vars.DOCS_CNAME }} # Optional: set this in repository variables if you have a custom domain
112+
113+
coverage-badge:
114+
name: Update Coverage Badge
115+
runs-on: ubuntu-latest
116+
needs: test
117+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
118+
119+
steps:
120+
- name: Checkout code
121+
uses: actions/checkout@v4
122+
123+
- name: Install system dependencies
124+
run: |
125+
sudo apt-get update
126+
sudo apt-get install -y graphviz imagemagick
127+
128+
- name: Set up Python
129+
uses: actions/setup-python@v5
130+
with:
131+
python-version: "3.11"
132+
133+
- name: Install uv
134+
uses: astral-sh/setup-uv@v4
135+
with:
136+
version: "latest"
137+
138+
- name: Install just
139+
uses: extractions/setup-just@v2
140+
with:
141+
just-version: "latest"
142+
143+
- name: Install dependencies
144+
run: uv sync
145+
146+
- name: Generate coverage report
147+
run: |
148+
uv run coverage run --rcfile=config/coverage.pytest.ini -m pytest tests -c config/pytest.ini
149+
uv run coverage combine
150+
uv run coverage report --precision=2 > coverage_report.txt
151+
152+
- name: Extract coverage percentage
153+
id: coverage
154+
run: |
155+
COVERAGE=$(grep "TOTAL" coverage_report.txt | awk '{print $4}' | sed 's/%//')
156+
echo "percentage=$COVERAGE" >> $GITHUB_OUTPUT
157+
158+
- name: Create coverage badge
159+
uses: schneegans/dynamic-badges-action@v1.7.0
59160
with:
60-
path: ~/miniconda3/envs/${{ env.PROJECT }}_py${{ matrix.python-version }}
61-
key: ${{ runner.os }}-build-${{ env.cache_name }}
62-
- name: Install Miniconda PyEnv
63-
shell: bash -l {0}
64-
env:
65-
pyver: "${{ matrix.python-version }}"
66-
run: "source ./make && make && make ci-conda-py-env"
67-
68-
- name: Run tests
69-
shell: bash -l {0}
70-
env:
71-
pyver: "${{ matrix.python-version }}"
72-
run: "source ./make -a && make tests"
73-
74-
- name: Test Docs LiterateProgramming
75-
shell: bash -l {0}
76-
env:
77-
pyver: "${{ matrix.python-version }}"
78-
run: "source ./make -a && make docs"
79-
- name: Deploy Docs
80-
shell: bash -l {0}
81-
env:
82-
pyver: "${{ matrix.python-version }}"
83-
run: "source ./make -a && ${{ env.pyver == '3.7' && 'mkdocs gh-deploy --force' || true }}"
161+
auth: ${{ secrets.GITHUB_TOKEN }}
162+
gistID: ${{ vars.COVERAGE_GIST_ID }} # Set this in repository variables
163+
filename: docutools-coverage.json
164+
label: Coverage
165+
message: ${{ steps.coverage.outputs.percentage }}%
166+
color: ${{ steps.coverage.outputs.percentage > 80 && 'green' || steps.coverage.outputs.percentage > 60 && 'yellow' || 'red' }}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# docutools
22

33
<!-- badges -->
4-
[![docs pages][docs pages_img]][docs pages] [![gh-ci][gh-ci_img]][gh-ci] [![pkg][pkg_img]][pkg] [![code_style][code_style_img]][code_style]
4+
[![docs pages][docs pages_img]][docs pages] [![gh-ci][gh-ci_img]][gh-ci] [![coverage][coverage_img]][coverage] [![pkg][pkg_img]][pkg]
55

66
[docs pages]: https://axiros.github.io/docutools
77
[docs pages_img]: https://axiros.github.io/docutools/img/badge_docs.svg
88
[gh-ci]: https://github.com/axiros/docutools/actions/workflows/ci.yml
99
[gh-ci_img]: https://github.com/axiros/docutools/actions/workflows/ci.yml/badge.svg
10+
[coverage]: https://github.com/axiros/docutools/actions/workflows/ci.yml
11+
[coverage_img]: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/YOUR_USERNAME/YOUR_GIST_ID/raw/docutools-coverage.json
1012
[pkg]: https://pypi.org/project/docutools/2022.04.11/
1113
[pkg_img]: https://axiros.github.io/docutools/img/badge_pypi.svg
1214
[code_style]: https://github.com/astral-sh/ruff

pyproject.toml

Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,48 @@ build-backend = "hatchling.build"
66
name = "docutools"
77
version = "2022.04.11"
88
description = "Documentation Tools for the Mkdocs Material Framework"
9-
authors = [
10-
{name = "Gunther Klessinger", email = "gkle_ss_ing_er@gmx.de"}
11-
]
12-
license = {text = "BSD 2-Clause Simplified License"}
9+
authors = [{ name = "Gunther Klessinger", email = "gkle_ss_ing_er@gmx.de" }]
10+
license = { text = "BSD 2-Clause Simplified License" }
1311
readme = "README.md"
1412
requires-python = ">=3.8"
1513
keywords = []
1614
classifiers = [
17-
"Development Status :: 4 - Beta",
18-
"License :: OSI Approved :: BSD License",
19-
"Programming Language :: Python :: 3",
20-
"Programming Language :: Python :: 3.8",
21-
"Programming Language :: Python :: 3.9",
22-
"Programming Language :: Python :: 3.10",
23-
"Programming Language :: Python :: 3.11",
24-
"Programming Language :: Python :: 3.12",
15+
"Development Status :: 4 - Beta",
16+
"License :: OSI Approved :: BSD License",
17+
"Programming Language :: Python :: 3",
18+
"Programming Language :: Python :: 3.8",
19+
"Programming Language :: Python :: 3.9",
20+
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: 3.11",
22+
"Programming Language :: Python :: 3.12",
2523
]
2624

2725
dependencies = [
28-
"pycond>=2.0.0",
29-
"anybadge>=1.7.0",
30-
"git-changelog",
31-
"httpx>=0.17.1",
32-
"markdown-include>=0.6.0",
33-
"markupsafe==2.0.1",
34-
"mkdocs>=1.1.2",
35-
"mkdocs-material>=8.0.0",
36-
"mkdocs-macros-plugin>=0.5.12",
37-
"mkdocs-exclude>=1.0.2",
38-
"mkdocs-pymdownx-material-extras>=1.1.3",
39-
"pytest>=6.0.1",
40-
"pytest-cov>=2.10.1",
41-
"pytest-randomly>=3.4.1",
42-
"pytest-sugar>=0.9.4",
43-
"pytest-xdist>=2.1.0",
44-
"toml>=0.10.1",
45-
"diagrams",
46-
"imagesize>=1.0.0",
47-
"inflection>=0.5.1",
48-
"coverage>=6.0.2",
26+
"pycond>=2.0.0",
27+
"anybadge>=1.7.0",
28+
"git-changelog",
29+
"httpx>=0.17.1",
30+
"markdown-include>=0.6.0",
31+
"markupsafe==2.0.1",
32+
"mkdocs>=1.1.2",
33+
"mkdocs-material>=8.0.0",
34+
"mkdocs-macros-plugin>=0.5.12",
35+
"mkdocs-exclude>=1.0.2",
36+
"mkdocs-pymdownx-material-extras>=1.1.3",
37+
"pytest>=6.0.1",
38+
"pytest-cov>=2.10.1",
39+
"pytest-randomly>=3.4.1",
40+
"pytest-sugar>=0.9.4",
41+
"pytest-xdist>=2.1.0",
42+
"toml>=0.10.1",
43+
"diagrams",
44+
"imagesize>=1.0.0",
45+
"inflection>=0.5.1",
46+
"coverage>=6.0.2",
4947
]
5048

5149
[project.optional-dependencies]
52-
dev = [
53-
"ruff>=0.1.0",
54-
"numpy>=1.0.0",
55-
"matplotlib>=3.0.0",
56-
"mypy>=0.900",
57-
]
50+
dev = ["ruff>=0.1.0", "numpy>=1.0.0", "matplotlib>=3.0.0", "mypy>=0.900"]
5851

5952
[project.urls]
6053
Repository = "https://github.com/axiros/docutools"
@@ -131,14 +124,10 @@ directory = "build/coverage/overall"
131124

132125
# Hatch configuration for package discovery
133126
[tool.hatch.build]
134-
include = [
135-
"src/lcdoc/**/*.py",
136-
]
127+
include = ["src/lcdoc/**/*.py"]
137128

138129
[tool.hatch.build.targets.wheel]
139130
packages = ["src/lcdoc"]
140131

141132
[dependency-groups]
142-
dev = [
143-
"matplotlib>=3.7.5",
144-
]
133+
dev = ["matplotlib>=3.0.0", "mypy>=1.14.1"]

uv.lock

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)