Project overhaul #2
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, main] | |
| pull_request: | |
| branches: [master, main] | |
| workflow_dispatch: | |
| jobs: | |
| # Run tests on every push/PR | |
| test: | |
| name: Test (React ${{ matrix.react-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| react-version: ['17', '18', '19'] | |
| include: | |
| - react-version: '17' | |
| react-pkg: 'react@17.0.2' | |
| react-dom-pkg: 'react-dom@17.0.2' | |
| react-types: '@types/react@17.0.1' | |
| - react-version: '18' | |
| react-pkg: 'react@18.3.1' | |
| react-dom-pkg: 'react-dom@18.3.1' | |
| react-types: '@types/react@18.3.1' | |
| - react-version: '19' | |
| react-pkg: 'react@19.0.0' | |
| react-dom-pkg: 'react-dom@19.0.0' | |
| react-types: '@types/react@19.0.0' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Install React ${{ matrix.react-version }} | |
| run: | | |
| bun add -d ${{ matrix.react-pkg }} ${{ matrix.react-dom-pkg }} ${{ matrix.react-types }} | |
| - name: Run tests | |
| run: bun run test | |
| env: | |
| CI: true | |
| # Lint check | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Run ESLint | |
| run: bun run lint | |
| continue-on-error: true | |
| # Build check | |
| build: | |
| name: Build Package | |
| runs-on: ubuntu-latest | |
| needs: [test, lint] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Setup Node.js (for npm publish) | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build package | |
| run: bun run build:package | |
| - name: Build demo page | |
| run: bun run build:demo | |
| - name: Upload package artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: package-dist | |
| path: dist/ | |
| retention-days: 7 | |
| - name: Upload demo artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: demo-build | |
| path: build/ | |
| retention-days: 7 |