Repository navigation
test: enforce code coverage and public API assertion gates #18
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: CRYChart CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - 'release/*' | |
| push: | |
| branches: | |
| - main | |
| - 'release/*' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| checks: | |
| name: CRYChart checks | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: 检出代码 | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: 安装 Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: npm | |
| - name: 安装锁定版本的依赖 | |
| run: npm ci | |
| - name: 检查类型 | |
| run: npm run typecheck | |
| - name: 运行单元测试和 OpenTest 合同并检查覆盖率 | |
| run: npm run test:coverage | |
| - name: 检查公开 API、字段和常量的功能场景及断言映射 | |
| run: npm run test:api | |
| - name: 构建库和示例 | |
| run: npm run build | |
| - name: 保存代码覆盖率报告 | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: code-coverage | |
| path: | | |
| codex_artifact/coverage/ | |
| !codex_artifact/coverage/tmp/** | |
| if-no-files-found: warn | |
| retention-days: 14 | |
| - name: 保存 API 测试映射和执行报告 | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: api-test-map | |
| path: | | |
| docs/api-test-map.json | |
| docs/api-test-map.md | |
| docs/api-test-policy.json | |
| codex_artifact/api-tests/ | |
| if-no-files-found: warn | |
| retention-days: 14 | |
| browser: | |
| name: CRYChart browser tests | |
| runs-on: windows-latest | |
| timeout-minutes: 20 | |
| env: | |
| CRYCHART_CHROME: 'C:/Program Files/Google/Chrome/Application/chrome.exe' | |
| CRYCHART_PORT: '4178' | |
| CRYCHART_CDP: 'http://127.0.0.1:9223' | |
| NO_PROXY: '127.0.0.1,localhost' | |
| steps: | |
| - name: 检出代码 | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: 安装 Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: npm | |
| - name: 安装锁定版本的依赖 | |
| run: npm ci | |
| - name: 构建库和示例 | |
| run: npm run build | |
| - name: 运行真实浏览器测试 | |
| run: npm run test:browser | |
| - name: 运行示例和交互测试 | |
| run: npm run test:gallery | |
| - name: 保存浏览器测试结果 | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: browser-test-results | |
| path: | | |
| codex_artifact/browser/ | |
| codex_artifact/gallery/ | |
| if-no-files-found: ignore | |
| retention-days: 7 |