-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: Utilize uv lockfile for reproducible test environments #6640
base: main
Are you sure you want to change the base?
Changes from all commits
dff7bde
368dff3
63f9929
924f1bb
47095d6
0e3b87b
954b0ce
166c978
b0cadaf
3517d65
e3fb04d
10cd62a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,7 @@ | |
# currently active dependency manager (DM) to trigger an automatic review | ||
# request from the DM upon changes. Please see AEP-002 for details: | ||
# https://github.com/aiidateam/AEP/tree/master/002_dependency_management | ||
setup.* @aiidateam/dependency-manager | ||
environment.yml @aiidateam/dependency-manager | ||
requirements*.txt @aiidateam/dependency-manager | ||
pyproject.toml @aiidateam/dependency-manager | ||
uv.lock @aiidateam/dependency-manager | ||
utils/dependency_management.py @aiidateam/dependency-manager | ||
.github/workflows/dm.yml @aiidateam/dependency-manager | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file does not exist. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,8 @@ inputs: | |
required: false | ||
# NOTE: Hard-learned lesson: we cannot use type=boolean here, apparently :-( | ||
# https://stackoverflow.com/a/76294014 | ||
from-requirements: | ||
description: Install aiida-core dependencies from pre-compiled requirements.txt file | ||
from-lock: | ||
description: Install aiida-core dependencies from a uv lock file | ||
default: 'true' | ||
required: false | ||
|
||
|
@@ -25,26 +25,18 @@ runs: | |
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: Install uv installer | ||
run: curl --proto '=https' --tlsv1.2 -LsSf https://${{ env.UV_URL }} | sh | ||
env: | ||
UV_VERSION: 0.2.9 | ||
UV_URL: github.com/astral-sh/uv/releases/download/$UV_VERSION/uv-installer.sh | ||
shell: bash | ||
- name: Set up uv | ||
uses: astral-sh/setup-uv@v4 | ||
with: | ||
version: 0.5.5 | ||
|
||
- name: Install dependencies from requirements-py-*.txt | ||
if: ${{ inputs.from-requirements == 'true' }} | ||
run: uv pip install --system -r requirements/requirements-py-${{ inputs.python-version }}.txt | ||
- name: Install dependencies from uv lock | ||
# NOTE: We're also asserting that the lockfile is up to date | ||
if: ${{ inputs.from-lock == 'true' }} | ||
run: uv sync --locked --extra pre-commit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE: By default we're installing with |
||
shell: bash | ||
|
||
- name: Install aiida-core | ||
run: uv pip install --system ${{ env.NO_DEPS }} -e .${{ inputs.extras }} | ||
env: | ||
# Don't install dependencies if they were installed through requirements file AND | ||
# if no extras are required. | ||
# | ||
# If this syntax looks weird to you, dear reader, know that this is | ||
# GHA's way to do ternary operator. :-/ | ||
# https://docs.github.com/en/actions/learn-github-actions/expressions#example | ||
NO_DEPS: ${{ (inputs.from-requirements == 'true' && inputs.extras == '') && '--no-deps' || '' }} | ||
if: ${{ inputs.from-lock != 'true' }} | ||
run: uv pip install --system -e .${{ inputs.extras }} | ||
shell: bash |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,40 +18,8 @@ env: | |
|
||
jobs: | ||
|
||
check-requirements: | ||
|
||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install utils/ dependencies | ||
run: pip install -r utils/requirements.txt | ||
|
||
- name: Check requirements files | ||
id: check_reqs | ||
run: python ./utils/dependency_management.py check-requirements DEFAULT | ||
|
||
- name: Create commit comment | ||
if: failure() && steps.check_reqs.outputs.error | ||
uses: peter-evans/commit-comment@v3 | ||
with: | ||
path: pyproject.toml | ||
body: | | ||
${{ steps.check_reqs.outputs.error }} | ||
|
||
Click [here](https://github.com/aiidateam/aiida-core/wiki/AiiDA-Dependency-Management) for more information on dependency management. | ||
|
||
tests: | ||
|
||
needs: [check-requirements] | ||
|
||
runs-on: ubuntu-latest | ||
timeout-minutes: 45 | ||
|
||
|
@@ -96,15 +64,15 @@ jobs: | |
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Setup environment | ||
run: .github/workflows/setup.sh | ||
run: source .venv/bin/activate && .github/workflows/setup.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is created by |
||
|
||
- 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 | ||
# so run code coverage only for python 3.9. | ||
run: pytest --db-backend psql -m 'not nightly' tests/ ${{ matrix.python-version == '3.9' && '--cov aiida' || '' }} | ||
run: uv run pytest --db-backend psql -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' | ||
|
@@ -118,7 +86,6 @@ jobs: | |
|
||
tests-presto: | ||
|
||
needs: [check-requirements] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
|
||
|
@@ -139,12 +106,11 @@ jobs: | |
- name: Run test suite | ||
env: | ||
AIIDA_WARN_v3: 0 | ||
run: pytest -m 'presto' tests/ | ||
run: uv run pytest -m 'presto' tests/ | ||
|
||
|
||
verdi: | ||
|
||
needs: [check-requirements] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
|
@@ -155,7 +121,7 @@ jobs: | |
uses: ./.github/actions/install-aiida-core | ||
with: | ||
python-version: '3.12' | ||
from-requirements: 'false' | ||
from-lock: 'false' | ||
|
||
- name: Run verdi tests | ||
run: | | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like @aiidateam/dependency-manager doesn't exist? Should I assign @agoscinski explicitly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add both me and @agoscinski, or if you also want to maintain this ;) I think after this PR, the dependency management can be future simplified.