mirror of
https://gitee.com/pnoker/iot-dc3.git
synced 2026-11-02 03:01:52 +08:00
123 lines
3.0 KiB
YAML
123 lines
3.0 KiB
YAML
name: Web CI
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
e2e_base_url:
|
|
description: 'Optional running web environment URL for Playwright e2e'
|
|
required: false
|
|
type: string
|
|
default: ''
|
|
pull_request:
|
|
paths:
|
|
- dc3-web/**
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
paths:
|
|
- dc3-web/**
|
|
workflow_dispatch:
|
|
inputs:
|
|
e2e_base_url:
|
|
description: 'Optional running web environment URL for Playwright e2e'
|
|
required: false
|
|
default: ''
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: web-ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
quality:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
defaults:
|
|
run:
|
|
working-directory: dc3-web
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
|
|
- name: Validate repository documentation
|
|
run: python3 ../dc3/bin/check_documentation.py
|
|
|
|
- name: Set pnpm
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86
|
|
with:
|
|
package_json_file: dc3-web/package.json
|
|
|
|
- name: Set Node
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: dc3-web/pnpm-lock.yaml
|
|
|
|
- name: Install
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Lint
|
|
run: pnpm run lint:check
|
|
|
|
- name: Type Check
|
|
run: pnpm run check
|
|
|
|
- name: Guardrails
|
|
run: pnpm run test:guard
|
|
|
|
- name: Test With Coverage
|
|
run: pnpm run test:ci
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
e2e:
|
|
if: ${{ github.event_name == 'workflow_dispatch' && inputs.e2e_base_url != '' }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
defaults:
|
|
run:
|
|
working-directory: dc3-web
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
|
|
|
|
- name: Set pnpm
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86
|
|
with:
|
|
package_json_file: dc3-web/package.json
|
|
|
|
- name: Set Node
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: dc3-web/pnpm-lock.yaml
|
|
|
|
- name: Install
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Install Playwright
|
|
run: pnpm exec playwright install --with-deps chromium
|
|
|
|
- name: E2E
|
|
run: pnpm run test:e2e
|
|
env:
|
|
E2E_BASE_URL: ${{ inputs.e2e_base_url }}
|
|
E2E_START_SERVER: '0'
|
|
|
|
- name: Upload Playwright Report
|
|
if: always()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
with:
|
|
name: playwright-report
|
|
path: |
|
|
dc3-web/playwright-report
|
|
dc3-web/test-results/e2e-results.json
|
|
dc3-web/test-results/e2e-artifacts
|
|
if-no-files-found: ignore
|