Merge pull request #776 from bp/surface_from_tri_mesh_nan #2725
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 | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
static-analysis: | |
name: Static analysis | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
uses: ./.github/actions/prepare-poetry | |
with: | |
python-version: "3.10" | |
# Post in-line comments for any issues found | |
# Do not run if coming from a forked repo | |
# See https://github.com/marketplace/actions/lint-action | |
- name: Run linters (with annotations) | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
uses: wearerequired/lint-action@v2 | |
with: | |
flake8: true | |
flake8_command_prefix: poetry run | |
flake8_dir: resqpy | |
mypy: true | |
mypy_command_prefix: poetry run | |
mypy_args: resqpy | |
# Alternative step that works with forked repo | |
- name: Run linters (without annotations) | |
if: github.event.pull_request.head.repo.full_name != github.repository | |
run: | | |
poetry run flake8 . | |
poetry run mypy resqpy | |
- name: Code formatting | |
run: poetry run yapf --diff -r -p . | |
unit-tests: | |
name: Unit tests (Python ${{ matrix.python-version }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
uses: ./.github/actions/prepare-poetry | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Run pytest | |
run: poetry run pytest --cov=resqpy --cov-report=xml --junitxml=pytest.xml | |
- name: Upload pytest artifacts | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Unit Test Results (Python ${{ matrix.python-version }}) | |
path: pytest.xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.xml | |
fail_ci_if_error: true | |
legacy-dependencies: | |
# Test against older versions of numpy and pandas, | |
# To ensure resqpy works with the lower bounds of our published constraints | |
name: Unit tests (older dependencies) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
uses: ./.github/actions/prepare-poetry | |
with: | |
python-version: 3.8 | |
- name: Downgrade numpy and pandas | |
# Use caret-style requirements (~) to fix minor version but allow patches | |
run: | | |
poetry add numpy@~1.22 pandas@~1.1 | |
poetry show | |
- name: Run pytest | |
run: poetry run pytest |