Currently, this step emits the "Error: No PR found. Only pull_request workflows are supported." message when run on the master branch commits (after the merge), so the change prevents it from being run there.
221 lines
5.3 KiB
YAML
221 lines
5.3 KiB
YAML
name: frontend
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- ".github/workflows/ci-frontend.yml"
|
|
- "frontend/apps/remark42/**"
|
|
- "!**.md"
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/ci-frontend.yml"
|
|
- "frontend/apps/remark42/**"
|
|
- "!**.md"
|
|
|
|
jobs:
|
|
translations-check:
|
|
name: Translations check
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node: [16.15.1]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.0.1
|
|
id: pnpm-install
|
|
with:
|
|
version: 7
|
|
run_install: false
|
|
|
|
- name: Get pnpm store directory
|
|
id: pnpm-cache
|
|
run: |
|
|
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
|
|
|
|
- name: Setup pnpm cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i
|
|
working-directory: ./frontend
|
|
|
|
- name: Translations check
|
|
run: pnpm translation-check
|
|
working-directory: ./frontend/apps/remark42
|
|
|
|
type-check:
|
|
name: Type check
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node: [16.15.1]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.0.1
|
|
id: pnpm-install
|
|
with:
|
|
version: 7
|
|
run_install: false
|
|
|
|
- name: Get pnpm store directory
|
|
id: pnpm-cache
|
|
run: |
|
|
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
|
|
|
|
- name: Setup pnpm cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i
|
|
working-directory: ./frontend
|
|
|
|
- name: Run type check
|
|
run: pnpm type-check
|
|
working-directory: ./frontend/apps/remark42
|
|
|
|
lint:
|
|
name: Eslint & Stylelint
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node: [16.15.1]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.0.1
|
|
id: pnpm-install
|
|
with:
|
|
version: 7
|
|
run_install: false
|
|
|
|
- name: Get pnpm store directory
|
|
id: pnpm-cache
|
|
run: |
|
|
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
|
|
|
|
- name: Setup pnpm cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i
|
|
working-directory: ./frontend
|
|
|
|
- name: Run linters
|
|
run: pnpm lint
|
|
working-directory: ./frontend/apps/remark42
|
|
|
|
size-limit:
|
|
name: Size limit
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
CI_JOB_NUMBER: 1
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.0.1
|
|
id: pnpm-install
|
|
with:
|
|
version: 7
|
|
run_install: false
|
|
|
|
- name: Check bundle size
|
|
uses: andresz1/size-limit-action@v1
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
directory: ./frontend/apps/remark42
|
|
|
|
test:
|
|
name: Tests & Coverage
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node: [16.15.1]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.0.1
|
|
id: pnpm-install
|
|
with:
|
|
version: 7
|
|
run_install: false
|
|
|
|
- name: Get pnpm store directory
|
|
id: pnpm-cache
|
|
run: |
|
|
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
|
|
|
|
- name: Setup pnpm cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i
|
|
working-directory: ./frontend
|
|
|
|
- name: Test & Coverage
|
|
run: pnpm coverage
|
|
working-directory: ./frontend/apps/remark42
|
|
|
|
- name: Submit coverage
|
|
run: ${{ github.workspace }}/frontend/apps/remark42/node_modules/.bin/codecov
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|