|
6 | 6 | pull_request: |
7 | 7 | branches: [main, develop] |
8 | 8 |
|
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
9 | 13 | jobs: |
10 | 14 | changes: |
11 | 15 | name: Detect changes |
|
16 | 20 | steps: |
17 | 21 | - name: Checkout |
18 | 22 | uses: actions/checkout@v4 |
19 | | - with: |
20 | | - fetch-depth: 0 |
21 | 23 |
|
22 | 24 | - name: Detect file changes |
23 | 25 | uses: dorny/paths-filter@v3 |
|
49 | 51 | with: |
50 | 52 | dotnet-version: '8.0.x' |
51 | 53 |
|
| 54 | + - name: Cache NuGet packages |
| 55 | + uses: actions/cache@v4 |
| 56 | + with: |
| 57 | + path: ~/.nuget/packages |
| 58 | + key: ${{ runner.os }}-nuget-${{ hashFiles('src/backend/**/*.csproj') }} |
| 59 | + restore-keys: ${{ runner.os }}-nuget- |
| 60 | + |
52 | 61 | - name: Restore dependencies |
53 | 62 | run: dotnet restore |
54 | 63 |
|
|
58 | 67 | - name: Test |
59 | 68 | run: dotnet test --no-build --configuration Release --verbosity normal --filter "Category!=Email" |
60 | 69 |
|
61 | | - backend-skip: |
62 | | - name: Backend (.NET) (pull_request) |
63 | | - needs: changes |
64 | | - if: ${{ needs.changes.outputs.backend == 'false' }} |
65 | | - runs-on: ubuntu-latest |
66 | | - steps: |
67 | | - - name: Skip |
68 | | - run: echo "No backend changes detected - skipping build" |
69 | | - |
70 | 70 | frontend: |
71 | 71 | name: Frontend (React) |
72 | 72 | needs: changes |
@@ -102,11 +102,16 @@ jobs: |
102 | 102 | - name: Test |
103 | 103 | run: npm run test -- --passWithNoTests |
104 | 104 |
|
105 | | - frontend-skip: |
106 | | - name: Frontend (React) (pull_request) |
107 | | - needs: changes |
108 | | - if: ${{ needs.changes.outputs.frontend == 'false' }} |
| 105 | + ci-success: |
| 106 | + name: CI Success |
| 107 | + needs: [changes, backend, frontend] |
| 108 | + if: always() |
109 | 109 | runs-on: ubuntu-latest |
110 | 110 | steps: |
111 | | - - name: Skip |
112 | | - run: echo "No frontend changes detected - skipping build" |
| 111 | + - name: Check results |
| 112 | + run: | |
| 113 | + if [[ "${{ needs.backend.result }}" == "failure" || "${{ needs.frontend.result }}" == "failure" ]]; then |
| 114 | + echo "One or more jobs failed" |
| 115 | + exit 1 |
| 116 | + fi |
| 117 | + echo "CI passed successfully" |
0 commit comments