Merge pull request #35 from bartstc/chore/claude-setup #234
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: | |
| - core | |
| - basic | |
| pull_request: | |
| branches: | |
| - core | |
| - basic | |
| env: | |
| NODE_VERSION: "22.x" | |
| jobs: | |
| lint-tests: | |
| uses: ./.github/workflows/run-tests.yml | |
| with: | |
| test-type: lint | |
| test-command: pnpm lint | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| # For every direct push to target branches or when it's active PR | |
| if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Enable corepack | |
| run: corepack enable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: "pnpm" | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile --ignore-scripts | |
| - name: Run unit tests | |
| run: pnpm test:unit:ci | |
| - name: Upload test results | |
| if: success() || failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: unit-test-results | |
| path: reports/**/* | |
| - name: Upload coverage report | |
| if: success() || failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: unit-coverage-report | |
| path: coverage/**/* | |
| storybook-tests: | |
| runs-on: ubuntu-latest | |
| env: | |
| STORYBOOK_DISABLE_TELEMETRY: 1 | |
| STORYBOOK: "true" | |
| CI: true | |
| # For every direct push to target branches or when it's active PR | |
| if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Enable corepack | |
| run: corepack enable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: "pnpm" | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile --ignore-scripts | |
| - name: Get Playwright version | |
| id: playwright-version | |
| run: echo "version=$(jq -r '.devDependencies.playwright' package.json)" >> $GITHUB_OUTPUT | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| id: playwright-cache | |
| with: | |
| path: | | |
| ~/.cache/ms-playwright | |
| node_modules/.pnpm/playwright-core*/node_modules/playwright-core/.local-browsers | |
| key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }} | |
| restore-keys: | | |
| ${{ runner.os }}-playwright- | |
| - name: Install Playwright browsers | |
| if: steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: pnpm exec playwright install chromium --with-deps --only-shell | |
| - name: Run storybook tests | |
| run: pnpm test:storybook:ci | |
| - name: Upload test results | |
| if: success() || failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: storybook-test-results | |
| path: reports/**/* | |
| - name: Upload coverage report | |
| if: success() || failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: storybook-coverage-report | |
| path: coverage/**/* | |
| build: | |
| needs: [lint-tests, unit-tests, storybook-tests] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v2 | |
| id: pnpm-install | |
| with: | |
| version: 10.6.1 | |
| run_install: false | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "pnpm" | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile --ignore-scripts | |
| - name: Build an application | |
| run: pnpm build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build | |
| path: dist | |
| test-reports: | |
| needs: [unit-tests, storybook-tests] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Generate Full Coverage Report | |
| uses: danielpalme/ReportGenerator-GitHub-Action@v5 | |
| with: | |
| reports: "unit-coverage-report/lcov.info;storybook-coverage-report/lcov.info" | |
| reporttypes: "MarkdownSummaryGithub;JsonSummary;Html" | |
| targetdir: coverage-report | |
| - name: Add Coverage Report Comment to PR | |
| if: github.event_name == 'pull_request' | |
| run: gh pr comment $PR_NUMBER --body-file coverage-report/SummaryGithub.md | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.number }} | |
| - name: Publish Coverage Report in Build Summary | |
| run: cat coverage-report/SummaryGithub.md >> $GITHUB_STEP_SUMMARY | |
| - name: Upload Full Coverage Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: full-coverage-report | |
| path: coverage-report/**/* | |
| - name: Publish Test Results | |
| uses: dorny/test-reporter@v2 | |
| id: test-reporter | |
| with: | |
| name: Test Results | |
| path: unit-test-results/**/*.xml,storybook-test-results/**/*.xml | |
| reporter: jest-junit | |
| fail-on-error: false | |
| deploy: | |
| needs: [build, test-reports] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build | |
| - name: Outputs content | |
| run: ls | |
| - name: Deploy | |
| run: echo "Deploying..." |