run-tests-on-cuqipy-update #343
This file contains hidden or 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: pytest | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| repository_dispatch: # Triggered when CUQIpy updates via PyPI (runs only on main branch). | |
| types: [run-tests-on-cuqipy-update] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup Miniconda | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| auto-update-conda: true | |
| python-version: 3.8 | |
| miniforge-variant: Miniforge3 | |
| miniforge-version: latest | |
| - name: Conda info | |
| shell: bash -l {0} | |
| run: | | |
| conda info | |
| which python | |
| - name: Conda install FEniCS | |
| shell: bash -l {0} | |
| run: | | |
| conda config --set always_yes yes | |
| conda config --add channels conda-forge | |
| conda create -n fenicsproject -c conda-forge fenics | |
| conda activate fenicsproject | |
| which python | |
| python -c "from dolfin import *" | |
| - name: Install dependencies | |
| shell: bash -l {0} | |
| run: | | |
| conda activate fenicsproject | |
| python -m pip install --upgrade pip | |
| python -m pip install -r requirements.txt | |
| python -m pip install -r requirements-dev.txt | |
| - name: Install pre-release of CUQIpy # We install latest pre-release version of CUQIpy to catch upstream bugs early | |
| shell: bash -l {0} | |
| run: | | |
| conda activate fenicsproject | |
| python -m pip install cuqipy --pre --upgrade | |
| - name: Lint with flake8 | |
| shell: bash -l {0} | |
| run: | | |
| conda activate fenicsproject | |
| # stop the build if there are Python syntax errors or undefined names | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # 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 | |
| - name: Test with pytest | |
| shell: bash -l {0} | |
| run: | | |
| conda activate fenicsproject | |
| python -m pytest tests -vvv | |