Skip to content

feat: 完成 Web UI 全量替换收口 #593

feat: 完成 Web UI 全量替换收口

feat: 完成 Web UI 全量替换收口 #593

Workflow file for this run

name: BetterAINote CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
defaults:
run:
shell: bash
env:
NODE_VERSION: "20"
BUN_VERSION: "1.2.20"
NODE_OPTIONS: --max_old_space_size=4096
jobs:
lint:
name: Lint and check format
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out BetterAINote
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install dependencies
run: bun install --frozen-lockfile --ignore-scripts
- name: Run Biome
run: bun run format-and-lint
typecheck:
name: Run type check
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out BetterAINote
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install dependencies
run: bun install --frozen-lockfile --ignore-scripts
- name: Run type check
run: bun run type-check
test:
name: Run tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out BetterAINote
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install dependencies
run: bun install --frozen-lockfile --ignore-scripts
- name: Run Vitest with coverage
run: bun run test:coverage
- name: Normalize LCOV for Codecov line coverage
run: perl -0pi -e 's/^BR(?:DA|F|H):.*\n//mg' coverage/lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
flags: unit
fail_ci_if_error: false
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./junit.xml
report_type: test_results
flags: unit
fail_ci_if_error: false
build:
name: Build
needs: [lint, typecheck, test]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out BetterAINote
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install dependencies
run: bun install --frozen-lockfile --ignore-scripts
- name: Prepare CI workspace
run: mkdir -p tmp/ci/storage
- name: Build application
run: bun run build
env:
DATABASE_PATH: ./tmp/ci/betterainote.db
TRANSCRIPT_WORDS_DATABASE_PATH: ./tmp/ci/betterainote-words.db
LOCAL_STORAGE_PATH: ./tmp/ci/storage
BETTER_AUTH_SECRET: 0123456789abcdef0123456789abcdef
ENCRYPTION_KEY: 0000000000000000000000000000000000000000000000000000000000000000
APP_URL: http://localhost:3001