build: 固化 dist/package.json 生成到 build 脚本与启动脚本 #96
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [master, main] | |
| pull_request: | |
| branches: [master, main] | |
| jobs: | |
| typecheck: | |
| name: TypeScript Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| - run: npm ci | |
| - run: npx tsc --noEmit | |
| test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| - run: npm ci | |
| # 设置 DB_PATH 避免 db.ts 初始化时找不到数据库文件 | |
| - run: DB_PATH=./test_ci.db npm run test:unit | |
| coverage: | |
| name: Coverage Report | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "npm" | |
| - run: npm ci | |
| - run: DB_PATH=./test_ci.db npm run test:unit -- --coverage.reporter=lcov --coverage.reporter=text-summary | |
| - name: Upload coverage to Codecov | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false |