@@ -109,6 +109,7 @@ jobs:
109109 format-and-lint :
110110 name : Format and Lint Check
111111 runs-on : ubuntu-latest
112+ timeout-minutes : 5
112113 needs : [changes, install]
113114 if : needs.changes.outputs.source == 'true' || needs.changes.outputs.config == 'true' || needs.changes.outputs.styles == 'true'
114115 permissions :
@@ -150,6 +151,7 @@ jobs:
150151 type-check :
151152 name : TypeScript Type Check
152153 runs-on : ubuntu-latest
154+ timeout-minutes : 5
153155 needs : [changes, install]
154156 if : needs.changes.outputs.source == 'true' || needs.changes.outputs.config == 'true'
155157 permissions :
@@ -175,47 +177,12 @@ jobs:
175177 - name : Run TypeScript type check
176178 run : pnpm run type-check
177179
178- # Internationalization validation
179- i18n-validation :
180- name : I18n Validation
181- runs-on : ubuntu-latest
182- needs : [changes, install]
183- if : needs.changes.outputs.i18n == 'true' || needs.changes.outputs.source == 'true'
184- permissions :
185- contents : read
186- steps :
187- - name : Checkout repository
188- uses : actions/checkout@v4
189-
190- - name : Setup Python
191- uses : actions/setup-python@v5
192- with :
193- python-version : ' 3.x'
194-
195- - name : Setup pnpm
196- uses : pnpm/action-setup@v4
197- with :
198- version : ${{ env.PNPM_VERSION }}
199-
200- - name : Setup Node.js
201- uses : actions/setup-node@v4
202- with :
203- node-version : ${{ env.NODE_VERSION }}
204- cache : ' pnpm'
205-
206- - name : Install dependencies
207- run : pnpm install --frozen-lockfile
208-
209- - name : Quick i18n check
210- run : pnpm run i18n:check
211-
212- - name : Validate i18n consistency
213- run : pnpm run i18n:validate
214180
215181 # Build the application
216182 build :
217183 name : Build Application
218184 runs-on : ubuntu-latest
185+ timeout-minutes : 10
219186 needs : [changes, install]
220187 if : needs.changes.outputs.source == 'true' || needs.changes.outputs.config == 'true'
221188 permissions :
@@ -252,19 +219,18 @@ jobs:
252219 path : .next/
253220 retention-days : 7
254221
255- # Run tests for changed test files
222+ # Run tests
256223 test :
257224 name : Run Tests
258225 runs-on : ubuntu-latest
226+ timeout-minutes : 10
259227 needs : [changes, install]
260228 if : needs.changes.outputs.tests == 'true' || needs.changes.outputs.source == 'true'
261229 permissions :
262230 contents : read
263231 steps :
264232 - name : Checkout repository
265233 uses : actions/checkout@v4
266- with :
267- fetch-depth : 0
268234
269235 - name : Setup pnpm
270236 uses : pnpm/action-setup@v4
@@ -280,45 +246,14 @@ jobs:
280246 - name : Install dependencies
281247 run : pnpm install --frozen-lockfile
282248
283- - name : Run tests for changed files
284- run : |
285- # Get list of changed test files and source files that might have related tests
286- CHANGED_TEST_FILES=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | grep -E '\.(test|spec)\.(js|jsx|ts|tsx)$' | tr '\n' ' ' || true)
287- CHANGED_SOURCE_FILES=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | grep -E '\.(js|jsx|ts|tsx)$' | grep -v -E '\.(test|spec)\.' | tr '\n' ' ' || true)
288-
289- # Find related test files for changed source files
290- RELATED_TEST_FILES=""
291- if [ -n "$CHANGED_SOURCE_FILES" ]; then
292- for file in $CHANGED_SOURCE_FILES; do
293- # Look for corresponding test files
294- base_name=$(basename "$file" | sed 's/\.[^.]*$//')
295- dir_name=$(dirname "$file")
296-
297- # Check multiple test file patterns
298- for pattern in "${dir_name}/${base_name}.test.*" "${dir_name}/${base_name}.spec.*" "__tests__/**/${base_name}.*" "**/${base_name}.test.*" "**/${base_name}.spec.*"; do
299- if ls $pattern 1> /dev/null 2>&1; then
300- RELATED_TEST_FILES="$RELATED_TEST_FILES $(ls $pattern)"
301- fi
302- done
303- done
304- fi
305-
306- # Combine all test files to run
307- ALL_TEST_FILES="$CHANGED_TEST_FILES $RELATED_TEST_FILES"
308- ALL_TEST_FILES=$(echo $ALL_TEST_FILES | tr ' ' '\n' | sort -u | tr '\n' ' ')
309-
310- if [ -n "$ALL_TEST_FILES" ] && [ "$ALL_TEST_FILES" != " " ]; then
311- echo "Running tests for files: $ALL_TEST_FILES"
312- pnpm exec jest $ALL_TEST_FILES --passWithNoTests
313- else
314- echo "No test files found for changed source files, running all tests"
315- pnpm test
316- fi
249+ - name : Run tests
250+ run : pnpm test
317251
318252 # Security checks
319253 security-check :
320254 name : Security Check
321255 runs-on : ubuntu-latest
256+ timeout-minutes : 5
322257 needs : [changes, install]
323258 if : needs.changes.outputs.source == 'true' || needs.changes.outputs.config == 'true'
324259 permissions :
@@ -364,7 +299,6 @@ jobs:
364299 - changes
365300 - format-and-lint
366301 - type-check
367- - i18n-validation
368302 - build
369303 - test
370304 - security-check
@@ -379,7 +313,6 @@ jobs:
379313 # Check if any job failed
380314 if [[ "${{ needs.format-and-lint.result }}" == "failure" ]] || \
381315 [[ "${{ needs.type-check.result }}" == "failure" ]] || \
382- [[ "${{ needs.i18n-validation.result }}" == "failure" ]] || \
383316 [[ "${{ needs.build.result }}" == "failure" ]] || \
384317 [[ "${{ needs.test.result }}" == "failure" ]] || \
385318 [[ "${{ needs.security-check.result }}" == "failure" ]]; then
0 commit comments