Update package.json #4
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 | |
| on: | |
| push: | |
| branches: [main, master, dev] | |
| pull_request: | |
| branches: [main, master, dev] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18, 20, 22] | |
| steps: | |
| - 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: Check TypeScript compilation | |
| run: npm run type-check | |
| - name: Run tests with coverage | |
| run: npm run test:run | |
| - name: Build package | |
| run: npm run build | |
| - name: Verify build output | |
| run: | | |
| test -f dist/index.js | |
| test -f dist/index.d.ts | |
| echo "Build verification successful" | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Check TypeScript | |
| run: npm run type-check | |
| - name: Verify package integrity | |
| run: npm run prepublishOnly --dry-run || echo "Package preparation check complete" | |
| demo-test: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install root dependencies | |
| run: npm ci | |
| - name: Build package | |
| run: npm run build | |
| - name: Install demo dependencies | |
| run: | | |
| cd demo | |
| npm ci | |
| - name: Build demo | |
| run: | | |
| cd demo | |
| npm run build |