code formatting updates to match changes in black requirements #277
Workflow file for this run
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
name: tests+pypi | |
defaults: | |
run: | |
shell: bash | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: '0 13 * * 4' | |
release: | |
types: [published] | |
jobs: | |
precommit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: "3.10" | |
- run: | | |
pip install pre-commit | |
pre-commit clean | |
pre-commit autoupdate | |
pre-commit run --all-files | |
nojit_and_codecov: | |
runs-on: ubuntu-latest | |
env: | |
NUMBA_DISABLE_JIT: 1 | |
steps: | |
- uses: actions/checkout@master | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@master | |
with: | |
python-version: 3.9 | |
- name: Generate coverage report | |
run: | | |
pip install -e .[tests] ./examples | |
pip install pytest-cov | |
pytest --durations=10 -We tests/unit_tests --cov-report=xml --cov=PyMPDATA | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: true | |
verbose: true | |
pylint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
# TODO #411 https://github.com/pylint-dev/pylint/issues/9099 | |
pip install "pylint<3.0.0" nbqa pdoc3 # (pdoc3 for checking the .github/workflows/pdoc_index_workaround.py) | |
pip install -e .[tests] ./examples[tests] | |
- run: | | |
pylint --max-module-lines=500 --disable=fixme $(git ls-files '*.py' | grep -v ^examples) | |
- run: | | |
# TODO #299 | |
pylint --disable=fixme --max-module-lines=200 \ | |
--disable=too-many-locals,too-many-branches,duplicate-code,invalid-name,missing-function-docstring,missing-module-docstring,too-many-arguments,missing-class-docstring,too-many-instance-attributes $(git ls-files '*.py' | grep ^examples) | |
- run: | | |
# TODO #299 | |
nbqa pylint --disable=fixme,trailing-whitespace,wrong-import-position,wrong-import-order,ungrouped-imports \ | |
--disable=duplicate-code,invalid-name,missing-module-docstring,line-too-long,missing-function-docstring,redefined-outer-name,too-many-arguments,no-member,too-many-locals,cell-var-from-loop,missing-class-docstring $(git ls-files '*.ipynb') | |
pdoc: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
persist-credentials: false | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- env: | |
JUPYTER_PLATFORM_DIRS: 1 | |
run: | | |
pip3 install pdoc3 | |
pip install -e . ./examples | |
python -We -m pdoc --html PyMPDATA examples/PyMPDATA_examples | |
python -We .github/workflows/pdoc_index_workaround.py | |
- if: ${{ github.ref == 'refs/heads/main' && matrix.platform == 'ubuntu-latest' }} | |
uses: JamesIves/github-pages-deploy-action@4.1.1 | |
with: | |
BRANCH: pdoc | |
FOLDER: html | |
CLEAN: true | |
zenodo_json: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: notiz-dev/github-action-json-property@release | |
with: | |
path: '.zenodo.json' | |
prop_path: 'creators' | |
tests: | |
timeout-minutes: 120 | |
needs: [nojit_and_codecov, pylint, pdoc, precommit, zenodo_json] | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.8", "3.11"] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: | | |
pip install -e . | |
- run: | | |
python -We -c "import PyMPDATA" | |
- run: | | |
pip install -e .[tests] ./examples | |
# https://github.com/numba/numba/issues/6350#issuecomment-728174860 | |
- if: startsWith(matrix.platform, 'ubuntu-') | |
run: echo NUMBA_THREADING_LAYER=omp >> $GITHUB_ENV | |
- env: | |
NUMBA_OPT: 1 | |
run: | | |
pytest --durations=10 -p no:unraisableexception -We tests/unit_tests | |
pytest --durations=10 -p no:unraisableexception -We -k "not test_timing_3d" tests/smoke_tests | |
- env: | |
NUMBA_OPT: 3 | |
run: | | |
pytest --durations=10 -p no:unraisableexception -We -k "test_timing_3d" tests/smoke_tests | |
examples: | |
needs: [pylint, precommit] | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.8", "3.11"] | |
fail-fast: false | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: pip install -e .[tests] ./examples | |
- run: pip install -r tests/devops_tests/requirements.txt | |
- if: matrix.platform == 'ubuntu-latest' | |
run: | | |
sudo apt-get install libblitz0-dev libboost-thread-dev libboost-date-time-dev libboost-system-dev libboost-iostreams-dev libboost-timer-dev libboost-filesystem-dev | |
git clone https://github.com/igfuw/libmpdataxx.git | |
cd libmpdataxx/libmpdata++ | |
mkdir build | |
cd build | |
cmake .. | |
sudo make install | |
cd ../../../ | |
rm -rf libmpdataxx | |
# https://github.com/numba/numba/issues/6350#issuecomment-728174860 | |
- if: matrix.platform == 'ubuntu-latest' | |
run: echo NUMBA_THREADING_LAYER=omp >> $GITHUB_ENV | |
- env: | |
NUMBA_OPT: 1 | |
run: pytest --durations=10 -p no:unraisableexception -We tests/devops_tests/test_notebooks.py | |
devops: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480 | |
- run: pip install -r tests/devops_tests/requirements.txt | |
- run: pip install -e . ./examples | |
- env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: pytest --durations=10 -v -s -We -p no:unraisableexception -k "not run_notebooks" tests/devops_tests | |
dist: | |
strategy: | |
matrix: | |
package-dir: [".", "examples"] | |
fail-fast: false | |
runs-on: ubuntu-latest | |
needs: [tests, examples, devops] | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- run: pip install twine build | |
- run: | | |
unset CI | |
cd ${{ matrix.package-dir }} | |
python -m build 2>&1 | tee build.log | |
exit `fgrep -v "warning: no previously-included files matching" buid.log | fgrep -i warning | wc -l` | |
twine check --strict dist/* | |
exit `tar tzf dist/*.tar.gz | fgrep ".ipynb" | wc -l` | |
cd .. | |
- if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: pypa/gh-action-pypi-publish@unstable/v1 | |
with: | |
repository_url: https://test.pypi.org/legacy/ | |
packages-dir: ${{ matrix.package-dir }}/dist | |
- if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@unstable/v1 | |
with: | |
packages-dir: ${{ matrix.package-dir }}/dist | |