Skip to content

Commit 4bcd73b

Browse files
authored
Refactor CI workflow to use micromamba
Updated GitHub Actions workflow to use micromamba for environment setup and dependency installation.
1 parent 625129e commit 4bcd73b

File tree

1 file changed

+33
-19
lines changed

1 file changed

+33
-19
lines changed

.github/workflows/tests.yml

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,46 @@ jobs:
1212
max-parallel: 5
1313

1414
steps:
15-
- uses: actions/checkout@v4
16-
- name: Set up Python 3.11
17-
uses: actions/setup-python@v3
15+
# Checkout repository
16+
- name: Checkout source
17+
uses: actions/checkout@v4
18+
19+
# Setup micromamba and Python environment
20+
- name: Setup micromamba with test environment
21+
uses: mamba-org/setup-micromamba@v1
1822
with:
19-
python-version: '3.11'
20-
- name: Add conda to system path
21-
run: |
22-
# $CONDA is an environment variable pointing to the root of the miniconda directory
23-
echo $CONDA/bin >> $GITHUB_PATH
24-
- name: Install conda dependencies
25-
run: |
26-
conda env update --file environment.yml --name base
27-
- name: Install pip dependencies
23+
environment-file: environment.yml # Make sure uv is included in this file OR:
24+
environment-name: test-env
25+
create-args: >-
26+
uv
27+
torch>=2.1.0,<2.6.0
28+
init-shell: bash
29+
generate-run-shell: true
30+
31+
# Install Python dependencies using uv
32+
- name: Install Python dependencies with uv
33+
shell: micromamba-shell bash
2834
run: |
29-
pip install "torch<2.6.0,>=2.1.0"
30-
pip install -e '.[dev]'
31-
- name: Append LAMMPS paths
35+
uv pip install -e '.[dev]'
36+
37+
# Set up environment variables for LAMMPS
38+
- name: Configure LAMMPS paths
39+
shell: micromamba-shell bash
3240
run: |
3341
echo "LAMMPS_POTENTIALS=$GITHUB_WORKSPACE/mcmc/potentials" >> $GITHUB_ENV
34-
echo "LAMMPS_COMMAND=$CONDA/bin/lmp" >> $GITHUB_ENV
35-
echo "ASE_LAMMPSRUN_COMMAND=$CONDA/bin/lmp" >> $GITHUB_ENV
36-
- name: Check LAMMPS paths
42+
echo "LAMMPS_COMMAND=$(which lmp)" >> $GITHUB_ENV
43+
echo "ASE_LAMMPSRUN_COMMAND=$(which lmp)" >> $GITHUB_ENV
44+
45+
# Display configured LAMMPS paths (for debugging)
46+
- name: Print LAMMPS paths
47+
shell: micromamba-shell bash
3748
run: |
3849
echo "LAMMPS_POTENTIALS = $LAMMPS_POTENTIALS"
3950
echo "LAMMPS_COMMAND = $LAMMPS_COMMAND"
4051
echo "ASE_LAMMPSRUN_COMMAND = $ASE_LAMMPSRUN_COMMAND"
41-
- name: Test with pytest
52+
53+
# Run tests
54+
- name: Run tests with pytest
55+
shell: micromamba-shell bash
4256
run: |
4357
pytest --capture=no --cov --cov-report=xml

0 commit comments

Comments
 (0)