Skip to content

Commit a968ffa

Browse files
committed
Initial commit combining various codes into one repo
0 parents  commit a968ffa

File tree

10 files changed

+254
-0
lines changed

10 files changed

+254
-0
lines changed

.github/workflows/tests.yaml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Dynamic Submodule Test Runner
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
# 1. SETUP JOB: Installs all dependencies and caches the environment
10+
setup_env:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
# We no longer use this conditional output directly, but keep it for structure
14+
env_ready: true
15+
16+
steps:
17+
- name: Checkout Code and Submodules
18+
uses: actions/checkout@v4
19+
with:
20+
submodules: true
21+
token: ${{ secrets.CAMML_READ_TOKEN }}
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.13'
27+
28+
- name: Generate Submodule Hash Key
29+
id: submodule_key_gen
30+
run: |
31+
SUBMODULE_HASHES=$(git submodule status \
32+
| sed 's/^[ +-]//' \
33+
| awk '{print $1}' \
34+
| tr '\n' '_')
35+
echo "key=$SUBMODULE_HASHES" >> $GITHUB_OUTPUT
36+
37+
- name: Cache Python dependencies
38+
uses: actions/cache@v4
39+
id: cache-venv
40+
with:
41+
path: |
42+
${{ env.pythonLocation }}/lib/python*/site-packages
43+
${{ env.pythonLocation }}/bin
44+
# Key construction is crucial for consistency
45+
key: ${{ runner.os }}-python-3.13-${{ steps.submodule_key_gen.outputs.key }}
46+
47+
- name: Install All Submodules (If cache miss)
48+
# Conditional logic now works correctly
49+
if: steps.cache-venv.outputs.cache-hit != 'true'
50+
run: |
51+
echo "Installing ALL interdependent codes..."
52+
pip install -e "./reax[dev]" -e "./tensorial[dev]" -e "./e3md[dev]" -e "./e3response[dev]" -e "./e3gen[dev]"
53+
54+
# 2. TEST JOB: Runs tests in parallel using the cached environment
55+
test_submodules:
56+
runs-on: ubuntu-latest
57+
needs: setup_env
58+
59+
strategy:
60+
fail-fast: false # ✅ Disable stopping early
61+
matrix:
62+
submodule_path: [ reax, tensorial, e3md, e3response, e3gen ]
63+
64+
steps:
65+
- name: Checkout Code (Minimal checkout for file access)
66+
uses: actions/checkout@v4
67+
with:
68+
submodules: true
69+
token: ${{ secrets.CAMML_READ_TOKEN }}
70+
71+
- name: Set up Python
72+
uses: actions/setup-python@v5
73+
with:
74+
python-version: '3.13'
75+
76+
- name: Generate Submodule Hash Key for Restore
77+
id: submodule_key_restore
78+
run: |
79+
SUBMODULE_HASHES=$(git submodule status \
80+
| sed 's/^[ +-]//' \
81+
| awk '{print $1}' \
82+
| tr '\n' '_')
83+
echo "key=$SUBMODULE_HASHES" >> $GITHUB_OUTPUT
84+
85+
- name: Restore Cached Dependencies
86+
uses: actions/cache@v4
87+
with:
88+
path: |
89+
${{ env.pythonLocation }}/lib/python*/site-packages
90+
${{ env.pythonLocation }}/bin
91+
key: ${{ runner.os }}-python-3.13-${{ steps.submodule_key_restore.outputs.key }}
92+
93+
- name: Run Test for ${{ matrix.submodule_path }}
94+
run: |
95+
echo "Running tests for ${{ matrix.submodule_path }}..."
96+
pytest ./${{ matrix.submodule_path }}/test

.gitignore

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
.pytest_cache
6+
7+
# C extensions
8+
*.so
9+
10+
# Distribution / packaging
11+
.Python
12+
env/
13+
build/
14+
develop-eggs/
15+
dist/
16+
downloads/
17+
eggs/
18+
.eggs/
19+
lib/
20+
lib64/
21+
parts/
22+
sdist/
23+
var/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*,cover
47+
.hypothesis/
48+
49+
# Translations
50+
*.mo
51+
*.pot
52+
53+
# Django stuff:
54+
*.log
55+
56+
# Sphinx documentation
57+
docs/_build/
58+
59+
# PyBuilder
60+
target/
61+
62+
#Ipython Notebook
63+
.ipynb_checkpoints
64+
65+
66+
# JetBrains IDE stuff
67+
.idea/
68+
69+
# Virtual environment directories
70+
/venv*/
71+
72+
.benchmarks
73+
74+
examples/*/
75+
76+
.vscode/
77+
78+
local/
79+
80+
# DOCS
81+
docs/build/
82+
docs/source/starting/data/

.gitmodules

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[submodule "reax"]
2+
path = reax
3+
url = https://github.com/camml-lab/reax.git
4+
branch = develop
5+
[submodule "tensorial"]
6+
path = tensorial
7+
url = https://github.com/camml-lab/tensorial.git
8+
branch = develop
9+
[submodule "e3md"]
10+
path = e3md
11+
url = https://github.com/camml-lab/e3md.git
12+
branch = develop
13+
[submodule "e3response"]
14+
path = e3response
15+
url = https://github.com/camml-lab/e3response.git
16+
branch = develop
17+
[submodule "e3gen"]
18+
path = e3gen
19+
url = https://github.com/camml-lab/e3gen.git
20+
branch = develop
21+

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Welcome to CAMML codes
2+
3+
[![Build Status](https://github.com/camml-lab/camml-codes/actions/workflows/tests.yaml/badge.svg)](https://github.com/camml-lab/camml-codes/actions)
4+
5+
This is our repository that groups together the various codes developed in the CAMML group.
6+
7+
## Users
8+
9+
## Developers
10+
11+
This repo uses [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) the track various codes which each
12+
live in their own repository. We do this using their `https://` versions which means you are asked for your credentials
13+
every time you want to access them.
14+
To avoid this you can run the following command which will use your git credentials instead:
15+
16+
```bash
17+
# Run this command once to tell Git:
18+
# "Any time you see an HTTPS URL for github.com, use the SSH URL instead."
19+
git config --global url."git@github.com:".insteadOf "https://github.com/"
20+
```

e3gen

Submodule e3gen added at 0cba3d3

e3md

Submodule e3md added at a285605

e3response

Submodule e3response added at ef7fc32

init.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# Ensure Git submodule configuration is initialized
4+
git submodule init
5+
6+
# Loop through all submodules defined in .gitmodules
7+
# This command reads the submodule paths
8+
git config -f .gitmodules --get-regexp submodule\..*\.path | while read key path
9+
do
10+
echo "--- Attempting to update $path ---"
11+
12+
# Attempt to update/clone the submodule using a selective command
13+
# The '|| true' ensures the entire script does not exit on failure
14+
if git submodule update --init -- $path; then
15+
echo "Successfully checked out $path."
16+
17+
# Install in editable mode if it's a valid package directory
18+
if [ -d "$path" ] && [ -f "$path/setup.py" ]; then
19+
echo "Installing $path in editable mode (pip install -e)."
20+
pip install -e "$path"
21+
fi
22+
else
23+
# Handle Permission Failure (Non-fatal warning)
24+
echo "🚨 WARNING: Failed to update/clone $path due to access issues."
25+
echo "Skipping installation for this module. You can still use available codes."
26+
fi
27+
echo "-----------------------------------"
28+
done
29+
30+
echo "Setup complete! Environment includes all accessible codes."

reax

Submodule reax added at ad663d8

tensorial

Submodule tensorial added at 5e0ac85

0 commit comments

Comments
 (0)