chore(release): 0.0.13 #45
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/CD Pipeline | |
| on: | |
| pull_request: | |
| branches: [master, develop] | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| push: | |
| branches: [master, develop] | |
| tags: ['v*'] | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 2 * * 1' # Weekly dependency check | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| NODE_ENV: ci | |
| FORCE_COLOR: 3 | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| security-events: write | |
| jobs: | |
| changes: | |
| name: 🔍 Detect Changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| src: ${{ steps.changes.outputs.src }} | |
| tests: ${{ steps.changes.outputs.tests }} | |
| deps: ${{ steps.changes.outputs.deps }} | |
| docs: ${{ steps.changes.outputs.docs }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: changes | |
| with: | |
| filters: | | |
| src: | |
| - 'src/**' | |
| - 'package.json' | |
| - 'tsconfig.json' | |
| - 'bunfig.toml' | |
| tests: | |
| - 'tests/**' | |
| - 'vitest.config.ts' | |
| deps: | |
| - 'package.json' | |
| - 'bun.lockb' | |
| docs: | |
| - '**.md' | |
| - 'assets/**' | |
| security: | |
| name: 🔒 Security Audit | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'schedule' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: ".bun-version" | |
| - name: 🔍 Audit dependencies | |
| run: bun audit | |
| - name: 📋 Initialize CodeQL | |
| uses: github/codeql-action/init@v3 | |
| with: | |
| languages: typescript | |
| - name: 🏗️ Autobuild | |
| uses: github/codeql-action/autobuild@v3 | |
| - name: 🔬 Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v3 | |
| lint: | |
| name: 🔍 Code Quality | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: needs.changes.outputs.src == 'true' || needs.changes.outputs.tests == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: ".bun-version" | |
| - name: 📦 Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - name: 📦 Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: 🛠️ Build project | |
| run: bun run build | |
| - name: 🎨 Prettier check | |
| run: bun run format:check | |
| - name: 📊 Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-output | |
| path: dist/ | |
| retention-days: 7 | |
| test: | |
| name: 🧪 Test Suite | |
| runs-on: ${{ matrix.os }} | |
| needs: [changes, lint] | |
| if: needs.changes.outputs.src == 'true' || needs.changes.outputs.tests == 'true' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| node-version: [18, 20, 22] | |
| include: | |
| - os: ubuntu-latest | |
| node-version: 18 | |
| coverage: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: ".bun-version" | |
| - name: 📦 Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - name: 📦 Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: 🛠️ Build project | |
| run: bun run build | |
| - name: 💪 Type checking | |
| run: bun test:types | |
| - name: 🧪 Run tests | |
| run: bun test:coverage | |
| env: | |
| CI: true | |
| - name: 📊 Generate test report | |
| if: always() | |
| run: bun test:junit | |
| - name: 📈 Upload test results | |
| if: always() && matrix.coverage | |
| uses: codecov/test-results-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: test-report.junit.xml | |
| slug: ali-master/prune-mod | |
| - name: 🟩 Upload coverage | |
| if: matrix.coverage && !cancelled() | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true | |
| slug: ali-master/prune-mod | |
| integration: | |
| name: 🔗 Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| if: github.event_name == 'push' || github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: ".bun-version" | |
| - name: 📦 Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: 🛠️ Build project | |
| run: bun run build | |
| - name: 🔧 Make CLI executable | |
| run: chmod +x ./dist/runtime.js | |
| - name: 🧪 Test CLI functionality | |
| run: | | |
| # Test basic functionality | |
| ./dist/runtime.js --help | |
| ./dist/runtime.js --version | |
| # Create test environment | |
| mkdir -p test-env/node_modules/example-package/docs | |
| echo '{"name": "example-package"}' > test-env/node_modules/example-package/package.json | |
| echo 'test docs' > test-env/node_modules/example-package/docs/README.md | |
| # Test pruning | |
| cd test-env | |
| ../dist/runtime.js --dry-run | |
| ../dist/runtime.js | |
| performance: | |
| name: ⚡ Performance Benchmarks | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: ".bun-version" | |
| - name: 📦 Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: 🛠️ Build project | |
| run: bun run build | |
| - name: 🔧 Make CLI executable | |
| run: chmod +x ./dist/runtime.js | |
| - name: 📊 Run benchmarks | |
| run: | | |
| # Create large test environment | |
| mkdir -p benchmark-env/node_modules | |
| for i in {1..100}; do | |
| mkdir -p "benchmark-env/node_modules/package-$i/docs" | |
| mkdir -p "benchmark-env/node_modules/package-$i/tests" | |
| mkdir -p "benchmark-env/node_modules/package-$i/coverage" | |
| echo "{\"name\": \"package-$i\"}" > "benchmark-env/node_modules/package-$i/package.json" | |
| echo "docs content" > "benchmark-env/node_modules/package-$i/docs/README.md" | |
| echo "test content" > "benchmark-env/node_modules/package-$i/tests/test.js" | |
| done | |
| echo "📊 Benchmarking prune-mod performance..." | |
| cd benchmark-env | |
| time ../dist/runtime.js --dry-run | |
| time ../dist/runtime.js | |
| release: | |
| name: 🚀 Release | |
| runs-on: ubuntu-latest | |
| needs: [security, lint, test, integration] | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') # Only run on version tags | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: ".bun-version" | |
| - name: 📦 Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: 🛠️ Build project | |
| run: bun run build | |
| - name: 📦 Publish to NPM | |
| run: bun publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: 🏷️ Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| dist/* | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }} | |
| dependency-review: | |
| name: 🔍 Dependency Review | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/dependency-review-action@v4 | |
| with: | |
| fail-on-severity: moderate |