Skip to content

Refactoring CI workflows #661

Refactoring CI workflows

Refactoring CI workflows #661

Workflow file for this run

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:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v3
- name: Create dev environment
uses: ./.github/actions/create-dev-env
- name: Run pre-commit
run:
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
test-utils:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v3
- name: Create dev environment
uses: ./.github/actions/create-dev-env
- name: Run tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pytest tests/
test-webpage-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
timeout-minutes: 30
# This is a CI job that checks if the webpage can be built
# We use the plugins metadata from caching since we don't want to
# fetch it twice and it is not essential for this job to have
# the latest generated metadata
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v3
- 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: true
- 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
preview:
needs: [test-webpage-build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
timeout-minutes: 60
env:
COMMIT_AUTHOR: Deploy Action
COMMIT_AUTHOR_EMAIL: action@github.com
VITE_PR_PREVIEW_PATH: "/aiida-registry/pr-preview/pr-${{ github.event.number }}/"
# This is a CI job that checks if the webpage can be built
# We use the plugins metadata from caching since we don't want to
# fetch it twice and it is not essential for this job to have
# the latest generated metadata
steps:
- name: Checkout Repo ⚡️
uses: actions/checkout@v3
- 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: 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: