chor: Format new refactored code #35
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 | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Lint & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Lint | |
| run: npm run lint || true # Continue to see test results | |
| - name: Run Tests with Coverage | |
| run: npm test -- --coverage | |
| - name: Upload Test Report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-report | |
| path: test-report/ | |
| retention-days: 14 | |
| - name: Upload Coverage Report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: coverage-report | |
| path: coverage/ | |
| retention-days: 14 | |
| - name: Sync Reports to Wiki | |
| if: github.ref == 'refs/heads/master' | |
| uses: Andrew-Chen-Wang/github-wiki-action@v4 | |
| with: | |
| token: ${{ secrets.WIKI_ACTION_TOKEN || github.token }} | |
| path: test-report | |
| commit-message: "docs: update test and coverage reports [skip ci]" | |
| - name: Job Summary | |
| run: | | |
| echo "## CI Results" >> $GITHUB_STEP_SUMMARY | |
| echo "✅ Pipeline execution completed." >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Artifacts" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Test Report:** Visual HTML report of all test cases." >> $GITHUB_STEP_SUMMARY | |
| echo "- **Coverage Report:** Detailed code coverage metrics." >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Latest reports are also available on the [GitHub Wiki](https://github.com/${{ github.repository }}/wiki/test-report)." >> $GITHUB_STEP_SUMMARY |