Skip to content

Commit

Permalink
Merge pull request #67 from glotzerlab/github-actions
Browse files Browse the repository at this point in the history
Migrate to GitHub Actions CI
  • Loading branch information
bdice authored Nov 4, 2023
2 parents 733eeaa + 20152c6 commit 794fdb7
Show file tree
Hide file tree
Showing 17 changed files with 187 additions and 87 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/test-notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Notebook Tests

on:
# trigger on pull requests
pull_request:

# trigger on all commits to main
push:
branches:
- 'main'

# trigger on request
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
config:
- python: '3.12'

steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Create Python Environment
uses: conda-incubator/[email protected]
with:
python-version: ${{ matrix.config.python }}
environment-file: environment.yml
activate-environment: test
channels: conda-forge
show-channel-urls: true
miniforge-version: latest
use-mamba: true
- name: Test notebooks
shell: bash -el {0} # Required for conda activation
run: |
python -m pytest -v --nbval --nbval-lax notebooks/
46 changes: 46 additions & 0 deletions .github/workflows/test-projects.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Project Tests

on:
# trigger on pull requests
pull_request:

# trigger on all commits to main
push:
branches:
- 'main'

# trigger on request
workflow_dispatch:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
config:
- python: '3.12'

steps:
- uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Create Python Environment
uses: conda-incubator/[email protected]
with:
python-version: ${{ matrix.config.python }}
environment-file: environment.yml
activate-environment: test
channels: conda-forge
show-channel-urls: true
miniforge-version: latest
use-mamba: true
- name: Test projects
shell: bash -el {0} # Required for conda activation
run: |
cd projects
. run-tests.sh --output
2 changes: 1 addition & 1 deletion .render_all_notebooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Requires many dependencies specified in environment.yml

# Remove existing signac workspaces used by notebooks
rm -r notebooks/projects
rm -rf notebooks/projects

