Skip to content

Commit

Permalink
Merge branch 'main' of github.com:rabbull/aiida-core into bulk-update…
Browse files Browse the repository at this point in the history
…-json
  • Loading branch information
rabbull committed Jan 13, 2025
2 parents 0e49d43 + 7387056 commit 2db8385
Show file tree
Hide file tree
Showing 42 changed files with 2,217 additions and 1,267 deletions.
19 changes: 10 additions & 9 deletions .github/actions/install-aiida-core/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ inputs:
default: '3.9' # Lowest supported version
required: false
extras:
description: aiida-core extras (including brackets)
default: ''
description: list of optional dependencies
# NOTE: The default 'pre-commit' extra recursively contains
# other extras needed to run the tests.
default: pre-commit
required: false
# NOTE: Hard-learned lesson: we cannot use type=boolean here, apparently :-(
# https://stackoverflow.com/a/76294014
# NOTE2: When installing from lockfile, aiida-core and its dependencies
# are installed in a virtual environment located in .venv directory.
# Subsuquent jobs steps must either activate the environment or use `uv run`
from-lock:
description: Install aiida-core dependencies from a uv lock file
description: Install aiida-core dependencies from uv lock file
default: 'true'
required: false

Expand All @@ -29,19 +31,18 @@ runs:
python-version: ${{ inputs.python-version }}

- name: Set up uv
uses: astral-sh/setup-uv@v4
uses: astral-sh/setup-uv@v5
with:
version: 0.5.6
version: 0.5.x
python-version: ${{ inputs.python-version }}

- name: Install dependencies from uv lock
if: ${{ inputs.from-lock == 'true' }}
# NOTE: We're asserting that the lockfile is up to date
# NOTE2: 'pre-commit' extra recursively contains other extras
# needed to run the tests.
run: uv sync --locked --extra pre-commit
run: uv sync --locked ${{ inputs.extras && format('--extra {0}', inputs.extras) || '' }}
shell: bash

- name: Install aiida-core
if: ${{ inputs.from-lock != 'true' }}
run: uv pip install --system -e .${{ inputs.extras }}
run: uv pip install -e .${{ inputs.extras }}
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Bash run in Docker image through Singularity
default_calc_job_plugin: core.arithmetic.add
computer: localhost
filepath_executable: /bin/sh
image_name: docker://alpine:3
engine_command: singularity exec --bind $PWD:$PWD {image_name}
image_name: alpine:3
engine_command: docker run --user 1001:100 -v $PWD:$PWD -w $PWD -i {image_name}
prepend_text: ' '
append_text: ' '
30 changes: 19 additions & 11 deletions .github/workflows/ci-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ jobs:

tests:

runs-on: ubuntu-latest
timeout-minutes: 90
runs-on: ubuntu-24.04
timeout-minutes: 45

strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.12']
database-backend: [psql, sqlite]
database-backend: [psql]
include:
- python-version: '3.9'
database-backend: sqlite

services:
postgres:
Expand Down Expand Up @@ -65,16 +68,19 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Setup environment
# Note: The virtual environment in .venv was created by uv in previous step
run: source .venv/bin/activate && .github/workflows/setup.sh
run: .github/workflows/setup.sh

- name: Run test suite
env:
AIIDA_TEST_PROFILE: test_aiida
AIIDA_WARN_v3: 1
# Python 3.12 has a performance regression when running with code coverage
# NOTE1: Python 3.12 has a performance regression when running with code coverage
# so run code coverage only for python 3.9.
run: uv run pytest --db-backend ${{ matrix.database-backend }} -m 'not nightly' tests/ ${{ matrix.python-version == '3.9' && '--cov aiida' || '' }}
# TODO: Remove a workaround for VIRTUAL_ENV once the setup-uv action is updated
# https://github.com/astral-sh/setup-uv/issues/219
run: |
${{ matrix.python-version == '3.9' && 'VIRTUAL_ENV=$PWD/.venv' || '' }}
pytest -n auto --db-backend ${{ matrix.database-backend }} -m 'not nightly' tests/ ${{ matrix.python-version == '3.9' && '--cov aiida' || '' }}
- name: Upload coverage report
if: matrix.python-version == 3.9 && github.repository == 'aiidateam/aiida-core'
Expand All @@ -92,10 +98,9 @@ jobs:
with:
wait-timeout-minutes: 60


tests-presto:

runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 20

steps:
Expand All @@ -120,7 +125,7 @@ jobs:

verdi:

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

steps:
Expand All @@ -130,7 +135,10 @@ jobs:
uses: ./.github/actions/install-aiida-core
with:
python-version: '3.12'
from-lock: 'false'
from-lock: 'true'
# NOTE: The `verdi devel check-undesired-imports` fails if
# the 'tui' extra is installed.
extras: ''

- name: Run verdi tests
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ verdi -p test_aiida run ${SYSTEM_TESTS}/test_daemon.py
verdi -p test_aiida run ${SYSTEM_TESTS}/test_containerized_code.py
bash ${SYSTEM_TESTS}/test_polish_workchains.sh
verdi daemon stop

