diff --git a/.github/actions/generate-metadata/action.yml b/.github/actions/generate-metadata/action.yml new file mode 100644 index 00000000..69564821 --- /dev/null +++ b/.github/actions/generate-metadata/action.yml @@ -0,0 +1,44 @@ +--- +name: Build environment +description: Create build environment + +inputs: + gh_token: + description: GitHub token + required: true + type: string + +runs: + using: composite + steps: + - 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: ${{ inputs.gh_token }} + run: aiida-registry fetch + shell: bash + - name: Check plugins installation + if: steps.cache-plugins-restore.outputs.cache-hit != 'true' + # 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 + shell: bash + - 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/ + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28336e9a..b3d175d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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' diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml index f32ad941..9c951d58 100644 --- a/.github/workflows/comment.yml +++ b/.github/workflows/comment.yml @@ -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: @@ -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 diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 27827a13..81243890 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -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 diff --git a/aiida_registry/test_install.py b/aiida_registry/test_install.py index 1863ba32..ceee37f7 100644 --- a/aiida_registry/test_install.py +++ b/aiida_registry/test_install.py @@ -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,