diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 67a74e2..5382d2a 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1491928..4652009 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: # =============================================================================