Skip to content

Commit fd39fb9

Browse files
committed
adding github workflows for documentation and tests
1 parent ad63eb3 commit fd39fb9

File tree

11 files changed

+288
-2
lines changed

11 files changed

+288
-2
lines changed

.github/workflows/docs.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: docs
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- final_project
7+
8+
jobs:
9+
docs:
10+
name: Docs
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v3
17+
with:
18+
python-version: "3.10.16"
19+
20+
- name: Set up Python environment
21+
run: |
22+
python -m venv venv
23+
source venv/bin/activate
24+
25+
- name: Install dependencies
26+
run: |
27+
source venv/bin/activate
28+
python -m pip install .
29+
30+
- name: Generate documentation
31+
run: |
32+
source venv/bin/activate
33+
cd docs
34+
make html
35+
36+
- name: Upload documentation
37+
if: success()
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: documentation
41+
path: docs/html/
42+
43+
- name: Deploy
44+
if: success() && github.ref == 'refs/heads/main'
45+
uses: peaceiris/actions-gh-pages@v3
46+
with:
47+
github_token: ${{ secrets.GITHUB_TOKEN }}
48+
publish_dir: docs/html
49+
allow_empty_commit: true

.github/workflows/formatter.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Testing using Black formatter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- final_project
8+
9+
jobs:
10+
linter:
11+
name: runner / black
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: "3.10.16"
20+
21+
- name: Set up Python environment
22+
run: |
23+
python -m venv venv
24+
source venv/bin/activate
25+
26+
- name: Install dependencies
27+
run: |
28+
source venv/bin/activate
29+
python -m pip install black
30+
31+
- name: Check using Black
32+
run: |
33+
source venv/bin/activate
34+
python -m black --check .

.github/workflows/tests.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Testing"
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "final_project"
8+
9+
jobs:
10+
docs:
11+
name: Testing using pytest
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: "3.10.16"
20+
21+
- name: Set up Python environment
22+
run: |
23+
python -m venv venv
24+
source venv/bin/activate
25+
26+
- name: Install dependencies
27+
run: |
28+
source venv/bin/activate
29+
python -m pip install .
30+
31+
- name: Test with pytest
32+
run: |
33+
source venv/bin/activate
34+
python -m pytest

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,9 @@ cython_debug/
173173
# .dat and .data
174174
*.dat
175175
*.data
176+
177+
# temporary folders used for profiling
178+
tmp_data/*
179+
180+
# for documentation
181+
docs/_*

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DEFAULT_GOAL := help # default behaviour
2+
3+
help:
4+
@echo "To perform tests and format the code properly, activate the desired environment and type 'make all'"
5+
6+
tests:
7+
@echo "Running tests with pytest..."
8+
python -m pip install .
9+
python -m pytest -v
10+
11+
docs:
12+
@echo "Building documentation..."
13+
cd docs && make html
14+
15+
format:
16+
@echo "Formatting code with black..."
17+
python -m black .
18+
19+
all: tests docs format
20+
@echo "Tests completed, documentation generated, and code formatted."
21+

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Name: Lorenzo Tomada
2-
email: ltomada@sissa.it
1+
Names: Lorenzo Tomada, Gaspare Li Causi
2+
email: ltomada@sissa.it, glicausi@sissa.it

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/conf.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
project = "final_project"
10+
copyright = "2025, Gaspare Li Causi, Lorenzo Tomada"
11+
author = "Gaspare Li Causi, Lorenzo Tomada"
12+
release = "0.0.1"
13+
14+
# -- General configuration ---------------------------------------------------
15+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
16+
17+
extensions = []
18+
19+
templates_path = ["_templates"]
20+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
21+
22+
23+
# -- Options for HTML output -------------------------------------------------
24+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
25+
26+
html_theme = "alabaster"
27+
html_static_path = ["_static"]

docs/index.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. final_project documentation master file, created by
2+
sphinx-quickstart on Thu Feb 27 11:10:21 2025.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
final_project documentation
7+
===========================
8+
9+
Welcome to the documentation for the final project of the course in Development Tools for Scientific Computing.
10+
We are currently working on the project and on the documentation.
11+
Stay tuned!
12+
13+
Add your content using ``reStructuredText`` syntax. See the
14+
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
15+
documentation for details.
16+
17+
18+
.. toctree::
19+
:maxdepth: 2
20+
:caption: Contents:

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

0 commit comments

Comments
 (0)