Skip to content

Commit 53f104b

Browse files
committed
ci
1 parent d944ec5 commit 53f104b

1 file changed

Lines changed: 59 additions & 23 deletions

File tree

.github/workflows/ci.yml

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
schedule:
1111
- cron: '0 0 * * *'
1212

13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
1317
jobs:
1418
lint:
1519
name: Lint (ruff)
@@ -71,7 +75,9 @@ jobs:
7175
large-packages: true
7276
swap-storage: true
7377

74-
# 6. Setup T3 Environment
78+
# ── Conda environments ──────────────────────────────────────────
79+
80+
# 6. Setup T3 Environment (micromamba, with built-in cache)
7581
- name: Set up micromamba (t3_env)
7682
uses: mamba-org/setup-micromamba@v2
7783
with:
@@ -80,26 +86,56 @@ jobs:
8086
cache-environment: true
8187
generate-run-shell: true
8288

83-
# 7. Setup RMG Environment (rmg_env) — required by all T3 tests that
84-
- name: Set up micromamba (rmg_env)
85-
uses: mamba-org/setup-micromamba@v2
89+
# 7. Setup RMG Environment — uses setup-miniconda + Miniforge
90+
# (matching RMG-Py's own CI; micromamba hangs on this env's solver)
91+
- name: Cache rmg_env
92+
id: cache-rmg-env
93+
uses: actions/cache@v4
94+
with:
95+
path: ${{ env.CONDA }}/envs/rmg_env
96+
key: rmg-env-${{ runner.os }}-py3.11-${{ hashFiles('RMG-Py/environment.yml') }}
97+
98+
- name: Set up Miniforge (rmg_env)
99+
uses: conda-incubator/setup-miniconda@v3
86100
with:
87-
environment-name: rmg_env
88101
environment-file: RMG-Py/environment.yml
89-
cache-environment: true
90-
generate-run-shell: false
91-
create-args: >-
92-
--channel-priority strict
102+
miniforge-variant: Miniforge3
103+
miniforge-version: latest
104+
python-version: "3.11"
105+
activate-environment: rmg_env
106+
auto-update-conda: true
107+
show-channel-urls: true
108+
conda-remove-defaults: "true"
109+
110+
# ── Build caches ────────────────────────────────────────────────
111+
112+
# 8. Cache and compile RMG-Py (Cython extensions, in rmg_env)
113+
- name: Cache RMG-Py build
114+
id: cache-rmg-build
115+
uses: actions/cache@v4
116+
with:
117+
path: |
118+
RMG-Py/build/
119+
RMG-Py/rmgpy/**/*.so
120+
RMG-Py/.installed
121+
key: rmg-build-${{ runner.os }}-py3.11-${{ hashFiles('RMG-Py/rmgpy/**/*.pyx', 'RMG-Py/rmgpy/**/*.pxd', 'RMG-Py/setup.py') }}
93122

94-
# 8. Compile RMG-Py (Cython extensions, in rmg_env)
95123
- name: Compile RMG-Py
96-
shell: bash -el {0}
124+
if: steps.cache-rmg-build.outputs.cache-hit != 'true'
97125
working-directory: RMG-Py
98-
run: |
99-
micromamba run -n rmg_env make
100-
echo "PYTHONPATH=${{ github.workspace }}/RMG-Py" >> $GITHUB_ENV
126+
run: conda run -n rmg_env make
127+
128+
- name: Set RMG-Py PYTHONPATH
129+
run: echo "PYTHONPATH=${{ github.workspace }}/RMG-Py" >> $GITHUB_ENV
130+
131+
# 9. Cache and compile ARC (Dependency, into t3_env)
132+
- name: Cache ARC build
133+
id: cache-arc-build
134+
uses: actions/cache@v4
135+
with:
136+
path: ARC/arc/molecule/*.so
137+
key: arc-build-${{ runner.os }}-${{ hashFiles('ARC/arc/molecule/*.pyx', 'ARC/arc/molecule/*.pxd', 'ARC/setup.py') }}
101138

102-
# 9. Install & Compile ARC (Dependency, into t3_env)
103139
- name: Install and Compile ARC
104140
shell: micromamba-shell {0}
105141
working-directory: ARC
@@ -108,17 +144,18 @@ jobs:
108144
bash devtools/install_pyrdl.sh t3_env
109145
echo "::endgroup::"
110146
111-
echo "::group::Compile ARC extensions"
112-
make compile
113-
echo "::endgroup::"
147+
if [ "${{ steps.cache-arc-build.outputs.cache-hit }}" != "true" ]; then
148+
echo "::group::Compile ARC extensions"
149+
make compile
150+
echo "::endgroup::"
151+
fi
114152
115153
echo "::group::Install ARC in editable mode"
116154
pip install -e .
117155
echo "::endgroup::"
118156
119157
# 9b. Install xTB into its own xtb_env (used by ARC for gfn2 jobs)
120158
- name: Install xTB
121-
shell: bash -el {0}
122159
working-directory: ARC
123160
run: bash devtools/install_xtb.sh
124161

@@ -129,19 +166,18 @@ jobs:
129166
run: |
130167
pip install -e .
131168
169+
# ── Tests ───────────────────────────────────────────────────────
170+
132171
# 11. Run T3 Tests
133172
- name: Run Tests
134173
shell: micromamba-shell {0}
135174
working-directory: T3
136175
run: |
137-
echo "Running T3 Tests..."
138176
export PYTHONPATH="$PYTHONPATH:$(pwd):${{ github.workspace }}/ARC:${{ github.workspace }}/RMG-Py"
139177
export RMG_DB_PATH="${{ github.workspace }}/RMG-database"
140-
141-
# Run pytest on the T3 tests directory
142178
pytest tests/ --cov=t3 --cov-report=xml -ra -vv
143179
144-
# 9. Upload Coverage
180+
# 12. Upload Coverage
145181
- name: Upload coverage data
146182
uses: codecov/codecov-action@v5
147183
with:

0 commit comments

Comments
 (0)