diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eefee2a7..902d5d14 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,12 @@ name: CI on: [push, pull_request] +# 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 + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: pre-commit: @@ -38,11 +44,30 @@ jobs: run: pip install --upgrade wheel setuptools - name: Install run: pip install -e . -v + + - 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: Cache plugins metadata + 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: | mv plugins_metadata.json aiida-registry-app/src/ @@ -78,7 +103,17 @@ jobs: run: pip install --upgrade pip - name: Install run: pip install -e . -v + - 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 diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 0689e111..5e04ad05 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -8,7 +8,11 @@ on: - synchronize - closed -concurrency: preview-${{ github.ref }} +# 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 + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: deploy-preview: @@ -27,13 +31,13 @@ jobs: run: pip install --upgrade wheel setuptools - name: Install run: pip install -e . -v - - name: fetch metadata - id: fetch_metadata - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: aiida-registry fetch - - name: Get entry points data - run: aiida-registry test-install + - name: Get cloned data from gh-pages + run: | + git remote set-url origin https://github.com/aiidateam/aiida-registry.git + git fetch origin gh-pages + git checkout origin/gh-pages plugins_metadata.json || true + + - name: Move JSON file to the React project run: | mv plugins_metadata.json aiida-registry-app/src/ diff --git a/.github/workflows/webpage.yml b/.github/workflows/webpage.yml index 276b30b2..b4971ce0 100644 --- a/.github/workflows/webpage.yml +++ b/.github/workflows/webpage.yml @@ -11,6 +11,12 @@ on: branches: - master +# 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 + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: webpage: if: github.repository == 'aiidateam/aiida-registry' @@ -36,11 +42,22 @@ jobs: git fetch origin gh-pages git checkout origin/gh-pages plugins_metadata.json || true mv plugins_metadata.json cloned_plugins_metadata.json || true + + - 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: Get entry points data run: aiida-registry test-install - name: Move the JSON file to the React directory