Skip to content

Merge pull request #1468 from ACEsuit/develop #2

Merge pull request #1468 from ACEsuit/develop

Merge pull request #1468 from ACEsuit/develop #2

Workflow file for this run

name: unit tests
on:
pull_request:
workflow_dispatch:
push:
branches: [ main, develop ]
concurrency:
group: unit-tests-${{ github.ref }}
cancel-in-progress: false
jobs:
pytest-general:
runs-on: ubuntu-latest
name: pytest-general (py${{ matrix.python-version }}, group ${{ matrix.split-group }})
strategy:
fail-fast: false
matrix:
python-version: [ '3.9','3.10','3.11','3.12','3.13' ]
split-group: [ 1, 2, 3, 4 ]
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install requirements (general tests)
run: |
pip install -U pip
pip install .[dev]
pip install pytest-split pytest-xdist pytest-timeout
# Some tests are creating large files that may persist until the end of the test
# run, so we are making more space available on the machine by deleting libraries
# and frameworks not relevant to us.
- name: Show available disk space (originally)
run: df -h
- name: Free up disk space
run: |
# Remove Java (JDKs)
sudo rm -rf /usr/lib/jvm
# Remove .NET SDKs
sudo rm -rf /usr/share/dotnet
# Remove Swift toolchain
sudo rm -rf /usr/share/swift
# Remove Haskell (GHC)
sudo rm -rf /usr/local/.ghcup
# Remove Android SDKs
sudo rm -rf /usr/local/lib/android
# Remove web browsers
sudo rm -rf /usr/local/share/chromium
sudo rm -rf /opt/microsoft /opt/google
- name: Show available disk space (before tests)
run: df -h
- name: Log installed environment (general tests)
run: |
python3 -m pip freeze
- name: Cache test durations
uses: actions/cache@v4
with:
path: tests/.test_durations
key: test-durations-py${{ matrix.python-version }}-${{ github.run_id }}
restore-keys: |
test-durations-py${{ matrix.python-version }}-
test-durations-
- name: Run general unit tests
run: |
pytest -v tests \
--ignore=tests/test_cueq_oeq.py \
--ignore=tests/test_polar_cueq.py \
--splits 4 \
--group ${{ matrix.split-group }} \
--splitting-algorithm=least_duration \
--store-durations \
--durations-path=tests/.test_durations \
--clean-durations \
--timeout=600 \
-n 2
pytest-cueq:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install requirements (with cueq)
run: |
pip install -U pip
pip install ".[dev, cueq]"
- name: Log installed environment (with cueq)
run: |
python3 -m pip freeze
- name: Run cueq tests (non-polar)
run: |
pytest -v tests/test_cueq_oeq.py -k TestCueq
pytest -v tests/test_calculator.py
pytest-cueq-polar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install requirements (with cueq + graph_longrange)
run: |
pip install -U pip
pip install ".[dev, cueq]"
pip install git+https://github.com/WillBaldwin0/graph_electrostatics.git
- name: Log installed environment (with cueq + graph_longrange)
run: |
python3 -m pip freeze
- name: Run cueq tests (polar)
run: |
pytest -v tests/test_polar_cueq.py
pytest-polar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install requirements (with graph_longrange)
run: |
pip install -U pip
pip install ".[dev]"
pip install git+https://github.com/WillBaldwin0/graph_electrostatics.git
- name: Log installed environment (with graph_longrange)
run: |
python3 -m pip freeze
- name: Run polar-specific tests
run: |
pytest -v tests/test_polar_models.py
pytest -v tests/test_run_train_dipole_polar.py
pytest -v tests/test_calculator.py::test_mace_polar_constructor
pytest -v tests/test_models.py::test_dipole_polar_mace
pytest -v tests/test_foundations.py -k polar
pytest-torchsim:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install requirements alongside torchsim
run: |
pip install -U pip
pip install ".[dev,torchsim]"
- name: Log installed environment alongside torchsim
run: |
python3 -m pip freeze
- name: Run torchsim tests
run: |
pytest -v tests/test_torchsim.py