update #29
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: π TypeScript SDK CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| jobs: | |
| quality: | |
| name: π Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π₯ Checkout code | |
| uses: actions/checkout@v4 | |
| - name: π§ Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: π¦ Install dependencies | |
| run: npm ci | |
| - name: π¨ Check Formatting | |
| run: | | |
| echo "::group::π¨ Prettier Formatting" | |
| npm run format:check | |
| echo "::endgroup::" | |
| - name: π Run Linting | |
| run: | | |
| echo "::group::π ESLint Linting" | |
| npm run lint | |
| echo "::endgroup::" | |
| - name: π¬ Type Checking | |
| run: | | |
| echo "::group::π¬ TypeScript Type Checking" | |
| npx tsc --noEmit | |
| echo "::endgroup::" | |
| - name: β Quality Summary | |
| if: success() | |
| run: | | |
| echo "::notice::β All code quality checks passed!" | |
| echo "- Formatting: PASSED" | |
| echo "- Linting: PASSED" | |
| echo "- Type checking: PASSED" | |
| test: | |
| name: π§ͺ Test Node.js ${{ matrix.node-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: ['18.20.5', '20.18.1', '22.12.0'] | |
| steps: | |
| - name: π₯ Checkout code | |
| uses: actions/checkout@v4 | |
| - name: π§ Set up Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: π¦ Install dependencies | |
| run: npm ci | |
| - name: ποΈ Build package | |
| run: npm run build | |
| - name: π§ͺ Run Core Tests | |
| run: | | |
| echo "::group::π§ͺ Core Tests" | |
| npm run test:core -- --run | |
| echo "::endgroup::" | |
| - name: π Run Performance Tests | |
| continue-on-error: true | |
| run: | | |
| echo "::group::π Performance Tests" | |
| npm run test:perf -- --run | |
| echo "::endgroup::" | |
| - name: π Generate Coverage Report | |
| if: matrix.node-version == '20.18.1' | |
| run: npm run test:coverage -- --run | |
| - name: π Upload Coverage | |
| if: matrix.node-version == '20.18.1' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage/coverage-final.json | |
| flags: unittests | |
| name: typescript-sdk | |
| fail_ci_if_error: false | |
| build: | |
| name: ποΈ Build & Package | |
| runs-on: ubuntu-latest | |
| needs: [quality, test] | |
| steps: | |
| - name: π₯ Checkout code | |
| uses: actions/checkout@v4 | |
| - name: π§ Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: π¦ Install dependencies | |
| run: npm ci | |
| - name: ποΈ Build package | |
| run: npm run build | |
| - name: π¦ Check package | |
| run: | | |
| npm pack --dry-run | |
| echo "β Package is ready for publishing" | |
| - name: π€ Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| cross-platform: | |
| name: π₯οΈ Test ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-latest, macos-latest] | |
| node-version: ['20.18.1'] | |
| steps: | |
| - name: π₯ Checkout code | |
| uses: actions/checkout@v4 | |
| - name: π§ Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: π¦ Install dependencies | |
| run: npm ci | |
| - name: ποΈ Build package | |
| run: npm run build | |
| - name: π§ͺ Run Core Tests | |
| run: npm run test:core -- --run | |
| summary: | |
| name: π CI Summary | |
| runs-on: ubuntu-latest | |
| needs: [quality, test, build, cross-platform] | |
| if: always() | |
| steps: | |
| - name: π Summary | |
| run: | | |
| echo "## π CI Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Check | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| π Code Quality | ${{ needs.quality.result == 'success' && 'β Passed' || 'β Failed' }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| π§ͺ Tests | ${{ needs.test.result == 'success' && 'β Passed' || 'β Failed' }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| ποΈ Build | ${{ needs.build.result == 'success' && 'β Passed' || 'β Failed' }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| π₯οΈ Cross-Platform | ${{ needs.cross-platform.result == 'success' && 'β Passed' || 'β Failed' }} |" >> $GITHUB_STEP_SUMMARY |