Files
new-api/.github/workflows/ci.yml
T
QuentinHsu e2c7aa7b10 test(web): standardize frontend tests on Vitest (#6569)
* test(web): standardize frontend tests on Vitest

- configure Vitest, jsdom, and React Testing Library with shared test scripts.
- migrate existing node:test suites to the Vitest runner.
- rewrite JsonCodeEditor component tests with RTL and remove the direct happy-dom dependency.

* fix(ci): run frontend tests with Vitest

- invoke the configured Vitest script so browser test setup loads in CI.
- migrate remaining node:test suites to Vitest lifecycle APIs.

* test(web): use shared jsdom environment for component tests

- migrate usage cost and tool price tests to React Testing Library.
- remove duplicate happy-dom globals and rely on the configured Vitest setup.

* test(web): verify behavior with shared vitest setup

- replace Node test assertions with Vitest expect across frontend suites.
- migrate Keys component tests to React Testing Library interactions.
- centralize jsdom browser mocks for consistent component execution.

* fix(web): unblock frozen installs and Vitest CI

- sync dompurify 3.4.13 metadata into the Bun lockfile.
- replace the bun:test and happy-dom redemption harness with Vitest and RTL.
- preserve quota conversion, error feedback, and stale-response coverage in jsdom.
2026-08-15 14:18:10 +08:00

89 lines
2.3 KiB
YAML

name: CI
on:
pull_request:
types: [opened, synchronize, closed]
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
backend:
name: Backend vet, build, and test
if: github.event.action != 'closed' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
timeout-minutes: 15
env:
GOWORK: 'off'
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: ${{ github.event.pull_request.base.repo.full_name }}
ref: ${{ github.event.action == 'closed' && github.event.pull_request.base.ref || github.ref }}
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: go.mod
cache-dependency-path: |
go.sum
relaykit/go.sum
- name: Create frontend embed placeholder
run: |
mkdir -p web/dist
touch web/dist/index.html
- name: Vet root module
run: go vet ./...
- name: Vet relaykit independently
working-directory: relaykit
run: go vet ./...
- name: Build root module
run: go build ./...
- name: Build relaykit independently
working-directory: relaykit
run: go build ./...
- name: Test root and relaykit modules
run: make test
frontend:
name: Frontend typecheck and test
if: github.event.action != 'closed' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: web
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: ${{ github.event.pull_request.base.repo.full_name }}
ref: ${{ github.event.action == 'closed' && github.event.pull_request.base.ref || github.ref }}
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: '1.3.14'
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Typecheck
run: bun run typecheck
- name: Test
run: bun run test