Skip to content

Commit d19ebaf

Browse files
author
Tom Softreck
committed
ci: Add CI/CD, Codecov, and Read the Docs configuration
1 parent b6ea3e2 commit d19ebaf

File tree

5 files changed

+171
-0
lines changed

5 files changed

+171
-0
lines changed

.github/workflows/ci.yml

Whitespace-only changes.

.github/workflows/deploy.yml

Whitespace-only changes.

.github/workflows/gh-pages.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: '3.11'
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install \
35+
mkdocs-material \
36+
mkdocs-awesome-pages-plugin \
37+
mkdocs-minify-plugin \
38+
mkdocstrings[python] \
39+
mkdocs-material-extensions \
40+
pygments
41+
42+
- name: Build documentation
43+
run: |
44+
# Clean any previous build
45+
rm -rf site public
46+
47+
# Build documentation with verbose output
48+
mkdocs build --verbose --strict || { echo "❌ mkdocs build failed"; exit 1; }
49+
50+
# Create public directory and move site contents
51+
mkdir -p public
52+
cp -r site/. public/
53+
54+
# Add CNAME for GitHub Pages
55+
echo 'taskprovision.github.io' > public/CNAME
56+
57+
# Verify the build output
58+
if [ ! -d "public" ] || [ -z "$(ls -A public)" ]; then
59+
echo "❌ Build failed: public directory is empty or missing"
60+
ls -la
61+
exit 1
62+
fi
63+
64+
echo "✅ Build completed successfully"
65+
echo "Build contents:"
66+
ls -la public/
67+
68+
- name: Setup Pages
69+
uses: actions/configure-pages@v4
70+
71+
- name: Upload artifact
72+
uses: actions/upload-pages-artifact@v3
73+
with:
74+
path: ./public
75+
retention-days: 1
76+
77+
deploy:
78+
environment:
79+
name: github-pages
80+
url: ${{ steps.deployment.outputs.page_url }}
81+
runs-on: ubuntu-latest
82+
needs: build
83+
if: github.ref == 'refs/heads/main'
84+
steps:
85+
- name: Deploy to GitHub Pages
86+
id: deployment
87+
uses: actions/deploy-pages@v4

.github/workflows/pypi.yml

Whitespace-only changes.

.github/workflows/tests.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 0 * * 0' # Weekly on Sundays
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
jobs:
16+
test:
17+
name: Test on Python ${{ matrix.python-version }}
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: ['3.9', '3.10', '3.11', '3.12']
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
cache: 'pip'
31+
cache-dependency-path: '**/pyproject.toml'
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install -e .[dev]
37+
38+
- name: Run tests with coverage
39+
run: |
40+
pip install pytest-cov
41+
pytest --cov=taskprovision --cov-report=xml --cov-report=term-missing tests/
42+
env:
43+
PYTHONPATH: ${{ github.workspace }}
44+
45+
- name: Upload coverage to Codecov
46+
uses: codecov/codecov-action@v4
47+
with:
48+
token: ${{ secrets.CODECOV_TOKEN }}
49+
file: ./coverage.xml
50+
flags: unittests
51+
name: codecov-umbrella
52+
fail_ci_if_error: false
53+
54+
lint:
55+
name: Lint with pre-commit
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v4
59+
- uses: actions/setup-python@v5
60+
with:
61+
python-version: '3.12'
62+
- uses: pre-commit/action@v3.0.0
63+
- name: Run pre-commit
64+
run: pre-commit run --all-files
65+
66+
build:
67+
name: Build package
68+
needs: [test, lint]
69+
runs-on: ubuntu-latest
70+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
71+
steps:
72+
- uses: actions/checkout@v4
73+
- uses: actions/setup-python@v5
74+
with:
75+
python-version: '3.12'
76+
- name: Build package
77+
run: |
78+
python -m pip install --upgrade pip build
79+
python -m build
80+
- name: Publish to PyPI
81+
uses: pypa/gh-action-pypi-publish@release/v1
82+
with:
83+
user: __token__
84+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)