Skip to content

tests

tests #1698

Workflow file for this run

name: tests
on:
workflow_call:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]
merge_group:
jobs:
test:
runs-on: ubuntu-latest # TODO add macos tests too
strategy:
max-parallel: 10
matrix:
python_version: ['3.9', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install core dependencies and package
run: |
python -m pip install --upgrade pip
if [ -f packages/requirements.txt ]; then pip install -r packages/requirements.txt; fi
if [ -f packages/requirements-optional.txt ]; then pip install -r packages/requirements-optional.txt; fi
pip install -e packages/fairchem-core[dev]
pip install -e packages/fairchem-data-oc[dev]
pip install -e packages/fairchem-demo-ocpapi[dev]
pip install -e packages/fairchem-applications-cattsunami
- name: Install additional dependencies
run: |
wget https://github.com/m3g/packmol/archive/refs/tags/v20.15.0.tar.gz
tar -xzvf v20.15.0.tar.gz
cd packmol-20.15.0
./configure
make
echo "$(readlink -f .)" >> $GITHUB_PATH
- name: Test core with pytest
run: |
pytest tests -vv --ignore=tests/demo/ocpapi/tests/integration/ --cov-report=xml --cov=fairchem -c ./packages/fairchem-core/pyproject.toml
- if: ${{ matrix.python_version == '3.12' }}
name: codecov-report
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false # optional (default = false)
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)