AIIDA_TEST_PROFILE=test_aiida pytest --db-backend psql -m nightly tests/
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
build-and-test:
if: ${{ github.event.pull_request.head.repo.fork }}
name: build and test amd64 images
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 60
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

docs-linkcheck:

runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 30

steps:
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
nightly-tests:

if: github.repository == 'aiidateam/aiida-core' # Prevent running the builds on forks as well
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

services:
postgres:
Expand Down Expand Up @@ -55,9 +55,6 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: eWaterCycle/setup-singularity@v7 # for containerized code test
with:
singularity-version: 3.8.7

- name: Install system dependencies
run: sudo apt update && sudo apt install postgresql
Expand All @@ -70,18 +67,25 @@ jobs:
from-lock: 'true'

- name: Setup environment
# NOTE: virtual env in .venv created by uv in previous step
run: source .venv/bin/activate && .github/workflows/setup.sh
run: .github/workflows/setup.sh

- name: Run tests
id: tests
run: source .venv/bin/activate && .github/workflows/tests_nightly.sh
- name: Run pytest nigthly tests
id: pytest-tests
env:
AIIDA_TEST_PROFILE: test_aiida
AIIDA_WARN_v3: 1
run: |
pytest --db-backend psql -m nightly tests/
- name: Run daemon nightly tests
id: daemon-tests
run: .github/workflows/daemon_tests.sh

- name: Slack notification
# Always run this step (otherwise it would be skipped if any of the previous steps fail) but only if the
# `install` or `tests` steps failed, and the `SLACK_WEBHOOK` is available. The latter is not the case for
# pull requests that come from forks. This is a limitation of secrets on GHA
if: always() && (steps.install.outcome == 'failure' || steps.tests.outcome == 'failure') && env.SLACK_WEBHOOK != null
if: always() && (steps.install.outcome == 'failure' || steps.pytest-tests.outcome == 'failure' || steps.daemon-tests.outcome == 'failure') && env.SLACK_WEBHOOK != null
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
Expand All @@ -95,7 +99,7 @@ jobs:
# Run a subset of test suite to ensure compatibility with latest RabbitMQ releases
rabbitmq-tests:

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

strategy:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

# Only run this job on the main repository and not on forks
if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand All @@ -31,7 +31,7 @@ jobs:
pre-commit:

needs: [check-release-tag]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 30

steps:
Expand All @@ -50,7 +50,7 @@ jobs:
tests:

needs: [check-release-tag]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 30

services:
Expand All @@ -75,7 +75,7 @@ jobs:

needs: [check-release-tag, pre-commit, tests]

runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- name: Checkout source
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ verdi computer configure core.local localhost --config "${CONFIG}/localhost-conf
verdi computer test localhost
verdi code create core.code.installed --non-interactive --config "${CONFIG}/doubler.yaml"
verdi code create core.code.installed --non-interactive --config "${CONFIG}/add.yaml"
verdi code create core.code.containerized --non-interactive --config "${CONFIG}/add-singularity.yaml"
verdi code create core.code.containerized --non-interactive --config "${CONFIG}/add-containerized.yaml"

# set up slurm-ssh computer
verdi computer setup --non-interactive --config "${CONFIG}/slurm-ssh.yaml"
Expand Down
27 changes: 17 additions & 10 deletions .github/workflows/test-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
schedule:
- cron: 30 02 * * * # nightly build

env:
FORCE_COLOR: 1

# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
Expand All @@ -23,7 +26,7 @@ jobs:
# Note: The specification is also validated by the pre-commit hook.

if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 5

steps:
Expand All @@ -32,18 +35,18 @@ jobs:
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.11'

- name: Set up uv
uses: astral-sh/setup-uv@v4
uses: astral-sh/setup-uv@v5
with:
version: 0.5.6
version: 0.5.x

- name: Install utils/ dependencies
run: uv pip install --system -r utils/requirements.txt

- name: Validate uv lockfile
run: uv lock --locked
run: uv lock --check

- name: Validate conda environment file
run: python ./utils/dependency_management.py validate-environment-yml
Expand All @@ -53,7 +56,7 @@ jobs:

needs: [validate-dependency-specification]
if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 5

steps:
Expand All @@ -73,7 +76,7 @@ jobs:
install-with-pip:

if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 15

strategy:
Expand Down Expand Up @@ -104,7 +107,7 @@ jobs:
# Verify that we can install AiiDA with conda.

if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 25

strategy:
Expand Down Expand Up @@ -156,7 +159,7 @@ jobs:
tests:

needs: [install-with-pip]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 45

strategy:
Expand Down Expand Up @@ -209,4 +212,8 @@ jobs:
env:
AIIDA_TEST_PROFILE: test_aiida
AIIDA_WARN_v3: 1
run: pytest --db-backend ${{ matrix.database-backend }} tests -m 'not nightly' tests/
# TODO: Remove a workaround for VIRTUAL_ENV once the setup-uv action is updated
# https://github.com/astral-sh/setup-uv/issues/219
run: |
${{ matrix.python-version == '3.9' && 'VIRTUAL_ENV=$PWD/.venv' || '' }}
pytest -n auto --db-backend psql -m 'not nightly' tests/
Loading

0 comments on commit 2db8385

Please sign in to comment.