Skip to content

Commit

Permalink
action
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Sep 16, 2023
1 parent 60b94df commit d9ced64
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 28 deletions.
36 changes: 36 additions & 0 deletions .github/actions/generate_metadata/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Build environment
description: Create build environment

runs:
using: composite
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v3
- name: Restore cached Plugins
id: cache-plugins-restore
uses: actions/cache/restore@v3
with:
path: plugins_metadata.json
key: plugins_metadata
- name: fetch metadata
if: steps.cache-plugins-restore.outputs.cache-hit != 'true'
id: fetch_metadata
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: aiida-registry fetch
#- name: Check plugins installation
# # This step will attach plugin installation inforamtion to the metadata, e.g. if the plugin can be installed or not
# run: aiida-registry test-install
- name: Cache plugins metadata
if: steps.cache-plugins-restore.outputs.cache-hit != 'true'
id: cache-plugins-save
uses: actions/cache/save@v3
with:
path: plugins_metadata.json
key: ${{ steps.cache-plugins-restore.outputs.cache-primary-key }}

- name: Move JSON file to the React project
run: |
cp plugins_metadata.json aiida-registry-app/src/
cp plugins_metadata.json aiida-registry-app/dist/
26 changes: 2 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,9 @@ jobs:
- name: Create dev environment
uses: ./.github/actions/create-dev-env

- name: Restore cached Plugins
id: cache-plugins-restore
uses: actions/cache/restore@v3
with:
path: plugins_metadata.json
key: plugins_metadata
- name: fetch metadata
if: steps.cache-plugins-restore.outputs.cache-hit != 'true'
id: fetch_metadata
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: aiida-registry fetch
#- name: Check plugins installation
# # This step will attach plugin installation inforamtion to the metadata, e.g. if the plugin can be installed or not
# run: aiida-registry test-install
- name: Cache plugins metadata
if: steps.cache-plugins-restore.outputs.cache-hit != 'true'
id: cache-plugins-save
uses: actions/cache/save@v3
with:
path: plugins_metadata.json
key: ${{ steps.cache-plugins-restore.outputs.cache-primary-key }}
- name: Generate metadata
uses: ./.github/actions/generate-metadata

- name: Move JSON file to the React project
run: mv plugins_metadata.json aiida-registry-app/src/
- uses: actions/setup-node@v3
with:
node-version: '18.x'
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
paths:
# Only run when the plugins.yaml file is changed
# which is when plugin information is changed by a PR from plugin
# develpers.
# develpers. This is not able to be replaced by the pr-preview since
# the pr-preview is not able to get from forked repos.
- plugins.yaml

jobs:
Expand All @@ -24,6 +25,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: aiida-registry fetch
- name: Check plugins installation
# This step will attach plugin installation inforamtion to the metadata, e.g. if the plugin can be installed or not
run: aiida-registry test-install

- name: Create commit comment
if: steps.fetch_metadata.outputs.error
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ jobs:
uses: ./.github/actions/create-dev-env

- name: fetch metadata
if: steps.cache-plugins-restore.outputs.cache-hit != 'true'
id: fetch_metadata
env:
# Use the GITHUB_TOKEN for github API calls
# otherwise the rate limit will be exceeded
Expand Down
2 changes: 1 addition & 1 deletion aiida_registry/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_install_one_docker(container_image, plugin):
)
extract_metadata = container.exec_run(
workdir=_DOCKER_WORKDIR,
cmd="python ./analyze_entrypoints.py -o result.json",
cmd="python ./bin/analyze_entrypoints.py -o result.json",
)
error_message = handle_error(
extract_metadata,
Expand Down

0 comments on commit d9ced64

Please sign in to comment.