Skip to content

try to fix failing tests #893

try to fix failing tests

try to fix failing tests #893

Workflow file for this run

on: [push]
name: "Tests and validation"
jobs:
python-tests:
name: Python unit and integration tests
runs-on: ubuntu-latest
defaults:
run:
# This is necessary for the conda action. It replaces `conda init` as
# the shell does not load ,profile or .bashrc.
shell: bash -el {0}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniforge-version: latest
- name: Install nanover dependancies
run: conda install -y mpi4py openmm
- name: Install tests dependancies
run: python -m pip install -r python-libraries/requirements.test
- name: Compile
run: ./compile.sh --no-dotnet
- name: Parallel tests
run: python -m pytest --cov nanover python-libraries -n auto -m 'not serial'
- name: Serial tests
run: python -m pytest --cov nanover python-libraries -n 1 -m 'serial'
mypy:
name: Type analysis for python
runs-on: ubuntu-latest
defaults:
run:
# This is necessary for the conda action. It replaces `conda init` as
# the shell does not load ,profile or .bashrc.
shell: bash -el {0}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniforge-version: latest
- name: Install nanover dependancies
run: conda install -y mpi4py openmm
- name: Install tests dependancies
run: python -m pip install -r python-libraries/requirements.test
- name: Compile (mypy requires --no-edit)
run: ./compile.sh --no-dotnet --no-edit
- name: mypy
run: |
# Mypy accepts paths, modules or packages as inputs. However, only
# packages work reasonably well with packages. So we need to generate
# a list of the packages we want to test.
packages=$(find python-libraries -name __init__.py \
| sed 's/__init__.py//g' \
| awk '{split($0, a, /src/); print(a[2])}' \
| sed 's#/#.#g' \
| cut -c 2- \
| sed 's/\.$//g' \
| grep -v '^$' \
| grep -v protocol \
| sed 's/^/-p /g' \
| grep -v '\..*\.' \
| tr '\n' ' ')
mypy --ignore-missing-imports --namespace-packages --check-untyped-defs --allow-redefinition $packages
ruff:
name: Ruff to lint python code
runs-on: ubuntu-latest
defaults:
run:
# This is necessary for the conda action. It replaces `conda init` as
# the shell does not load ,profile or .bashrc.
shell: bash -el {0}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniforge-version: latest
- name: Install nanover dependancies
run: conda install -y mpi4py openmm
- name: Install ruff
run: python -m pip install ruff black
- name: Compile
run: ./compile.sh --no-dotnet
- name: Ruff
run: ruff check ./python-libraries
- name: Black
run: black --diff --check ./python-libraries
csharp-tests:
name: C# unit and integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '2.1.x'
- name: Compile
run: ./compile.sh --no-python
- name: Tests
run: cd ./csharp-libraries && dotnet test