Skip to content

Commit cd22110

Browse files
committed
add timeout minute and correcte ci
1 parent 6711941 commit cd22110

2 files changed

Lines changed: 67 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@ name: CI
33
on:
44
push:
55
branches: ["test"]
6+
paths-ignore:
7+
- "docs/**"
8+
- "**/*.md"
9+
- "*.md"
10+
- "config/*.md"
611
pull_request:
712
branches: ["main", "develop", "staging"]
813
types: [opened, synchronize, reopened]
14+
paths-ignore:
15+
- "docs/**"
16+
- "**/*.md"
17+
- "*.md"
18+
- "config/*.md"
919

1020
workflow_dispatch:
1121

@@ -25,6 +35,32 @@ env:
2535
TF_VERSION: 1.5.0
2636

2737
jobs:
38+
changes:
39+
name: Detect Changed Paths
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 3
42+
outputs:
43+
backend: ${{ steps.filter.outputs.backend }}
44+
frontend: ${{ steps.filter.outputs.frontend }}
45+
infra: ${{ steps.filter.outputs.infra }}
46+
ci: ${{ steps.filter.outputs.ci }}
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- name: Filter changed paths
51+
id: filter
52+
uses: dorny/paths-filter@v3
53+
with:
54+
filters: |
55+
backend:
56+
- 'backend/**'
57+
frontend:
58+
- 'frontend/**'
59+
infra:
60+
- 'infra/**'
61+
ci:
62+
- '.github/**'
63+
2864
security-scan:
2965
name: Security Scanning
3066
runs-on: ubuntu-latest
@@ -78,7 +114,11 @@ jobs:
78114
name: Backend Tests
79115
runs-on: ubuntu-latest
80116
timeout-minutes: 20
81-
needs: security-scan
117+
needs: [changes, security-scan]
118+
if: |
119+
needs.changes.outputs.backend == 'true' ||
120+
needs.changes.outputs.ci == 'true' ||
121+
github.event_name == 'workflow_dispatch'
82122
services:
83123
postgres:
84124
image: postgres:16-alpine
@@ -212,7 +252,11 @@ jobs:
212252
name: Frontend Tests
213253
runs-on: ubuntu-latest
214254
timeout-minutes: 20
215-
needs: security-scan
255+
needs: [changes, security-scan]
256+
if: |
257+
needs.changes.outputs.frontend == 'true' ||
258+
needs.changes.outputs.ci == 'true' ||
259+
github.event_name == 'workflow_dispatch'
216260
outputs:
217261
eslint-outcome: ${{ steps.eslint.outcome }}
218262
steps:
@@ -281,7 +325,11 @@ jobs:
281325
name: Terraform Validation
282326
runs-on: ubuntu-latest
283327
timeout-minutes: 10
284-
needs: security-scan
328+
needs: [changes, security-scan]
329+
if: |
330+
needs.changes.outputs.infra == 'true' ||
331+
needs.changes.outputs.ci == 'true' ||
332+
github.event_name == 'workflow_dispatch'
285333
steps:
286334
- uses: actions/checkout@v4
287335

@@ -320,6 +368,11 @@ jobs:
320368
name: Dependency Analysis
321369
runs-on: ubuntu-latest
322370
timeout-minutes: 10
371+
needs: [changes]
372+
if: |
373+
needs.changes.outputs.backend == 'true' ||
374+
needs.changes.outputs.frontend == 'true' ||
375+
github.event_name == 'workflow_dispatch'
323376
outputs:
324377
snyk-python-outcome: ${{ steps.snyk-python.outcome }}
325378
snyk-node-outcome: ${{ steps.snyk-node.outcome }}
@@ -348,8 +401,11 @@ jobs:
348401
name: Build Backend Image
349402
runs-on: ubuntu-latest
350403
timeout-minutes: 20
351-
needs: [backend, terraform-validate]
352-
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/staging')
404+
needs: [changes, backend, terraform-validate]
405+
if: |
406+
github.event_name == 'push' &&
407+
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/staging') &&
408+
(needs.changes.outputs.backend == 'true' || needs.changes.outputs.ci == 'true' || needs.changes.outputs.infra == 'true')
353409
permissions:
354410
contents: read
355411
packages: write
@@ -390,8 +446,11 @@ jobs:
390446
name: Build Frontend Image
391447
runs-on: ubuntu-latest
392448
timeout-minutes: 20
393-
needs: [frontend, terraform-validate]
394-
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/staging')
449+
needs: [changes, frontend, terraform-validate]
450+
if: |
451+
github.event_name == 'push' &&
452+
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/staging') &&
453+
(needs.changes.outputs.frontend == 'true' || needs.changes.outputs.ci == 'true' || needs.changes.outputs.infra == 'true')
395454
permissions:
396455
contents: read
397456
packages: write
@@ -435,6 +494,7 @@ jobs:
435494
if: always()
436495
needs:
437496
[
497+
changes,
438498
security-scan,
439499
backend,
440500
frontend,

frontend/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ RUN npm ci
1515

1616
# Copy source code
1717
COPY src ./src
18-
COPY public ./public
1918

2019
# Build the application
2120
RUN npm run build

0 commit comments

Comments
 (0)