Skip to content

Commit

Permalink
Update CI to do unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Jun 21, 2024
1 parent 4017490 commit 5a90b6c
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 112 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
groups:
gha-dependencies:
patterns:
- '*'
71 changes: 0 additions & 71 deletions .github/workflows/ci-nightly.yml

This file was deleted.

102 changes: 66 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,96 @@
---
# Run basic tests for this app on the latest aiidalab-docker image.

name: continuous-integration
name: CI unit test

on: [push, pull_request]

jobs:

pre-commit:
fast-tests:

runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: pip install -U pre-commit==2.10.0
python-version: "3.10"

- name: Run pre-commit
run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
- name: Install uv
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.2.4/uv-installer.sh | sh
test:
needs: [pre-commit]
- name: Install dependencies for test
run: |
uv pip install .[dev]
strategy:
matrix:
python-version: ['3.9', '3.10']
- name: Pull the image and Run pytest
run: |
pytest -v tests -m "not slow"
services:
rabbitmq:
image: rabbitmq:3.8.14-management
ports:
- 5672:5672
- 15672:15672
slow-tests:

needs: [fast-tests]
runs-on: ubuntu-latest
timeout-minutes: 40
timeout-minutes: 30

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Cache Python dependencies
uses: actions/cache@v1
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
path: ~/.cache/pip
key: pip-${{ matrix.python-version }}-tests-${{ hashFiles('**/setup.json') }}
restore-keys: pip-${{ matrix.python-version }}-tests
python-version: "3.10"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.2.4/uv-installer.sh | sh

- name: Install dependencies for test
run: |
pip install -U pip==22.3.1
pip install -U .[tests]
uv pip install .[dev]
- name: Pull the image and Run pytest
run: |
pytest -v tests -m "slow"
edge-aiida-core-tests:
# This is to test the plugin is compatible with the main branch of aiida-core

needs: [slow-tests]
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install uv
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.2.4/uv-installer.sh | sh

- name: Install dependencies and edge aiida-core for test
run: |
uv pip install .[dev]
pip uninstall --yes aiida-core
git clone --depth 1 https://github.com/aiidateam/aiida-core.git
uv pip install ./aiida-core
- name: Check aiida-core version is the edget ('post' in version tag)
run: |
if verdi --version | grep -q "post"; then
echo $(verdi --version)
else
echo $(verdi --version)
exit 1
fi
- name: Pull the image and Run pytest
run: |
pytest -sv tests
pytest -v tests
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ def prepare_evaluate_builder(

builder = self._EVALUATE_WORKCHAIN.get_builder()

builder.metadata.call_link_label = f"{configuration}"
builder.clean_workdir = (
self.inputs.clean_workdir
) # sync with the main workchain
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _code_generator(bin):
label=f"{bin}-docker",
default_calc_job_plugin=plugin,
filepath_executable=exec_path,
image_name="ghcr.io/containers4hpc/quantum-espresso:v2024.1001",
image_name="ghcr.io/cnts4sci/quantum-espresso:edge",
wrap_cmdline_params=True,
engine_command=engine_command,
use_double_quotes=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bands:
Al: Al<md5=a2ca6568aad2214016a12794e7e55b1e>
clean_workdir: true
fermi_shift: 10.0
init_nbands_factor: 3.0
init_nbands_factor: 3
kpoints_distance_bands: 0.5
run_band_structure: false
scf:
Expand Down
8 changes: 5 additions & 3 deletions tests/workflows/measure/test_transferability.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ def test_run_default_check_inner_eos_inputs(
assert "test" in node.description

# Check the first EOS (SC) use (25, 100) cutoffs
pw_parameters_SC = node.called[2].inputs.eos.pw.parameters

outgoing: orm.LinkManager = node.base.links.get_outgoing()
pw_parameters_SC = outgoing.get_node_by_label("SC").inputs.eos.pw.parameters
assert isinstance(pw_parameters_SC["SYSTEM"]["ecutwfc"], int)
assert pw_parameters_SC["SYSTEM"]["ecutwfc"] == 25
assert pw_parameters_SC["SYSTEM"]["ecutrho"] == 100

# Check the first EOS (XO) use (30, 120) cutoffs
pw_parameters_XO = node.called[3].inputs.eos.pw.parameters
# Check the first EOS (XO) use (30, 120) cutoffs from Oxygen
pw_parameters_XO = outgoing.get_node_by_label("XO").inputs.eos.pw.parameters
assert isinstance(pw_parameters_XO["SYSTEM"]["ecutwfc"], int)
assert pw_parameters_XO["SYSTEM"]["ecutwfc"] == 30
assert pw_parameters_XO["SYSTEM"]["ecutrho"] == 120
Expand Down

0 comments on commit 5a90b6c

Please sign in to comment.