Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CI #7

Merged
merged 29 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e4c1d39
First version for CI, similar to pymeasure.
BenediktBurger Jul 12, 2023
c26b7e4
Add sphinx dependency and fix pyproject.toml dependency declaration.
BenediktBurger Jul 12, 2023
a56025a
conf.py added and message made python 3.10 compatible.
BenediktBurger Jul 12, 2023
6d3dd0d
Switching to mamba.
BenediktBurger Jul 13, 2023
6f989dd
Fixing mamba command.
BenediktBurger Jul 13, 2023
80762a9
Adding ruff.
BenediktBurger Jul 13, 2023
e6fe0e9
Fixing mamba and ruff configuration.
BenediktBurger Jul 13, 2023
141b659
Remove flake from CI and make ruff similar to previous flake configur…
BenediktBurger Jul 13, 2023
b301f65
Fix ruff (--show-source and --statistics exclude each other).
BenediktBurger Jul 13, 2023
2efd187
Add mypy.
BenediktBurger Jul 13, 2023
a497ccf
Test whether linting and mypy find errors.
BenediktBurger Jul 13, 2023
18e1d4b
Moving mypy to its own job.
BenediktBurger Jul 13, 2023
8b02176
Improve mypy testing.
BenediktBurger Jul 13, 2023
75c9d10
Revert introduced errors in message and test_message and fix more myp…
BenediktBurger Jul 13, 2023
e5ebaa7
Coverage added.
BenediktBurger Jul 13, 2023
86b116a
Fix coverage report.
BenediktBurger Jul 13, 2023
159e4f1
Add __init__.py for coverage.
BenediktBurger Jul 13, 2023
3d18efe
Exclude LECO definitions from coverage reports.
BenediktBurger Jul 13, 2023
77e1c20
Move (slow) code coverage to its own job.
BenediktBurger Jul 13, 2023
36a8af9
Improve coverage (and introduce a type error for mypy).
BenediktBurger Jul 14, 2023
f31d2aa
Revert introduced error to message and adding no cover to global init.
BenediktBurger Jul 14, 2023
6671f07
Fix python versions for tests.
BenediktBurger Jul 14, 2023
4967277
Update pyleco_CI.yml
BenediktBurger Jul 14, 2023
54c529c
Remove superfluos entry in CI file.
BenediktBurger Jul 19, 2023
50f3a68
Move Coordinator error codes to range with less conflicts.
BenediktBurger Jul 20, 2023
64a6a00
Change to pyleco developers.
BenediktBurger Jul 23, 2023
78799a8
rename to PyLECO
BenediktBurger Jul 23, 2023
4676ed6
Test with conda-forge instead of pip in CI.
BenediktBurger Jul 23, 2023
76f475b
Test different sphinx version.
BenediktBurger Jul 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/pytest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"problemMatcher": [
{
"owner": "pytest-warnings",
"severity": "warning",
"pattern": [
{
"regexp": "^=+ warnings summary =+$"
},
{
"regexp": "^(?<path>.+?):(?<line>\\d+)$",
"file": 1,
"line": 2
},
{
"regexp": "^ (?<message>.+)$",
"message": 1,
"loop": true
}
]
}
]
}
38 changes: 38 additions & 0 deletions .github/sphinx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"problemMatcher": [
{
"owner": "sphinx-docstring",
"pattern": [
{
"regexp": "^(?<path>.+?):(?<message>.*? (?<severity>WARNING|ERROR): .+)$",
"file": 1,
"severity": 3,
"message": 2
}
]
},
{
"owner": "sphinx-doctest",
"pattern": [
{
"regexp": "^File \\\"(?<path>.+?)\\\", line (?<line>\\d+|\\?), (?<msg>.*$)",
"file": 1,
"line": 2,
"message": 3
}
]
},
{
"owner": "sphinx-extension",
"pattern": [
{
"regexp": "^(?<severity>WARNING|ERROR): (?<code>\\S+): (?<message>.+)(?<dummy_file_entry>)$",
"severity": 1,
"code": 2,
"message": 3,
"file": 4
}
]
}
]
}
144 changes: 144 additions & 0 deletions .github/workflows/pyleco_CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: PyLECO CI
on:
push:
branches:
- main
pull_request:

jobs:
docs_lint:
name: Docs and Linting
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install pyleco requirements
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment-key: pylatest-ubuntu-latest-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python and Mamba version
run: |
python --version
micromamba info
- name: Lint with ruff
uses: chartboost/ruff-action@v1
with:
args: --extend-select=E9,F63,F7,F82 --show-source
- uses: ammaraskar/sphinx-problem-matcher@master
- name: Generate docs
if: always() # run even if the previous step failed
working-directory: ./docs
run: |
echo "::add-matcher::.github/sphinx.json"
make html SPHINXOPTS="-W --keep-going"
- name: Run doctests
if: always() # run even if the previous step failed
working-directory: ./docs
run: |
echo "::add-matcher::.github/sphinx.json"
make doctest SPHINXOPTS="-W --keep-going"
type_checking:
name: Static Type Checking
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install pyleco requirements
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment-key: pylatest-ubuntu-latest-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python version
run: python --version
- name: Install mypy
run: pip install mypy
- name: Run mypy
run: mypy .
test_coverage:
name: Code Coverage
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install pyleco requirements
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
cache-environment-key: pylatest-ubuntu-latest-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python version
run: python --version
- name: Install Pyleco
# If the pytest problem matcher stops working because of bad paths, do an editable install
run: pip install -e .[dev] # editable for covtest
- name: Test for Coverage
run: pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=pyleco | tee pytest-coverage.txt
- name: Pytest Coverage Comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
title: Coverage Report
badge-title: PyLECO Coverage
hide-badge: false
hide-report: false
create-new-comment: false
hide-comment: false
report-only-changed-files: false
remove-link-from-badge: false
unique-id-for-comment: python3.8
junitxml-path: ./pytest.xml
junitxml-title: Coverage Summary
test:
name: Python ${{ matrix.python-version }}, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install pyleco requirements
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
create-args: python=${{ matrix.python-version }}
cache-environment-key: py${{ matrix.python-version }}-${{ matrix.os }}-mamba-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }}
cache-downloads: false
- name: Python version
run: python --version
- name: Install Pyleco
# If the pytest problem matcher stops working because of bad paths, do an editable install
run: pip install .[dev]
- name: Pyleco version
run: python -c "import pyleco;print(pyleco.__version__)"
- name: Run pytest with xvfb
if: runner.os == 'Linux'
run: |
echo "::add-matcher::.github/pytest.json"
xvfb-run -a pytest
- name: Run pytest
if: runner.os != 'Linux'
run: |
echo "::add-matcher::.github/pytest.json"
pytest
bilderbuchi marked this conversation as resolved.
Show resolved Hide resolved
177 changes: 177 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"

clean:
rm -rf $(BUILDDIR)/*

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."

pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."

json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PyMeasure.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PyMeasure.qhc"

devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/PyMeasure"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PyMeasure"
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."

man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."

texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."

info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."

gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."

changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."

linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."

pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
Loading