Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
frontend.yml 3.93 KiB
name: Frontend

on:
  push:
    branches:
      - 'master'
      - 'release-**'
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]

jobs:
  files-changed:
    name: Check which files changed
    runs-on: ubuntu-20.04
    timeout-minutes: 3
    outputs:
      frontend_all: ${{ steps.changes.outputs.frontend_all }}
    steps:
      - uses: actions/checkout@v3
      - name: Test which files changed
        uses: dorny/paths-filter@v2.11.1
        id: changes
        with:
          token: ${{ github.token }}
          filters: .github/file-paths.yaml

  fe-linter-prettier:
    needs: files-changed
    if: needs.files-changed.outputs.frontend_all == 'true'
    runs-on: ubuntu-20.04
    timeout-minutes: 10
    steps:
    - uses: actions/checkout@v3
    - name: Prepare front-end environment
      uses: ./.github/actions/prepare-frontend
    - run: yarn run lint-prettier
      name: Run Prettier formatting linter

  fe-linter-eslint:
    needs: files-changed
    if: needs.files-changed.outputs.frontend_all == 'true'
    runs-on: ubuntu-20.04
    timeout-minutes: 20
    steps:
    - uses: actions/checkout@v3
    - name: Prepare front-end environment
      uses: ./.github/actions/prepare-frontend
    - name: Prepare back-end environment
      uses: ./.github/actions/prepare-backend
      with:
        m2-cache-key: 'cljs'
    - run: yarn run lint-eslint
      name: Run ESLint linter

  fe-type-check:
    needs: files-changed
    if: needs.files-changed.outputs.frontend_all == 'true'
    runs-on: ubuntu-20.04
    timeout-minutes: 10
    steps:
    - uses: actions/checkout@v3
    - name: Prepare front-end environment
      uses: ./.github/actions/prepare-frontend
    - name: Prepare back-end environment
      uses: ./.github/actions/prepare-backend
      with:
        m2-cache-key: 'cljs'
    - run: yarn build-quick:cljs
      name: Compile CLJS
    - run: yarn type-check
      name: Check types

  fe-tests-unit:
    needs: files-changed
    if: github.event.pull_request.draft == false && needs.files-changed.outputs.frontend_all == 'true'
    runs-on: buildjet-2vcpu-ubuntu-2004
    timeout-minutes: 20
    steps:
    - uses: actions/checkout@v3
    - name: Prepare front-end environment
      uses: ./.github/actions/prepare-frontend
    - name: Prepare back-end environment
      uses: ./.github/actions/prepare-backend
      with:
        m2-cache-key: 'cljs'
    - run: yarn run test-unit --coverage --silent
      name: Run frontend unit tests
    - name: Upload coverage to codecov.io
      uses: codecov/codecov-action@v2
      with:
        files: ./coverage/lcov.info
        flags: front-end

  fe-tests-timezones:
    needs: files-changed
    if: github.event.pull_request.draft == false && needs.files-changed.outputs.frontend_all == 'true'
    runs-on: ubuntu-20.04
    timeout-minutes: 14
    steps:
    - uses: actions/checkout@v3
    - name: Prepare front-end environment
      uses: ./.github/actions/prepare-frontend
    - name: Prepare back-end environment
      uses: ./.github/actions/prepare-backend
      with:
        m2-cache-key: 'cljs'
    - run: yarn run test-timezones
      name: Run frontend timezones tests

  fe-chromatic:
    needs: files-changed
    if: github.event.pull_request.draft == false && needs.files-changed.outputs.frontend_all == 'true'
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Prepare front-end environment
        uses: ./.github/actions/prepare-frontend
      - name: Prepare back-end environment
        uses: ./.github/actions/prepare-backend
        with:
          m2-cache-key: 'cljs'
      - name: Publish to Chromatic
        uses: chromaui/action@v1
        env:
          PUBLISH_CHROMATIC: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
        if: env.PUBLISH_CHROMATIC != null
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}