tests #6059
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: tests | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| merge_group: | |
| push: | |
| branches: [main] | |
| workflow_run: | |
| workflows: | |
| - "contributor check" | |
| types: | |
| - completed | |
| # The path to the sha of the commit we want to test will depend | |
| # on the trigger type. If a workflow_run trigger, then we want | |
| # the sha from the head of the branch that triggered it. For | |
| # pushes and manual triggers, we want the sha of the branch. | |
| env: | |
| CI: true | |
| HEAD_SHA: | | |
| ${{ | |
| github.event.workflow_run.head_sha || | |
| github.event.pull_request.head.sha || | |
| github.sha | |
| }} | |
| jobs: | |
| test: | |
| runs-on: 32-core-ubuntu | |
| permissions: | |
| contents: read | |
| # Needed to manually set commit status | |
| statuses: write | |
| strategy: | |
| max-parallel: 10 | |
| matrix: | |
| python_version: ['3.11', '3.13'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ env.HEAD_SHA }} | |
| # Optional: get full history if needed | |
| fetch-depth: 0 | |
| - name: Setup | |
| uses: ./.github/actions/multi-trigger-setup | |
| with: | |
| status-context: '${{ github.job }} (${{ matrix.python_version }})' | |
| - name: Set up Python ${{ matrix.python_version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| - name: Cache pip | |
| uses: actions/cache@v5 | |
| 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 | |
| pip install \ | |
| packages/fairchem-core[dev,extras] \ | |
| packages/fairchem-data-oc[dev] \ | |
| packages/fairchem-data-omat \ | |
| packages/fairchem-data-omol[dev] \ | |
| packages/fairchem-demo-ocpapi[dev] \ | |
| -r tests/requirements.txt # pin test packages | |
| - name: Install torchsim (Python 3.12+) | |
| if: ${{ matrix.python_version == '3.12' || matrix.python_version == '3.13' }} | |
| run: | | |
| pip install packages/fairchem-core[torchsim] | |
| - 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: Download large test files | |
| run: coverage run -m fairchem.core.scripts.download_large_files oc | |
| - name: Core tests | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| NCCL_DEBUG=INFO pytest -n auto -m "not subprocess and not serial and not gpu" tests --durations=0 -vv --ignore=tests/demo/ocpapi/tests/integration/ --ignore=tests/applications/ --ignore=tests/perf --ignore=tests/lammps --cov-report=xml --cov=fairchem --cov-append --junitxml=junit.xml -o junit_family=legacy -c ./packages/fairchem-core/pyproject.toml | |
| - name: Serial CPU tests | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| pytest -m "serial and not gpu" tests -vv --ignore=tests/demo/ocpapi/tests/integration/ --ignore=tests/applications/ --ignore=tests/perf --ignore=tests/lammps --cov-report=xml --cov=fairchem --cov-append --junitxml=junit-serial.xml -o junit_family=legacy -c ./packages/fairchem-core/pyproject.toml | |
| - if: ${{ matrix.python_version == '3.13' }} | |
| name: codecov-coverage | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| fail_ci_if_error: false | |
| files: ./coverage.xml,./gpu-coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| - if: ${{ matrix.python_version == '3.13' }} | |
| name: codecov-test-results | |
| uses: codecov/test-results-action@v1 | |
| with: | |
| files: ./junit.xml,./junit-serial.xml,./junit-gpu.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| commit_parent: ${{ env.HEAD_SHA }} | |
| verbose: true | |
| - name: Cleanup | |
| if: always() | |
| uses: ./.github/actions/multi-trigger-cleanup | |
| with: | |
| status-context: '${{ github.job }} (${{ matrix.python_version }})' | |
| test_gpu: | |
| runs-on: 4-core-ubuntu-gpu-t4 | |
| permissions: | |
| contents: read | |
| # Needed to manually set commit status | |
| statuses: write | |
| strategy: | |
| max-parallel: 1 | |
| matrix: | |
| python_version: ['3.13'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ env.HEAD_SHA }} | |
| # Optional: get full history if needed | |
| fetch-depth: 0 | |
| - name: Setup | |
| uses: ./.github/actions/multi-trigger-setup | |
| with: | |
| status-context: '${{ github.job }} (${{ matrix.python_version }})' | |
| - name: Set up Python ${{ matrix.python_version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| - name: Install core dependencies and package | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install packages/fairchem-core[dev,extras] \ | |
| packages/fairchem-data-omol[dev] \ | |
| packages/fairchem-data-omat \ | |
| -r tests/requirements.txt # pin test packages | |
| - name: Install torchsim (Python 3.12+) | |
| if: ${{ matrix.python_version == '3.12' || matrix.python_version == '3.13' }} | |
| run: | | |
| pip install packages/fairchem-core[torchsim] | |
| - name: Core GPU tests | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| # Note: These tests seem to fail if "-n auto" is added | |
| run: | | |
| NCCL_DEBUG=INFO pytest tests/core --durations=0 -vv -m gpu -c ./packages/fairchem-core/pyproject.toml | |
| - name: Cleanup | |
| if: always() | |
| uses: ./.github/actions/multi-trigger-cleanup | |
| with: | |
| status-context: '${{ github.job }} (${{ matrix.python_version }})' | |
| test_lammps_gpu: | |
| runs-on: 4-core-ubuntu-gpu-t4 | |
| permissions: | |
| contents: read | |
| # Needed to manually set commit status | |
| statuses: write | |
| strategy: | |
| max-parallel: 1 | |
| matrix: | |
| python_version: ['3.13'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: mamba-org/setup-micromamba@v3 | |
| with: | |
| generate-run-shell: true # This is the default behavior | |
| environment-name: test_env # Specifies a new environment to be created | |
| create-args: python=3.13 # Specifies packages to install into the new environment | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ env.HEAD_SHA }} | |
| # Optional: get full history if needed | |
| fetch-depth: 0 | |
| - name: Setup | |
| uses: ./.github/actions/multi-trigger-setup | |
| with: | |
| status-context: '${{ github.job }} (${{ matrix.python_version }})' | |
| - name: Set up Python ${{ matrix.python_version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| - name: Install core dependencies and package | |
| shell: micromamba-shell {0} | |
| run: | | |
| micromamba install lammps | |
| python -m pip install --upgrade pip | |
| pip install packages/fairchem-core[dev,extras] \ | |
| packages/fairchem-lammps \ | |
| -r tests/requirements.txt # pin test packages | |
| - name: Core GPU tests | |
| shell: micromamba-shell {0} | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| NCCL_DEBUG=INFO pytest tests/lammps --durations=0 -vv -m gpu | |
| - name: Cleanup | |
| if: always() | |
| uses: ./.github/actions/multi-trigger-cleanup | |
| with: | |
| status-context: '${{ github.job }} (${{ matrix.python_version }})' |