diff --git a/.github/workflows/fe-ci-storybook.yml b/.github/workflows/fe-ci-storybook.yml new file mode 100644 index 00000000..7194d6a7 --- /dev/null +++ b/.github/workflows/fe-ci-storybook.yml @@ -0,0 +1,70 @@ +name: FRONTEND-CI-STORYBOOK + +on: + pull_request: + types: [opened, synchronize, reopened] + branches: + - dev + - main + paths: + - 'src/frontend/packages/ui/**' + - '../workflows/fe-ci-storybook.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + changes: + if: ${{ github.actor != 'l10nbot' }} # Avoid running for 'l10nbot' + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - uses: pnpm/action-setup@v3 + with: + version: 8 + + - name: Cache dependencies + uses: actions/cache/restore@v4 + with: + path: | + ~/.pnpm-store + **/node_modules + src/frontend/node_modules + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + + - name: Install pnpm + run: npm install -g pnpm + + - name: Install dependencies + run: | + cd src/frontend + pnpm install --strict-peer-dependencies=false --no-frozen-lockfile + pnpm add turbo --save-dev -w + + - name: CI + run: | + cd src/frontend + pnpm turbo typescript lint format build-storybook --parallel + + required: + needs: [changes] + if: always() + runs-on: ubuntu-latest + steps: + - name: fail if conditional jobs failed + if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled') + run: exit 1 diff --git a/.github/workflows/fe-ci.yml b/.github/workflows/fe-ci.yml index 9fbdfd51..d1fd41f4 100644 --- a/.github/workflows/fe-ci.yml +++ b/.github/workflows/fe-ci.yml @@ -8,6 +8,13 @@ on: - main paths: - 'src/frontend/**' + - '!src/frontend/packages/ui/**' + - '../workflows/fe-ci.yml' + # push: + # branches: + # - fe-feat/ci-storybook + # paths: + # - '!src/frontend/packages/ui/**' concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -25,16 +32,22 @@ jobs: with: fetch-depth: 2 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + - uses: pnpm/action-setup@v3 with: version: 8 - name: Cache dependencies - uses: actions/cache@v4 + uses: actions/cache/restore@v4 with: path: | ~/.pnpm-store - node_modules + **/node_modules + src/frontend/node_modules key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- @@ -51,7 +64,7 @@ jobs: - name: CI run: | cd src/frontend - pnpm turbo typescript lint format build build-storybook --parallel + pnpm turbo typescript lint format build --parallel required: needs: [changes] diff --git a/src/frontend/packages/ui/package.json b/src/frontend/packages/ui/package.json index 2df7a6af..f074b563 100644 --- a/src/frontend/packages/ui/package.json +++ b/src/frontend/packages/ui/package.json @@ -6,7 +6,7 @@ "scripts": { "lint": "eslint . --max-warnings 50", "storybook": "storybook dev -p 6006", - "build-storybook": "storybook build" + "build-storybook": "storybook build -o storybook-static" }, "dependencies": { "@radix-ui/react-avatar": "^1.1.2", diff --git a/src/frontend/turbo.json b/src/frontend/turbo.json index a698c599..03609e11 100644 --- a/src/frontend/turbo.json +++ b/src/frontend/turbo.json @@ -5,19 +5,19 @@ "build": { "dependsOn": ["^build"], "inputs": ["$TURBO_DEFAULT$", ".env*"], - "outputs": ["dist/**"] + "outputs": [".next/**"] }, "build-storybook": { - "dependsOn": ["^build"], + "dependsOn": ["^build-storybook"], "inputs": ["$TURBO_DEFAULT$", ".env*"], - "outputs": ["packages/ui/storybook-static/**"], + "outputs": ["storybook-static/**"], "cache": true, "persistent": false }, "storybook": { "dependsOn": ["^storybook"], "inputs": ["$TURBO_DEFAULT$", ".env*"], - "outputs": ["packages/ui/storybook-static/**"], + "outputs": ["storybook-static/**"], "cache": true, "persistent": false }, @@ -27,13 +27,6 @@ "cache": false, "persistent": false }, - "check-types": { - "dependsOn": ["^check-types"], - "inputs": ["$TURBO_DEFAULT$", "tsconfig.json", "packages/**/tsconfig.json"], - "outputs": ["packages/**/dist/**"], - "cache": true, - "persistent": false - }, "dev": { "cache": false, "persistent": true @@ -47,7 +40,6 @@ "typescript": { "dependsOn": ["^typescript"], "inputs": ["$TURBO_DEFAULT$", "tsconfig.json", "packages/**/tsconfig.json"], - "outputs": ["packages/**/dist/**"], "cache": true, "persistent": false }