ci: prevent duplicate test runs - tests only on PRs, inline tests for builds
This commit is contained in:
@@ -16,17 +16,46 @@ env:
|
||||
|
||||
jobs:
|
||||
# =============================================================================
|
||||
# Run Tests First (reuse test workflow)
|
||||
# Run Tests First
|
||||
# =============================================================================
|
||||
test:
|
||||
name: Run Tests
|
||||
uses: ./.github/workflows/test.yml
|
||||
backend-test:
|
||||
name: Backend Tests
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: backend/package-lock.json
|
||||
- run: npm ci
|
||||
- run: npx tsc --noEmit
|
||||
- run: npm run test:run
|
||||
|
||||
frontend-build:
|
||||
name: Frontend Build
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
|
||||
# =============================================================================
|
||||
# Build and Push Docker Images (only after tests pass)
|
||||
# =============================================================================
|
||||
build-and-push:
|
||||
needs: test
|
||||
needs: [backend-test, frontend-build]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
# Allow this workflow to be called by other workflows
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user