Refactor module imports and update type declarations to use 'dabby.js… #6
Workflow file for this run
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: | |
| push: | |
| branches: [ master, exp-ts ] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [ master ] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| lint: | |
| name: Lint Code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Check TypeScript formatting | |
| run: | | |
| echo "Checking TypeScript files..." | |
| # Add your linter here when configured | |
| # npx eslint "src/**/*.ts" | |
| test-matrix: | |
| name: Test on Node ${{ matrix.node-version }} / ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: [18.x, 20.x, 22.x] | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup 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 project | |
| run: npm run build | |
| - name: TypeScript compilation check | |
| run: npm run tsc | |
| - name: Type definition tests | |
| run: npm run test:types | |
| coverage: | |
| name: Code Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build project | |
| run: npm run build | |
| - name: Generate type coverage report | |
| run: | | |
| echo "# Type Coverage Report" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "## TypeScript Strict Mode" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ strict: true" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ noImplicitAny: true" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ strictNullChecks: true" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ strictFunctionTypes: true" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ noUnusedLocals: true" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ noUnusedParameters: true" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ noImplicitReturns: true" >> $GITHUB_STEP_SUMMARY | |
| publish-npm: | |
| name: Publish to NPM | |
| runs-on: ubuntu-latest | |
| needs: [lint, test-matrix, coverage] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build project | |
| run: npm run build | |
| - name: Run tests | |
| run: | | |
| npm run tsc | |
| npm run test:types | |
| - name: Publish to NPM | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| create-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [publish-npm] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build project | |
| run: npm run build | |
| - name: Create release bundle | |
| run: | | |
| mkdir -p release | |
| cp dist/dabby.min.js release/ | |
| cp dist/dabby.js release/ | |
| cp dist/modular.js release/ | |
| cp dist/modular.d.ts release/ | |
| cp package.json release/ | |
| cp README.md release/ || echo "No README found" | |
| tar -czf dabby-${{ github.ref_name }}.tar.gz release/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| dabby-${{ github.ref_name }}.tar.gz | |
| dist/dabby.min.js | |
| dist/dabby.js | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }} |