chore: upgrade deps #7
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: [main, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| workflow_dispatch: | |
| # Cancel in-progress runs for the same PR/branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| checks: write | |
| jobs: | |
| # Detect what changed to optimize CI runs | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| src: ${{ steps.filter.outputs.src }} | |
| tests: ${{ steps.filter.outputs.tests }} | |
| docs: ${{ steps.filter.outputs.docs }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| src: | |
| - 'src/**' | |
| - 'package.json' | |
| - 'pnpm-lock.yaml' | |
| - 'tsconfig*.json' | |
| - 'rollup.config.*' | |
| tests: | |
| - 'tests/**' | |
| - 'jest.config.*' | |
| - '**/*.test.ts' | |
| - '**/*.spec.ts' | |
| docs: | |
| - '**/*.md' | |
| - 'docs/**' | |
| lint: | |
| needs: changes | |
| if: needs.changes.outputs.src == 'true' || github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup environment | |
| uses: ./.github/actions/setup | |
| with: | |
| node-version: 20 | |
| - name: Lint code | |
| run: pnpm run check | |
| - name: Type check | |
| run: pnpm run type-check | |
| - name: Check commit messages | |
| if: github.event_name == 'pull_request' | |
| uses: wagoid/commitlint-github-action@v6 | |
| test: | |
| needs: changes | |
| if: needs.changes.outputs.src == 'true' || needs.changes.outputs.tests == 'true' || github.event_name == 'push' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| node: [18, 20, 22] | |
| include: | |
| # Test on other OS with latest Node only | |
| - os: windows-latest | |
| node: 20 | |
| - os: macos-latest | |
| node: 20 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup environment | |
| uses: ./.github/actions/setup | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Build package for compatibility tests | |
| run: pnpm run build | |
| - name: Run tests | |
| run: pnpm run test:ci | |
| env: | |
| CI: true | |
| - name: Upload coverage | |
| if: matrix.os == 'ubuntu-latest' && matrix.node == 20 | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/lcov.info | |
| flags: unittests | |
| name: codecov-${{ matrix.os }}-node${{ matrix.node }} | |
| build: | |
| needs: [lint] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup environment | |
| uses: ./.github/actions/setup | |
| with: | |
| node-version: 20 | |
| - name: Build package | |
| run: pnpm run build | |
| - name: Validate package | |
| run: | | |
| npx publint | |
| npx @arethetypeswrong/cli --pack . || echo "Type validation warnings detected but continuing..." | |
| continue-on-error: true | |
| - name: Check bundle size | |
| if: github.event_name == 'pull_request' | |
| uses: andresz1/size-limit-action@v1 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| skip_step: install | |
| build_script: build | |
| continue-on-error: true | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-${{ github.sha }} | |
| path: dist/ | |
| retention-days: 7 | |
| compatibility: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup environment | |
| uses: ./.github/actions/setup | |
| with: | |
| node-version: 20 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-${{ github.sha }} | |
| path: dist/ | |
| - name: Test CommonJS compatibility | |
| run: pnpm test:commonjs | |
| - name: Test ESM compatibility | |
| run: pnpm test:esm | |
| - name: Test TypeScript compatibility | |
| run: pnpm test:typescript | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup environment | |
| uses: ./.github/actions/setup | |
| with: | |
| node-version: 20 | |
| - name: Run security audit | |
| run: pnpm audit --production | |
| continue-on-error: true | |
| - name: Run Snyk security scan | |
| uses: snyk/actions/node@master | |
| with: | |
| args: --severity-threshold=high | |
| env: | |
| SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
| continue-on-error: true | |
| docs: | |
| needs: changes | |
| if: needs.changes.outputs.docs == 'true' || needs.changes.outputs.src == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup environment | |
| uses: ./.github/actions/setup | |
| with: | |
| node-version: 20 | |
| - name: Generate documentation | |
| run: pnpm run docs | |
| - name: Upload docs artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docs-${{ github.sha }} | |
| path: docs/ | |
| retention-days: 7 | |
| # Summary job for branch protection | |
| ci-complete: | |
| needs: [lint, test, build, compatibility] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: All checks passed | |
| run: | | |
| passed="${{ !contains(needs.*.result, 'failure') }}" | |
| if [[ $passed == "true" ]]; then | |
| echo "✅ All CI checks passed!" | |
| exit 0 | |
| else | |
| echo "❌ Some CI checks failed" | |
| exit 1 | |
| fi |