Skip to content
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

Load profile when running entrypoints check new #317

Merged
merged 6 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
59 changes: 59 additions & 0 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ concurrency:
cancel-in-progress: true

jobs:
get-pr:
# https://dev.to/suzukishunsuke/secure-github-actions-by-pullrequesttarget-641
outputs:
merge_commit_sha: ${{steps.pr.outputs.merge_commit_sha}}
runs-on: ubuntu-latest
khsrali marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: suzuki-shunsuke/get-pr-action@v0.1.0
id: pr

test-utils:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -51,3 +60,53 @@ jobs:
npm install
npm run build
working-directory: ./aiida-registry-app

preview:
# This job is triggered by from PR from the aiida-registry repo, the developer of aiida-registry need to see the preview page of the PR
needs: [test-webpage-build, get-pr]
if: github.repository == 'aiidateam/aiida-registry'
runs-on: ubuntu-latest
strategy:
fail-fast: false
timeout-minutes: 180
env:
COMMIT_AUTHOR: Deploy Action
COMMIT_AUTHOR_EMAIL: action@github.com
VITE_PR_PREVIEW_PATH: "/aiida-registry/pr-preview/pr-${{ github.event.number }}/"

steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v4
with:
ref: ${{needs.get-pr.outputs.merge_commit_sha}}
- name: Create dev environment
uses: ./.github/actions/create-dev-env

- name: Generate metadata
uses: ./.github/actions/generate-metadata
with:
gh_token: ${{ secrets.GITHUB_TOKEN }}
cache: false

- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install npm dependencies and build
run: |
echo $VITE_PR_PREVIEW_PATH
npm install
npm run build
working-directory: ./aiida-registry-app

- name: Add plugins file to the build folder
run: cp plugins_metadata.json aiida-registry-app/dist/

- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./aiida-registry-app/dist
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
custom-url:
token: ${{ secrets.BOT_COMMENT_TOKEN }} # use aiida-bot token to deploy the preview
18 changes: 18 additions & 0 deletions aiida_registry/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,24 @@ def test_install_one_docker(container_image, plugin):
)
is_package_importable = True

## While loop to wait for the daemon to be ready timeont 120s
## This is a workaround for the daemon not being ready for the entrypoint analysis
## which require the profile to be loaded
# print(" - Waiting for the daemon to be ready")
# daemon_ready = False
# timeout = 120 # 120s
# end_time = time.time() + timeout
# while not daemon_ready:
# verdi_status = container.exec_run(
# "verdi status",
# user=user,
# ).output.decode("utf8")
# if "✔" in verdi_status:
# daemon_ready = True
# elif time.time() > end_time:
# print(" >> ERROR: Daemon is not ready after 120s")
# break

unkcpz marked this conversation as resolved.
Show resolved Hide resolved
print(
" - Extracting entry point metadata for {}".format(plugin["package_name"])
)
Expand Down
6 changes: 6 additions & 0 deletions bin/analyze_entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
from typing import Dict, List

import click
from aiida import load_profile
from aiida.storage.sqlite_temp import SqliteTempBackend

# Load AiiDA profile
temp_profile = SqliteTempBackend.create_profile("temp-profile")
load_profile(temp_profile, allow_switch=True)

ENTRY_POINT_GROUPS = [
"aiida.calculations",
Expand Down
Loading