Merge pull request #373 from mcdavis62/tools #462
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: Unit Test nmma | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- 'doc/**' | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- 'doc/**' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- name: Checkout branch being tested | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Restore SVD models from cache | |
uses: actions/cache@v4 | |
with: | |
path: svdmodels | |
key: svdmodels-${{ runner.os }}-${{ hashFiles('**/LICENSE') }} | |
restore-keys: svdmodels-${{ runner.os }}- | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: pip cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-2-${{ hashFiles('**/pyproject.toml', '**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip-2- | |
save-always: true | |
- name: Install Linux Packages with caching | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: openmpi-bin libopenmpi-dev gfortran build-essential libblas3 libblas-dev liblapack3 liblapack-dev libatlas-base-dev texlive texlive-latex-extra texlive-fonts-recommended dvipng cm-super | |
execute_install_scripts: true | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y texlive texlive-latex-extra texlive-fonts-recommended dvipng cm-super | |
python -m pip install --upgrade git+https://github.com/bitranox/wrapt_timeout_decorator.git | |
python -m pip install pytest pytest-cov flake8 pytest-aiohttp sqlparse freezegun PyJWT joblib coveralls | |
python -m pip install -r ml_requirements.txt -r grb_requirements.txt | |
python -m pip install . | |
git clone https://github.com/JohannesBuchner/MultiNest && cd MultiNest/build && cmake .. && make && cd ../.. | |
pwd | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude docs | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude docs,versioneer.py,nmma/_version.py,nmma/tests,nmma/*/__init__.py | |
- name: Test with pytest | |
run: | | |
python -m coverage run --source nmma -m pytest nmma/tests/*.py | |
env: | |
LD_LIBRARY_PATH: .:/home/runner/work/nmma/nmma/MultiNest/lib # for Linux | |
- name: Run Coveralls | |
if: ${{ success() }} | |
run: | | |
coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |