Replace manual actions/cache steps with built-in setup-node cache support. Add cache: pnpm and cache-dependency-path to all setup-node steps in both ci-frontend.yml and ci-frontend-api.yml. Move pnpm install before setup-node as required for pnpm caching to work.
196 lines
4.4 KiB
YAML
196 lines
4.4 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
|
|
permissions:
|
|
contents: read
|
|
strategy:
|
|
matrix:
|
|
node: [16]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4.2.0
|
|
with:
|
|
version: 8
|
|
run_install: false
|
|
|
|
- name: Install node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
cache: "pnpm"
|
|
cache-dependency-path: frontend/pnpm-lock.yaml
|
|
|
|
- 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
|
|
permissions:
|
|
contents: read
|
|
strategy:
|
|
matrix:
|
|
node: [16]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4.2.0
|
|
with:
|
|
version: 8
|
|
run_install: false
|
|
|
|
- name: Install node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
cache: "pnpm"
|
|
cache-dependency-path: frontend/pnpm-lock.yaml
|
|
|
|
- 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
|
|
permissions:
|
|
contents: read
|
|
strategy:
|
|
matrix:
|
|
node: [16]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4.2.0
|
|
with:
|
|
version: 8
|
|
run_install: false
|
|
|
|
- name: Install node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
cache: "pnpm"
|
|
cache-dependency-path: frontend/pnpm-lock.yaml
|
|
|
|
- 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'
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
env:
|
|
CI_JOB_NUMBER: 1
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4.2.0
|
|
with:
|
|
version: 8
|
|
run_install: false
|
|
|
|
- name: Check bundle size
|
|
uses: andresz1/size-limit-action@94bc357df29c36c8f8d50ea497c3e225c3c95d1d
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
directory: ./frontend/apps/remark42
|
|
package_manager: pnpm
|
|
|
|
test:
|
|
name: Tests & Coverage
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
strategy:
|
|
matrix:
|
|
node: [16]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4.2.0
|
|
with:
|
|
version: 8
|
|
run_install: false
|
|
|
|
- name: Install node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
cache: "pnpm"
|
|
cache-dependency-path: frontend/pnpm-lock.yaml
|
|
|
|
- name: Install dependencies
|
|
run: pnpm i
|
|
working-directory: ./frontend
|
|
|
|
- name: Test & Coverage
|
|
run: pnpm coverage
|
|
working-directory: ./frontend/apps/remark42
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
working-directory: ./frontend/apps/remark42
|
|
codecov_yml_path: ./frontend/apps/remark42/codecov.yml
|