From 783ba88a5815547023457432fde08d8a62ebbfb4 Mon Sep 17 00:00:00 2001
From: Matthew Evans <git@ml-evs.science>
Date: Thu, 22 Feb 2024 14:27:27 +0000
Subject: [PATCH] Add a CI run that only tests non-optional deps
 (optimistically)

- Hopefully all tests have been written in such a way that they will be
  skipped if the underlying required package is not found
---
 .github/workflows/test.yml | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 24b61d90aac..787646784a9 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -66,26 +66,38 @@ jobs:
         run: |
           sudo cp cmd_line/gulp/Linux_64bit/* /usr/local/bin/
 
+      - name: Install pymatgen and mandatory testing dependencies only
+        run: |
+          micromamba activate pmg
+
+          uv pip install -e '.[dev]'
+
+      - name: pytest split ${{ matrix.split }}
+        run: |
+          micromamba activate pmg
+          pytest --splits 10 --group ${{ matrix.split }} --durations-path tests/files/.pytest-split-durations tests
+
       - name: Install ubuntu-only conda dependencies
         if: matrix.os == 'ubuntu-latest'
         run: |
           micromamba install -n pmg -c conda-forge enumlib packmol bader openbabel openff-toolkit --yes
 
-      - name: Install pymatgen and dependencies
+      - name: Install all optional dependencies with workarounds
         run: |
-          micromamba activate pmg
-          # TODO remove temporary fix. added since uv install torch is flaky.
-          # track https://github.com/astral-sh/uv/issues/1921 for resolution
-          pip install torch
+            micromamba activate pmg
 
-          uv pip install numpy cython
+            # TODO remove temporary fix. added since uv install torch is flaky.
+            # track https://github.com/astral-sh/uv/issues/1921 for resolution
+            pip install torch
 
-          uv pip install --editable '.[dev,optional]'
+            uv pip install numpy cython
 
-          # TODO remove next line installing ase from main branch when FrechetCellFilter is released
-          uv pip install --upgrade 'git+https://gitlab.com/ase/ase'
+            uv pip install --editable '.[dev,optional]'
 
-      - name: pytest split ${{ matrix.split }}
+            # TODO remove next line installing ase from main branch when FrechetCellFilter is released
+            uv pip install --upgrade 'git+https://gitlab.com/ase/ase'
+
+      - name: Optional deps - pytest split ${{ matrix.split }}
         run: |
           micromamba activate pmg
           pytest --splits 10 --group ${{ matrix.split }} --durations-path tests/files/.pytest-split-durations tests