-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from JakobEliasWagner/wip-inital-setup
Wip inital setup
- Loading branch information
Showing
17 changed files
with
285 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: CI | ||
|
||
on: [ push ] | ||
|
||
jobs: | ||
hooks: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
architecture: 'x64' | ||
- name: Display Python version | ||
run: python -c "import sys; print(sys.version)" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
test: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
architecture: 'x64' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Test with pytest and build coverage reports | ||
run: | | ||
pytest test --cov=src --cov-report=html:codecov --cov-report=json | ||
- name: Upload coverage data | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: covdata | ||
path: | | ||
coverage.json | ||
- name: package coverage report | ||
run: | | ||
zip -r coverage_report.zip codecov | ||
- name: Upload coverage report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: covdata-html | ||
path: coverage_report.zip | ||
|
||
|
||
coverage-reports: | ||
name: coverage | ||
needs: test | ||
if: ${{ github.ref == 'refs/heads/master' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
name: Checkout | ||
- name: Download coverage data | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: covdata | ||
- name: Download coverage report | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: covdata-html | ||
- name: Unpack coverage report and move into sphinx | ||
run: | | ||
unzip coverage_report.zip | ||
mv codecov doc/source/_static/codecov | ||
- name: build website for detailed coverage | ||
run: | | ||
pip install sphinx | ||
sphinx-build -M html doc/source doc/build | ||
- name: deploy website | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
publish_branch: deployed-pages | ||
github_token: ${{ secrets.DEPLOY_TOKEN }} | ||
publish_dir: doc/build/html/ | ||
force_orphan: true | ||
- name: Create json for badge | ||
run: | | ||
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") | ||
echo "total=$TOTAL" >> $GITHUB_ENV | ||
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY | ||
- name: Make badge | ||
uses: schneegans/[email protected] | ||
with: | ||
auth: ${{ secrets.GIST_TOKEN }} | ||
gistID: 715271f51dd7b16c37fcf84c79dcb31a | ||
filename: covbadge.json | ||
label: Coverage | ||
message: ${{ env.total }}% | ||
minColorRange: 50 | ||
maxColorRange: 95 | ||
valColorRange: ${{ env.total }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.3.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: check-case-conflict | ||
- id: check-merge-conflict | ||
- id: no-commit-to-branch | ||
- repo: https://github.com/psf/black | ||
rev: 22.10.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 3.9.2 | ||
hooks: | ||
- id: flake8 | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
- id: isort | ||
name: isort (cython) | ||
types: [ cython ] | ||
- id: isort | ||
name: isort (pyi) | ||
types: [ pyi ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,32 @@ | ||
# Neural-Operators | ||
# Neural-Operators | ||
*Master's Thesis by Jakob Wagner* | ||
|
||
[![Python 3.8](https://img.shields.io/badge/Python-3.11-blue)](https://www.python.org/downloads/release/python-3110/) | ||
[![Code Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/JakobEliasWagner/715271f51dd7b16c37fcf84c79dcb31a/raw/e1ecebc4ebfaac81fe3225be6d84ebe1069231c2/covbadge.json)](https://jakobeliaswagner.github.io/Neural-Operators/_static/codecov/index.html) | ||
[![Documentation](https://img.shields.io/badge/Documentation-FF7043)](https://jakobeliaswagner.github.io/Neural-Operators/index.html) | ||
[![Linkedin](https://img.shields.io/badge/-LinkedIn-blue?style=flat&logo=linkedin)](https://www.linkedin.com/in/jakob-wagner-65b9871a9/) | ||
|
||
## Setup | ||
I recommend setting up a python venv. | ||
|
||
Install the required packages and libraries | ||
```shell | ||
pip install -r requirements.txt | ||
``` | ||
|
||
## Hooks | ||
Install the pre-commit package manager: | ||
```shell | ||
pip install pre-commit | ||
``` | ||
Install the git hook scripts | ||
```shell | ||
pre-commit install | ||
``` | ||
now `pre-commit` will run automatically on `git commit `. | ||
|
||
## Tests | ||
Run tests | ||
```shell | ||
pytest test/ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = source | ||
BUILDDIR = build | ||
|
||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=source | ||
set BUILDDIR=build | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.abspath(os.path.join("..", "..", "src"))) | ||
|
||
# -- Project information ----------------------------------------------------- | ||
project = "Neural Operators" | ||
copyright = "2023, Jakob Wagner" | ||
author = "Jakob Wagner" | ||
|
||
# -- General configuration --------------------------------------------------- | ||
extensions = ["sphinx.ext.autodoc"] | ||
|
||
templates_path = ["_templates"] | ||
exclude_patterns = [] | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
html_theme = "alabaster" | ||
html_static_path = ["_static"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Code Coverage | ||
============= | ||
|
||
For an in detail report on the code coverage `click here <_static/codecov/index.html>`_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Neural Operators | ||
============================================ | ||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[tool.black] | ||
line-length = 79 | ||
|
||
[tool.isort] | ||
profile = "black" | ||
multi_line_output = 3 | ||
include_trailing_comma = true | ||
force_grid_wrap = 0 | ||
use_parentheses = true | ||
ensure_newline_before_comments = true | ||
line_length = 79 | ||
skip_glob = [".github/*", ".idea/*", ".pytest_cache/*", "data/*", "docs/*", "models/*", "venv/*"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pre-commit | ||
pytest | ||
pytest-cov |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def tmp_dummy_function(x: int, y: int) -> int: | ||
return x + y |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from src.dummy import tmp_dummy_function | ||
|
||
|
||
def test_dummy_function(): | ||
assert tmp_dummy_function(1, 2) == 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def test_assert_true(): | ||
""" | ||
Make sure pytest is running correctly | ||
:return: | ||
""" | ||
assert True |