Merge pull request #16 from dev-ignis/develop #88
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] # Run on both main and develop branches | |
| # Skip CI if release workflow will handle it | |
| tags-ignore: | |
| - 'v*' | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| # Don't run CI twice when release workflow triggers | |
| if: | | |
| github.event_name == 'pull_request' || | |
| !contains(github.event.head_commit.message, 'chore(release)') | |
| strategy: | |
| matrix: | |
| node-version: [18.x, 20.x] | |
| 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 }} | |
| - name: Cache node_modules | |
| uses: actions/cache@v4 | |
| id: npm-cache | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node-${{ matrix.node-version }}- | |
| - name: Install dependencies | |
| if: steps.npm-cache.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - name: Run linter | |
| run: npm run lint | |
| - name: Type check | |
| run: npm run type-check | |
| - name: Run tests | |
| run: npm test | |
| - name: Run tests with coverage | |
| run: npm run test:coverage | |
| - name: Upload coverage reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-${{ matrix.node-version }} | |
| path: coverage/ | |
| retention-days: 7 | |
| - name: Build library | |
| run: npm run build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-${{ matrix.node-version }} | |
| path: dist/ | |
| retention-days: 7 | |
| build-docs: | |
| name: Build Documentation | |
| 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' | |
| - name: Cache node_modules | |
| uses: actions/cache@v4 | |
| id: npm-cache | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-20.x-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node-20.x- | |
| - name: Install dependencies | |
| if: steps.npm-cache.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - name: Build Storybook | |
| run: npm run build-storybook | |
| - name: Upload Storybook artifacts | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: storybook-static | |
| path: storybook-static/ | |
| retention-days: 7 |