diff --git a/.github/workflows/fe-ci.yml b/.github/workflows/fe-ci.yml index e64c2c37..460a0e95 100644 --- a/.github/workflows/fe-ci.yml +++ b/.github/workflows/fe-ci.yml @@ -9,10 +9,13 @@ on: paths: - 'src/frontend/**' - './fe-ci.yml' + push: + branches: + - fe-fix/ci-bug concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true + cancel-in-progress: false jobs: lint-test: @@ -21,7 +24,6 @@ jobs: timeout-minutes: 10 env: TZ: Asia/Seoul - TURBO_CACHE_DIR: ./src/frontend/.turbo strategy: matrix: task: [lint, test] @@ -46,27 +48,31 @@ jobs: with: path: ~/.pnpm-store key: ${{ runner.os }}-pnpm-${{ hashFiles('src/frontend/pnpm-lock.yaml') }} - restore-keys: ${{ runner.os }}-pnpm- + restore-keys: | + ${{ runner.os }}-pnpm- - name: Restore Turbo cache - id: restore_turbo_cache uses: actions/cache@v4 with: path: src/frontend/.turbo key: ${{ runner.os }}-turbo-${{ hashFiles('src/frontend/pnpm-lock.yaml') }} - restore-keys: ${{ runner.os }}-turbo + restore-keys: | + ${{ runner.os }}-turbo- - - name: Install Dependencies + - name: Install Dependencies (if necessary) working-directory: src/frontend - run: pnpm install --frozen-lockfile --prefer-offline + run: | + if [ ! -d "node_modules" ]; then + pnpm install --frozen-lockfile --prefer-offline + fi - name: Run Task with Cache working-directory: src/frontend run: | if [ "${{ matrix.task }}" = "lint" ]; then - pnpm turbo lint --parallel --cache-dir=.turbo + pnpm exec turbo lint --parallel elif [ "${{ matrix.task }}" = "test" ]; then - pnpm turbo test --filter=web --parallel --cache-dir=.turbo + pnpm exec turbo test --filter=web --parallel fi build: @@ -75,7 +81,10 @@ jobs: timeout-minutes: 10 env: TZ: Asia/Seoul - TURBO_CACHE_DIR: ./src/frontend/.turbo + strategy: + matrix: + package: ['web', '@workspace/ui'] + steps: - name: Checkout Code uses: actions/checkout@v4 @@ -97,27 +106,39 @@ jobs: with: path: ~/.pnpm-store key: ${{ runner.os }}-pnpm-${{ hashFiles('src/frontend/pnpm-lock.yaml') }} - restore-keys: ${{ runner.os }}-pnpm- + restore-keys: | + ${{ runner.os }}-pnpm- - name: Restore Turbo cache - id: restore_turbo_build_cache uses: actions/cache@v4 with: path: src/frontend/.turbo - key: ${{ runner.os }}-turbo-${{ github.sha }} - restore-keys: ${{ runner.os }}-turbo- + key: ${{ runner.os }}-turbo-${{ hashFiles('src/frontend/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-turbo- + + - name: Restore Next.js cache (for web) + if: matrix.package == 'web' + uses: actions/cache@v4 + with: + path: src/frontend/apps/web/.next + key: ${{ runner.os }}-nextjs-${{ hashFiles('src/frontend/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-nextjs- - name: Install Dependencies working-directory: src/frontend - run: pnpm install --frozen-lockfile --prefer-offline + run: | + pnpm install --frozen-lockfile --prefer-offline - - name: Run Build with Cache + - name: Run Build with Cache (Web) + if: matrix.package == 'web' working-directory: src/frontend - run: pnpm turbo build --parallel --cache-dir=.turbo + run: | + pnpm run build --filter=web --parallel - - name: Save Turbo cache - if: always() && steps.restore_turbo_build_cache.outputs.cache-hit != 'true' - uses: actions/cache@v4 - with: - path: src/frontend/.turbo - key: ${{ runner.os }}-turbo-${{ github.sha }} + - name: Run Build with Cache (@workspace/ui) + if: matrix.package == '@workspace/ui' + working-directory: src/frontend + run: | + pnpm run build --filter=@workspace/ui --parallel diff --git a/src/frontend/.gitignore b/src/frontend/.gitignore index cb4a7e05..37b36fdd 100644 --- a/src/frontend/.gitignore +++ b/src/frontend/.gitignore @@ -19,9 +19,12 @@ coverage out/ build dist +es +lib # Debug npm-debug.log* +pnpm-debug.log* # Misc .DS_Store diff --git a/src/frontend/apps/web/src/features/workspace/model/useWorkspaceChannels.test.tsx b/src/frontend/apps/web/src/features/workspace/model/useWorkspaceChannels.test.tsx index 13c39857..04659e0c 100644 --- a/src/frontend/apps/web/src/features/workspace/model/useWorkspaceChannels.test.tsx +++ b/src/frontend/apps/web/src/features/workspace/model/useWorkspaceChannels.test.tsx @@ -135,8 +135,9 @@ describe('useWorkspaceChannels', () => { { wrapper }, ); rerender(); - await waitFor(() => - result.current.joinedChannels.some((ch) => ch.channelId === 3), + await waitFor( + () => result.current.joinedChannels.some((ch) => ch.channelId === 3), + { timeout: 2000 }, ); expect(result.current.joinedChannels).toContainEqual(mockSocketMessage); expect(result.current.unjoinedChannels).toEqual([]); diff --git a/src/frontend/apps/web/vitest.config.ts b/src/frontend/apps/web/vitest.config.ts index 1e0799bc..f943c3b8 100644 --- a/src/frontend/apps/web/vitest.config.ts +++ b/src/frontend/apps/web/vitest.config.ts @@ -6,7 +6,7 @@ export default defineConfig({ plugins: [react()], test: { environment: 'jsdom', - testTimeout: 10000, + testTimeout: 25000, setupFiles: './vitest-setup.ts', globals: true, exclude: [ diff --git a/src/frontend/turbo.json b/src/frontend/turbo.json index f15d3ec8..607ab402 100644 --- a/src/frontend/turbo.json +++ b/src/frontend/turbo.json @@ -1,6 +1,8 @@ { "$schema": "https://turbo.build/schema.json", + "cacheDir": ".turbo/cache", "globalEnv": [ + "NEXT_PUBLIC_REAL_BASE_URL", "NEXT_PUBLIC_MODE", "NEXT_PUBLIC_BASE_URL", "NEXT_PUBLIC_GATEWAY_SERVER_PORT", @@ -18,11 +20,10 @@ "ui": "tui", "tasks": { "build": { - "dependsOn": [], + "dependsOn": ["^build"], "inputs": ["$TURBO_DEFAULT$"], - "outputs": ["apps/web/.next/**/*", "packages/ui/dist/**/*"], - "cache": true, - "persistent": false + "outputs": [".next/**", "dist/**", "!.next/cache/**", "build/**"], + "cache": true }, "test": { "dependsOn": [], @@ -38,14 +39,14 @@ "build-storybook": { "dependsOn": ["^build-storybook"], "inputs": ["$TURBO_DEFAULT$"], - "outputs": ["./packages/ui/storybook-static/**"], + "outputs": ["storybook-static/**"], "cache": true, "persistent": false }, "storybook": { "dependsOn": ["^storybook"], "inputs": ["$TURBO_DEFAULT$"], - "outputs": ["./packages/ui/storybook-static/**"], + "outputs": ["storybook-static/**"], "cache": true, "persistent": false }, @@ -58,22 +59,6 @@ "dev": { "cache": false, "persistent": true - }, - "format": { - "dependsOn": ["^format"], - "inputs": ["$TURBO_DEFAULT$", "**/*.{js,ts,jsx,tsx,json,md}"], - "cache": false, - "persistent": false - }, - "typescript": { - "dependsOn": ["^typescript"], - "inputs": [ - "$TURBO_DEFAULT$", - "tsconfig.json", - "packages/**/tsconfig.json" - ], - "cache": true, - "persistent": false } } }