Skip to content

Commit

Permalink
Merge branch 'main' into feature/add-upfdata-input
Browse files Browse the repository at this point in the history
  • Loading branch information
yakutovicha authored Mar 19, 2024
2 parents 28b6ced + 628febb commit 111f05b
Show file tree
Hide file tree
Showing 30 changed files with 1,074 additions and 171 deletions.
1 change: 0 additions & 1 deletion .docker/cp2k-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ label: cp2k
computer: localhost
description:
default_calc_job_plugin: cp2k
on_computer: True
filepath_executable: /usr/bin/cp2k
append_text:
prepend_text:
2 changes: 1 addition & 1 deletion .docker/opt/add-codes.sh → .docker/init/add-codes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ set -x
export SHELL=/bin/bash

# Install cp2k code.
verdi code show cp2k@localhost || verdi code create core.code.installed --config /opt/aiida-cp2k/.docker/cp2k-code.yml --non-interactive
verdi code show cp2k@localhost || verdi code create core.code.installed --config /home/aiida/aiida-cp2k/.docker/cp2k-code.yml --non-interactive
7 changes: 0 additions & 7 deletions .docker/my_init.d/add-codes.sh

This file was deleted.

8 changes: 0 additions & 8 deletions .docker/my_init.d/add-pgsql-bin-to-path.sh

This file was deleted.

Empty file.
1 change: 1 addition & 0 deletions .docker/s6-rc.d/cp2k-code-setup/timeout-up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
1 change: 1 addition & 0 deletions .docker/s6-rc.d/cp2k-code-setup/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
7 changes: 7 additions & 0 deletions .docker/s6-rc.d/cp2k-code-setup/up
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/command/execlineb -S0

with-contenv

foreground { s6-echo "Setting up CP2K code" }

/etc/init/add-codes.sh
Empty file added .docker/user/cp2k-code-setup
Empty file.
40 changes: 15 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
name: Continuous Integration

on:
[push, pull_request]
push:
branches:
- main
pull_request:

jobs:

test-plugin:

runs-on: ubuntu-latest
strategy:
matrix:
aiida-version:
- '2.4.3'
- '2.5.1'

timeout-minutes: 30

steps:
Expand Down Expand Up @@ -35,6 +44,8 @@ jobs:
tags: aiida_cp2k_test
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
build-args: |
AIIDA_VERSION=${{ matrix.aiida-version }}
# Temp fix
# https://github.com/docker/build-push-action/issues/252
Expand All @@ -47,39 +58,18 @@ jobs:
- name: Create container from aiida_cp2k_test image and test the plugin inside
run: |
export DOCKERID=`docker run -d aiida_cp2k_test`
docker exec --tty $DOCKERID wait-for-services
sleep 5
docker logs $DOCKERID
docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'aiida-pseudo install sssp -v 1.3 -x PBE -p efficiency'
docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'cd /opt/aiida-cp2k/ && py.test --cov aiida_cp2k --cov-append .'
docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'cd /home/aiida/aiida-cp2k/ && py.test --cov aiida_cp2k --cov-append .'
pre-commit:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
run: |
pip install --upgrade pip
pip install -e .[dev,docs]
- name: Run pre-commit
run: |
pre-commit install
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
docs:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
python-version: [3.8]
python-version: [3.11]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
13 changes: 8 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
ci:
autoupdate_schedule: quarterly

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:

- id: check-json
Expand All @@ -16,7 +19,7 @@ repos:
exclude: *exclude_pre_commit_hooks

- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.12.1
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+
Expand All @@ -29,19 +32,19 @@ repos:
args: [--count, --show-source, --statistics]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: [--profile, black, --filter-files]

- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies:
Expand Down
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
# For further information on the license, see the LICENSE.txt file. #
###############################################################################

FROM aiidateam/aiida-core:2.1.2
ARG AIIDA_VERSION=2.5.0

FROM aiidateam/aiida-core-with-services:${AIIDA_VERSION}

# To prevent the container to exit prematurely.
ENV KILL_ALL_RPOCESSES_TIMEOUT=50

WORKDIR /opt/

USER root
# Install statically linked CP2K which is a considerably newer release than Debian builtin.
# The statically linked CP2K is a non-MPI binary, but we're running all tests with 1 MPI proc.
RUN set -ex ; \
Expand All @@ -21,16 +23,15 @@ RUN set -ex ; \
echo "1e6fccf901873ebe9c827f45fb29331f599772f6e6281e988d8956c7a3aa143c /usr/bin/cp2k" | sha256sum -c ; \
chmod +x /usr/bin/cp2k

USER aiida
# Install aiida-cp2k plugin.
COPY . aiida-cp2k
COPY --chown="${SYSTEM_UID}:${SYSTEM_GID}" . /home/aiida/aiida-cp2k
RUN pip install ./aiida-cp2k[dev,docs]

# Install coverals.
RUN pip install coveralls

# Install the cp2k code.
COPY .docker/opt/add-codes.sh /opt/
COPY .docker/my_init.d/add-codes.sh /etc/my_init.d/50_add-codes.sh

# Add PGSQL bin folder to PATH.
COPY .docker/my_init.d/add-pgsql-bin-to-path.sh /etc/my_init.d/50_add-pgsql-bin-to-path.sh
COPY .docker/init/add-codes.sh /etc/init/
COPY .docker/s6-rc.d/cp2k-code-setup /etc/s6-overlay/s6-rc.d/cp2k-code-setup
COPY .docker/user/cp2k-code-setup /etc/s6-overlay/s6-rc.d/user/contents.d/cp2k-code-setup
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pip install -e . # Also installs aiida, if missing (but not postgres/rabbitmq).

## For maintainers

### Release

To create a new release, clone the repository, install development dependencies with `pip install '.[dev]'`, and then execute `bumpver update --major/--minor/--patch`.
This will:

Expand All @@ -43,6 +45,38 @@ Additional notes:
- The release tag (e.g. a/b/rc) is determined from the last release.
Use the `--tag` option to override the release tag.

### Testing

To run the tests, you need to have Docker installed in your system.
Once this is done, you can build the Docker image with the following command:

```bash
docker build -t aiida_cp2k_test .
```
To test against another version of aiida-core, you can specify the build agrument `AIIDA_VERSION`:
```bash
docker build -t aiida_cp2k_test --build-arg AIIDA_VERSION=2.4.3 .
```

Then, you can launch the container:

```bash
DOCKERID=`docker run -d aiida_cp2k_test`
```
This will remeber the container ID in the variable `DOKERID`.
You can then run the tests with the following command:

```bash
docker exec --tty --user aiida $DOCKERID /bin/bash -l -c 'cd /home/aiida/aiida-cp2k/ && pytest'
```

To enter the container for manual testing do:

```bash
docker exec -it --user aiida $DOCKERID bash
```


## License

MIT
Expand Down
2 changes: 1 addition & 1 deletion aiida_cp2k/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
###############################################################################
"""The official AiiDA plugin for CP2K."""

__version__ = "2.0.0"
__version__ = "2.1.0b1"

# EOF
Loading

0 comments on commit 111f05b

Please sign in to comment.