# Render all notebooks by executing them and overwriting contents
jupyter nbconvert --execute --inplace notebooks/*.ipynb
Expand Down
4 changes: 3 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ channels:
dependencies:
- gsd
- h5py
- hoomd>=3
- hoomd>=4
- ipywidgets>=7
- joblib
- jupyter
- jupyterlab>=3
- matplotlib>=3
- mistune<2 # Needed for .update_project_readme.py
- nbconvert>=6
- nbval
- notebook>=6
- numpy>=1.21
- pandas>=2.0
- pre-commit
- pytest
- python>=3.9
- scikit-learn
- signac-dashboard>=0.5
Expand Down
2 changes: 1 addition & 1 deletion notebooks/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.12.0"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion notebooks/signac_101_Getting_Started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.12.0"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions notebooks/signac_102_Exploring_Data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"signac_job_document.json signac_statepoint.json V.txt\r\n",
"V.txt signac_job_document.json signac_statepoint.json\r\n",
"1000.0\r\n"
]
}
Expand Down Expand Up @@ -198,7 +198,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.12.0"
}
},
"nbformat": 4,
Expand Down
52 changes: 26 additions & 26 deletions notebooks/signac_103_A_Basic_Workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Computing volume of 973e29d6a4ed6cf7329c03c77df7f645\n",
"Computing volume of 4cf2795722061df825ec9a4d5e31e494\n",
"Computing volume of 973e29d6a4ed6cf7329c03c77df7f645\n",
"Computing volume of d03270cdbbae73c8bb1d9fa0ab370264\n"
]
}
Expand Down Expand Up @@ -320,20 +320,20 @@
"output_type": "stream",
"text": [
"Status: notebooks/projects/tutorial\n",
"22582e83c6b12336526ed304d4378ff8 1.2 init\n",
"4cf2795722061df825ec9a4d5e31e494 7.5 init, volume-computed\n",
"b45a2485a44a46364cc60134360ea5af 4.5 init\n",
"8629822576debc2bfbeffa56787ca348 7.8 init\n",
"c0ab2e09a6f878019a6057175bf718e6 2.3 init\n",
"665547b1344fe40de5b2c7ace4204783 6.7 init\n",
"e8186b9b68e18a82f331d51a7b8c8c15 8.9 init\n",
"5a6c687f7655319db24de59a2336eff8 0.1 init, volume-computed\n",
"5a456c131b0c5897804a4af8e77df5aa 10.0 init, volume-computed\n",
"973e29d6a4ed6cf7329c03c77df7f645 5.0 init, volume-computed\n",
"9110d0837ad93ff6b4013bae30091edd 3.4 init\n",
"22582e83c6b12336526ed304d4378ff8 1.2 init\n",
"ee617ad585a90809947709a7a45dda9a 1.0 init, volume-computed\n",
"05061d2acea19d2d9a25ac3360f70e04 5.6 init\n",
"4cf2795722061df825ec9a4d5e31e494 7.5 init, volume-computed\n",
"d03270cdbbae73c8bb1d9fa0ab370264 2.6 init, volume-computed\n",
"e8186b9b68e18a82f331d51a7b8c8c15 8.9 init\n"
"05061d2acea19d2d9a25ac3360f70e04 5.6 init\n",
"665547b1344fe40de5b2c7ace4204783 6.7 init\n",
"8629822576debc2bfbeffa56787ca348 7.8 init\n",
"5a456c131b0c5897804a4af8e77df5aa 10.0 init, volume-computed\n",
"c0ab2e09a6f878019a6057175bf718e6 2.3 init\n",
"9110d0837ad93ff6b4013bae30091edd 3.4 init\n",
"ee617ad585a90809947709a7a45dda9a 1.0 init, volume-computed\n"
]
}
],
Expand Down Expand Up @@ -371,14 +371,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Computing volume of 22582e83c6b12336526ed304d4378ff8\n",
"Computing volume of b45a2485a44a46364cc60134360ea5af\n",
"Computing volume of e8186b9b68e18a82f331d51a7b8c8c15\n",
"Computing volume of 05061d2acea19d2d9a25ac3360f70e04\n",
"Computing volume of 665547b1344fe40de5b2c7ace4204783\n",
"Computing volume of 8629822576debc2bfbeffa56787ca348\n",
"Computing volume of c0ab2e09a6f878019a6057175bf718e6\n",
"Computing volume of 665547b1344fe40de5b2c7ace4204783\n",
"Computing volume of 9110d0837ad93ff6b4013bae30091edd\n",
"Computing volume of 22582e83c6b12336526ed304d4378ff8\n",
"Computing volume of 05061d2acea19d2d9a25ac3360f70e04\n",
"Computing volume of e8186b9b68e18a82f331d51a7b8c8c15\n"
"Computing volume of 9110d0837ad93ff6b4013bae30091edd\n"
]
}
],
Expand Down Expand Up @@ -410,20 +410,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Computing volume of 22582e83c6b12336526ed304d4378ff8\n",
"Computing volume of 4cf2795722061df825ec9a4d5e31e494\n",
"Computing volume of b45a2485a44a46364cc60134360ea5af\n",
"Computing volume of 8629822576debc2bfbeffa56787ca348\n",
"Computing volume of c0ab2e09a6f878019a6057175bf718e6\n",
"Computing volume of 665547b1344fe40de5b2c7ace4204783\n",
"Computing volume of e8186b9b68e18a82f331d51a7b8c8c15\n",
"Computing volume of 5a6c687f7655319db24de59a2336eff8\n",
"Computing volume of 5a456c131b0c5897804a4af8e77df5aa\n",
"Computing volume of 973e29d6a4ed6cf7329c03c77df7f645\n",
"Computing volume of d03270cdbbae73c8bb1d9fa0ab370264\n",
"Computing volume of 05061d2acea19d2d9a25ac3360f70e04\n",
"Computing volume of 665547b1344fe40de5b2c7ace4204783\n",
"Computing volume of 8629822576debc2bfbeffa56787ca348\n",
"Computing volume of 5a456c131b0c5897804a4af8e77df5aa\n",
"Computing volume of c0ab2e09a6f878019a6057175bf718e6\n",
"Computing volume of 9110d0837ad93ff6b4013bae30091edd\n",
"Computing volume of 22582e83c6b12336526ed304d4378ff8\n",
"Computing volume of ee617ad585a90809947709a7a45dda9a\n",
"Computing volume of 05061d2acea19d2d9a25ac3360f70e04\n",
"Computing volume of 4cf2795722061df825ec9a4d5e31e494\n",
"Computing volume of d03270cdbbae73c8bb1d9fa0ab370264\n",
"Computing volume of e8186b9b68e18a82f331d51a7b8c8c15\n",
"Done.\n"
]
}
Expand Down Expand Up @@ -505,7 +505,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.12.0"
},
"nbpresent": {
"slides": {},
Expand Down
20 changes: 10 additions & 10 deletions notebooks/signac_104_Modifying_the_Data_Space.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"{'p': 1.2000000000000002, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 833.3333333333333}\n",
"{'p': 3.4000000000000004, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 294.1176470588235}\n",
"{'p': 7.800000000000001, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 128.2051282051282}\n",
"{'p': 1.0, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 1000.0}\n",
"{'p': 5.05, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 198.01980198019803}\n",
"{'p': 2.3000000000000003, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 434.78260869565213}\n",
"{'p': 8.9, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 112.35955056179775}\n",
"{'p': 6.7, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 149.2537313432836}\n",
"{'p': 5.6, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 178.57142857142858}\n",
"{'p': 10.0, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 100.0}\n",
"{'p': 5.05, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 198.01980198019803}\n",
"{'p': 2.575, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 388.34951456310677}\n",
"{'p': 4.5, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 222.22222222222223}\n",
"{'p': 7.525, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 132.89036544850498}\n",
"{'p': 0.1, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 10000.0}\n",
"{'p': 4.5, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 222.22222222222223}\n",
"{'p': 7.800000000000001, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 128.2051282051282}\n",
"{'p': 2.575, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 388.34951456310677}\n",
"{'p': 3.4000000000000004, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 294.1176470588235}\n"
"{'p': 5.6, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 178.57142857142858}\n",
"{'p': 10.0, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 100.0}\n",
"{'p': 1.2000000000000002, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 833.3333333333333}\n",
"{'p': 6.7, 'kT': 1.0, 'N': 1000, 'a': 0, 'b': 0} {'V_liq': 0, 'V_gas': 149.2537313432836}\n"
]
}
],
Expand Down Expand Up @@ -292,7 +292,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.12.0"
}
},
"nbformat": 4,
Expand Down
22 changes: 11 additions & 11 deletions notebooks/signac_105_signac-flow_Ideal_Gas_Example.ipynb

Large diffs are not rendered by default.

42 changes: 23 additions & 19 deletions notebooks/signac_106_signac-flow_HOOMD-blue_Example.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion notebooks/signac_107_Integration_with_Sacred.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.12.0"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions notebooks/signac_202_Integration_with_pandas.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions notebooks/signac_301_Aggregation_Tutorial.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion projects/flow-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def run_tests(path, output, timeout):
except subprocess.TimeoutExpired:
raise RuntimeWarning("Test failed due to timeout.")
except FileNotFoundError:
logger.info("No test file!")
logger.info("No test.sh file, skipping tests.")


def main(args):
Expand Down
Empty file added projects/flow.hoomd.lj/.skipci
Empty file.
19 changes: 11 additions & 8 deletions projects/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
#!/bin/bash

set -e
set -euo pipefail

export USE_INDEX_CACHE=""
for PROJECT in `ls -d */`; do
if [ -e "${PROJECT}/.skipci" ]; then
echo "Skipping tests for project ${PROJECT}."
echo "Skipping ${PROJECT}"
continue
fi
if [[ "$CI" ]]; then
echo "::group::Executing ${PROJECT}"
else
echo "Executing ${PROJECT}"
fi
REQUIREMENTS_FILE="${PROJECT}/requirements.txt"
echo "Run test for ${PROJECT}."
if [ -e ${REQUIREMENTS_FILE} ]; then
echo "Installing requirements:"
cat ${REQUIREMENTS_FILE}

# Re-use the conda index cache after the first time.
conda install --yes ${USE_INDEX_CACHE} --file ${REQUIREMENTS_FILE}
export USE_INDEX_CACHE="--use-index-cache"
mamba install --yes --file ${REQUIREMENTS_FILE} --quiet
fi
python flow-test.py ${PROJECT} -vv --timeout=600 $@
if [[ "$CI" ]]; then
echo "::endgroup::"
fi
done

0 comments on commit 794fdb7

Please sign in to comment.