85 lines
2.1 KiB
YAML
85 lines
2.1 KiB
YAML
name: ci-pr
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- dev
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ci-pr-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
gate:
|
|
runs-on: [frontend, ubuntu-latest]
|
|
timeout-minutes: 120
|
|
env:
|
|
PLAYWRIGHT_BROWSERS_PATH: /root/.cache/ms-playwright
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.2.2
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.9
|
|
|
|
- name: Cache Bun dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
/root/.bun/install/cache
|
|
node_modules
|
|
key: ${{ runner.os }}-${{ runner.arch }}-bun-${{ hashFiles('bun.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ runner.arch }}-bun-
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Generate API clients
|
|
run: bun run apigen
|
|
|
|
- name: Lint check
|
|
run: bun run lint
|
|
|
|
- name: Type check
|
|
run: bun run typecheck
|
|
|
|
- name: Unit tests
|
|
run: bun run test:unit
|
|
|
|
- name: Build
|
|
run: bun run build
|
|
|
|
- name: Resolve Playwright version
|
|
id: playwright-version
|
|
run: |
|
|
version="$(bunx playwright --version | awk '{ print $2 }')"
|
|
echo "version=${version}" >> "${GITHUB_OUTPUT}"
|
|
|
|
- name: Cache Playwright browsers
|
|
id: playwright-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /root/.cache/ms-playwright
|
|
key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright-version.outputs.version }}
|
|
|
|
- name: Install Playwright system deps
|
|
run: bunx playwright install-deps chromium
|
|
|
|
- name: Install Playwright browsers
|
|
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
|
run: bunx playwright install chromium
|
|
|
|
- name: E2E
|
|
env:
|
|
CI: '1'
|
|
PLAYWRIGHT_HTML_OPEN: never
|
|
run: bun run test:e2e -- --reporter=line
|
|
|
|
- name: Docker build
|
|
run: docker build --pull -t analytical-panel-frontend:ci .
|