Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions .devcontainer/devcontainer.json

This file was deleted.

33 changes: 0 additions & 33 deletions .github/scripts/build_container.sh

This file was deleted.

75 changes: 0 additions & 75 deletions .github/scripts/prune_docker_hub.sh

This file was deleted.

23 changes: 0 additions & 23 deletions .github/scripts/singularity_setup.sh

This file was deleted.

102 changes: 30 additions & 72 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,62 +7,49 @@ env:
ruff_version: 0.15.5

jobs:
build:
name: Build docker container
runs-on: ubuntu-22.04
# if this is a dependabot PR, skip all this and do the Dependabot workflow instead
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: fetch # grabs master to compare if Docker build files changed
run: git fetch origin master

- name: Check and build container
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BRANCH: ${{ github.head_ref }}
run: source .github/scripts/build_container.sh

tests:
name: Docker tests
needs: build # so it can use new docker image if docker image has changed
name: Tests
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
testset: ["not lammps and not dlpoly"]
steps:
- name: Setup Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: '3.11.2'
architecture: x64
- name: Checkout repo
uses: actions/checkout@v3
- name: Pull Docker Image
env:
BRANCH: ${{ github.head_ref }}
run: |
BRANCH="${BRANCH//\//-}"
docker pull -q mdmc/mdmc:ci-$BRANCH || docker pull -q mdmc/mdmc:latest
echo "IMG_NAME=$(echo $(docker images --filter=reference='mdmc/mdmc:*' --format "{{.Repository}}:{{.Tag}}"))" >> $GITHUB_ENV
uses: actions/checkout@v7
- name: Install MDMC
run: pip install .[test,docs]
- name: Install packmol
run: sudo apt-get install libgfortran5 -y && pip install packmol
- name: Run tests
env:
TESTSET: ${{ matrix.testset }}
run: |
docker run -t --mount type=bind,source="$(pwd)",target="$(pwd)" ${{ env.IMG_NAME }} python3 -m pytest -m "$TESTSET" -s $(pwd)/tests/;[ $? -eq 0 ]
exit 0
working-directory: tests
run: pytest

- name: Copy coverage
run: docker cp $(docker ps -lq):/home/coverage.xml coverage.xml || exit 0
continue-on-error: true

- name: Upload code coverage report
uses: codecov/codecov-action@v6
notebooks:
name: Notebook test
runs-on: ubuntu-22.04
steps:
- name: Checkout Repo
uses: actions/checkout@v7
- name: Setup Python
uses: actions/setup-python@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
python-version: '3.11.2'
architecture: x64
- name: Install Requirements
run: sudo apt-get install pandoc -y
- name: Install MDMC
run: pip install .[test,docs]
- name: Convert Notebooks
run: jupyter nbconvert --config doc/notebook-test-config.py
- name: Test Notebooks
run: pytest --nbmake --nbmake-timeout=300 -k '.nbconvert.ipynb'

linting:
name: Lint - ${{ matrix.type }}
Expand All @@ -73,7 +60,7 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- uses: astral-sh/ruff-action@v3
with:
src: MDMC
Expand All @@ -87,48 +74,19 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- uses: astral-sh/ruff-action@v3
with:
src: MDMC
args: check --preview --select CPY
version: ${{ env.ruff_version }}

notebooks:
name: Notebooks
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.11.2'
architecture: x64
- name: Pull Docker Image
env:
BRANCH: ${{ github.head_ref }}
run: |
BRANCH="${BRANCH//\//-}"
docker pull -q mdmc/mdmc:ci-$BRANCH || docker pull -q mdmc/mdmc:latest
echo "IMG_NAME=$(echo $(docker images --filter=reference='mdmc/mdmc:*' --format "{{.Repository}}:{{.Tag}}"))" >> $GITHUB_ENV
- name: Create Docker Container
run: |
echo "CONTAINER_HASH=$(echo $(docker run -d -it --mount type=bind,source="$(pwd)",target="/home/mdmc_home" -w "/home/mdmc_home" ${{ env.IMG_NAME }}))" >> $GITHUB_ENV
- name: Install Requirements
run: docker exec ${{ env.CONTAINER_HASH }} /bin/bash -c "apt-get install pandoc -y && pip install .[docs]"
- name: Convert Notebooks
run: docker exec ${{ env.CONTAINER_HASH }} /bin/bash -c "jupyter nbconvert --config doc/notebook-test-config.py"
- name: Test Notebooks
run: docker exec ${{ env.CONTAINER_HASH }} /bin/bash -c "pytest --nbmake --nbmake-timeout=2000 -k '.nbconvert.ipynb'"

type-checking:
name: Mypy
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: apt get
run: |
sudo apt-get update
Expand Down
36 changes: 11 additions & 25 deletions .github/workflows/ci-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,17 @@ jobs:
runs-on: ubuntu-22.04
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: '3.11.2'
architecture: x64
- name: Checkout repo
uses: actions/checkout@v4
- name: Build Docker container
env:
BRANCH: ${{ github.head_ref }}
run: |
BRANCH="${BRANCH//\//-}"
docker build -t mdmc/mdmc:ci-$BRANCH -f "$(pwd)"/build/Docker/Dockerfile.mdmc . || exit 1
uses: actions/checkout@v7
- name: Install MDMC
run: pip install .[test,docs]
- name: Run tests
env:
BRANCH: ${{ github.head_ref }}
run: |
BRANCH="${BRANCH//\//-}"
docker run -t --mount type=bind,source="$(pwd)",target="$(pwd)" mdmc/mdmc:ci-$BRANCH python3 -m pytest -s "$(pwd)"/tests/; [ $? -eq 0 ]
working-directory: tests
run: pytest
- name: Try to build documentation
env:
BRANCH: ${{ github.head_ref }}
run: |
BRANCH="${BRANCH//\//-}"
docker run -t --mount type=bind,source="$(pwd)",target="$(pwd)" mdmc/mdmc:ci-$BRANCH /bin/bash -c "cd $(pwd) && apt-get update && apt-get install pandoc -y && pip3 install . && make -d -C $(pwd)/doc html"
- name: Push image
env:
BRANCH: ${{ github.head_ref }}
DOCKER_PASSWORD: ${{ secrets.DEPENDABOT_DOCKER }}
run: |
BRANCH="${BRANCH//\//-}"
echo "$DOCKER_PASSWORD" | docker login -u "mdmc" --password-stdin
docker push mdmc/mdmc:ci-$BRANCH
run: apt-get install pandoc -y && make -d -C doc html
Loading
Loading