Skip to content

Commit adf588c

Browse files
authored
Merge pull request #4 from max-models/2-publish-pages-on-merge-with-devel
Build docs in CI
2 parents bc99be5 + 7db4b8a commit adf588c

17 files changed

Lines changed: 414 additions & 266 deletions

.github/workflows/ci.yml

Lines changed: 0 additions & 116 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Deploy docs to GitHub Pages
2+
3+
# on:
4+
# push:
5+
# branches: ["devel", "main"] # TODO: Set to main only after release
6+
# workflow_dispatch:
7+
on:
8+
push:
9+
branches:
10+
- main
11+
- devel
12+
pull_request:
13+
branches:
14+
- main
15+
- devel
16+
17+
permissions:
18+
contents: read
19+
pages: write
20+
id-token: write
21+
22+
concurrency:
23+
group: "pages"
24+
cancel-in-progress: false
25+
26+
jobs:
27+
build-and-deploy:
28+
runs-on: ubuntu-latest
29+
environment:
30+
name: github-pages
31+
url: ${{ steps.deployment.outputs.page_url }}
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Install pandoc
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y pandoc
41+
42+
- name: Install Python dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install ".[docs]"
46+
47+
- name: Build Sphinx docs
48+
run: |
49+
cd docs
50+
make html
51+
52+
- name: Setup Pages
53+
uses: actions/configure-pages@v5
54+
55+
- name: Upload built docs
56+
uses: actions/upload-pages-artifact@v3
57+
with:
58+
path: docs/build/html/
59+
60+
- name: Deploy to GitHub Pages
61+
id: deployment
62+
uses: actions/deploy-pages@v4

.github/workflows/jekyll-gh-pages.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Static analysis
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- devel
8+
pull_request:
9+
branches:
10+
- main
11+
- devel
12+
13+
jobs:
14+
static-analysis:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout the code
18+
uses: actions/checkout@v4
19+
20+
- name: Download and run cloc
21+
run: |
22+
curl -s https://raw.githubusercontent.com/AlDanial/cloc/master/cloc > cloc
23+
chmod +x cloc
24+
./cloc --version
25+
./cloc $(git ls-files)
26+
27+
- name: Code formatting with black
28+
run: |
29+
pip install black
30+
pip install "black[jupyter]"
31+
black --check src/
32+
black --check tutorials/
33+
34+
- name: Code formatting with isort
35+
run: |
36+
pip install isort
37+
isort --check src/
38+
isort --check tutorials/
39+
40+
- name: Code formatting with prospector
41+
continue-on-error: true
42+
run: |
43+
pip install mypy
44+
mypy src/
45+
46+
- name: Code formatting with prospector
47+
continue-on-error: true
48+
run: |
49+
pip install prospector
50+
prospector src/
51+
52+
- name: Code formatting with ruff
53+
continue-on-error: true
54+
run: |
55+
pip install ruff
56+
ruff check src/
57+
58+
- name: Code formatting with pylint
59+
continue-on-error: true
60+
run: |
61+
pip install pylint
62+
pylint src/

.github/workflows/testing.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- devel
8+
pull_request:
9+
branches:
10+
- main
11+
- devel
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
# Checkout the repository
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
22+
# Set up Python
23+
- name: Set up Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: '3.10' # Adjust as needed
27+
28+
# Cache pip dependencies
29+
- name: Cache pip
30+
uses: actions/cache@v3
31+
with:
32+
path: ~/.cache/pip
33+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pip-
36+
37+
- name: Install dependencies
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y pandoc
41+
42+
- name: Install project
43+
run: |
44+
pip install --upgrade pip
45+
pip install ".[dev]"
46+
47+
- name: Check installation
48+
run: |
49+
template-python
50+
51+
- name: Run tests
52+
run: |
53+
pytest .
54+
55+
- name: Test tutorials
56+
run: |
57+
jupyter nbconvert --to notebook --execute tutorials/*.ipynb --output-dir=/tmp --ExecutePreprocessor.timeout=300
58+
59+
- name: Test docs build
60+
run: |
61+
pip install ".[docs]"
62+
cd docs
63+
make clean
64+
make html
65+
cd ..
66+
ls docs/build/html/index.html

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0 # Use the latest stable version
4+
hooks:
5+
- id: check-added-large-files # Prevent giant files from being committed.
6+
args: ["--maxkb=1000"]
7+
- id: check-merge-conflict # Check for files that contain merge conflict strings.
8+
- id: check-toml # Attempts to load all TOML files to verify syntax.
9+
- id: check-yaml # Attempts to load all yaml files to verify syntax.
10+
args: ["--unsafe"]
11+
12+
- repo: https://github.com/kynan/nbstripout
13+
rev: 0.8.1
14+
hooks:
15+
- id: nbstripout # remove jupyter notebook cell output

0 commit comments

Comments
 (0)