Linting and tests #132
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: Linting and tests | |
| on: | |
| push: | |
| branches: [ develop, main ] | |
| pull_request: | |
| branches: [ develop, main ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| strategy: | |
| matrix: | |
| mpi_enabled: [0, 1] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: conda-incubator/setup-miniconda@v2 | |
| if: matrix.mpi_enabled == 1 | |
| env: | |
| CC: mpicc | |
| HDF5_MPI: "ON" | |
| with: | |
| auto-update-conda: true | |
| environment-file: environment.yml | |
| activate-environment: test | |
| python-version: "3.11" | |
| - uses: conda-incubator/setup-miniconda@v2 | |
| if: matrix.mpi_enabled == 0 | |
| with: | |
| auto-update-conda: true | |
| environment-file: environment-nompi.yml | |
| activate-environment: test | |
| python-version: "3.11" | |
| - name: Install | |
| run: | | |
| pip install . | |
| - name: Lint | |
| run: | | |
| conda install flake8 | |
| # 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: Run tests (mpi) | |
| if: matrix.mpi_enabled == 1 | |
| run: | | |
| pytest | |
| mpiexec pytest --with-mpi | |
| - name: Test example (mpi) | |
| if: matrix.mpi_enabled == 1 | |
| run: | | |
| mpiexec h5flow -vv -c examples/example_config.yaml -o test.h5 | |
| - name: Run tests (no mpi) | |
| if: matrix.mpi_enabled == 0 | |
| run: | | |
| pytest | |
| - name: Test example (no mpi) | |
| if: matrix.mpi_enabled == 0 | |
| run: | | |
| h5flow -vv -c examples/example_config.yaml -o test.h5 |