-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First version for CI, similar to pymeasure.
- Loading branch information
1 parent
1734a92
commit eae0d44
Showing
8 changed files
with
246 additions
and
10 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,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 | ||
} | ||
] | ||
} | ||
] | ||
} |
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,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 | ||
} | ||
] | ||
} | ||
] | ||
} |
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,105 @@ | ||
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: Cache conda | ||
uses: actions/cache@v3 | ||
env: | ||
CACHE_NUMBER: 0 # Increase to reset the cache | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: py3.10-ubuntu-latest-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} | ||
- name: Install pyleco requirements | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
python-version: "3.10" | ||
environment-file: environment.yml | ||
activate-environment: pyleco | ||
auto-update-conda: true | ||
use-only-tar-bz2: true # for caching to work properly | ||
- name: Conda info & list | ||
run: | | ||
conda info | ||
conda list | ||
- name: Set up flake8 annotations | ||
uses: rbialon/flake8-annotations@v1 | ||
- name: Lint with flake8 | ||
run: | | ||
# Be sure to check for Python syntax errors or undefined names | ||
flake8 . --count --extend-select=E9,F63,F7,F82 --show-source --statistics | ||
- 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" | ||
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: Cache conda | ||
uses: actions/cache@v3 | ||
env: | ||
CACHE_NUMBER: 0 # Increase to reset the cache | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: py${{ matrix.python-version }}-${{ matrix.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml') }} | ||
- name: Install pyleco requirements | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
environment-file: environment.yml | ||
activate-environment: pyleco | ||
auto-update-conda: true | ||
use-only-tar-bz2: true # for caching to work properly | ||
- name: Install Pyleco | ||
# If the pytest problem matcher stops working because of bad paths, do an editable install | ||
run: pip install .[tests] | ||
- name: Pyleco version | ||
run: python -c "import pyleco;print(pyleco.__version__)" | ||
- name: Conda info & list | ||
run: | | ||
conda info | ||
conda list | ||
- 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 |
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 @@ | ||
###### | ||
PyLeco | ||
###### |
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,51 @@ | ||
# | ||
# This file is part of the PyLECO package. | ||
# | ||
# Copyright (c) 2023-2023 PyLECO Developers | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
# | ||
|
||
import warnings | ||
|
||
# Maximally flexible approach to obtain version numbers, based on this approach: | ||
# https://github.com/pypa/setuptools_scm/issues/143#issuecomment-672878863 | ||
# Sadly, this does not work with editable installs, which bake in version info on installation. | ||
# see also https://github.com/pyusb/pyusb/pull/307#issuecomment-650797688 | ||
try: | ||
# If a user has setuptools_scm installed, assume they want the most up to date version string. | ||
# Alternatively, we could use a dummy dev module that is never packaged whose presence signals | ||
# that we are in an editable install/repo, see https://github.com/pycalphad/pycalphad/pull/341 | ||
import setuptools_scm | ||
__version__ = setuptools_scm.get_version(root='..', relative_to=__file__) | ||
del setuptools_scm | ||
except (ImportError, LookupError): | ||
# Setuptools_scm was not found, or it could not find a version, so use installation metadata. | ||
from importlib.metadata import version, PackageNotFoundError | ||
try: | ||
__version__ = version("pyleco") | ||
# Alternatively, if the current approach is too slow, we could add | ||
# 'write_to = "pyleco/_version.py"' in pyproject.toml and use the generated file here: | ||
# from ._version import version as __version__ | ||
except PackageNotFoundError: | ||
warnings.warn('Could not find pyleco version, it does not seem to be installed. ' | ||
'Either install it (editable or full) or install setuptools_scm') | ||
__version__ = '0.0.0' | ||
finally: | ||
del version, PackageNotFoundError |
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,6 @@ | ||
[flake8] | ||
exclude = .git,__pycache__,docs/conf.py,build,dist | ||
max-line-length = 100 | ||
max-complexity = 15 | ||
per-file-ignores = | ||
__init__.py:F401 |