Skip to content

Commit fe527b9

Browse files
committed
Change controller tests GA by matrix usage
1 parent a175ffa commit fe527b9

File tree

1 file changed

+18
-50
lines changed

1 file changed

+18
-50
lines changed

.github/workflows/build_test_package.yml

Lines changed: 18 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
-x openApiValidate
4949
-x detekt
5050
51-
organization_controller_test:
51+
controller_tests:
5252
runs-on: ubuntu-latest
5353
needs:
5454
- build
@@ -58,38 +58,14 @@ jobs:
5858
permissions: read-all
5959

6060
if: github.event_name != 'pull_request_target'
61-
62-
steps:
63-
- uses: actions/checkout@v4
64-
65-
- name: Set up JDK
66-
uses: actions/setup-java@v4
67-
with:
68-
distribution: 'temurin'
69-
java-version: '21'
70-
71-
- name: Setup Gradle
72-
uses: gradle/actions/setup-gradle@v4
73-
with:
74-
cache-disabled: true
75-
76-
- name: Run Organization Controller tests
77-
env:
78-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79-
run: ./gradlew :cosmotech-api:integrationTest --tests "com.cosmotech.api.home.organization.OrganizationControllerTests" -x spotlessCheck -x openApiValidate
80-
81-
82-
home_controller_test:
83-
runs-on: ubuntu-latest
84-
needs:
85-
- build
86-
env:
87-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
89-
permissions: read-all
90-
91-
if: github.event_name != 'pull_request_target'
92-
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
service:
65+
- packageName: .organization
66+
testPrefix: Organization
67+
- packageName: ""
68+
testPrefix: Home
9369
steps:
9470
- uses: actions/checkout@v4
9571

@@ -104,11 +80,10 @@ jobs:
10480
with:
10581
cache-disabled: true
10682

107-
- name: Run Home Controller tests
83+
- name: Run ${{ matrix.service.testPrefix }} controller tests
10884
env:
10985
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110-
run: ./gradlew :cosmotech-api:integrationTest --tests "com.cosmotech.api.home.HomeControllerTests" -x spotlessCheck -x openApiValidate
111-
86+
run: ./gradlew :cosmotech-api:integrationTest --tests "com.cosmotech.api.home${{ matrix.service.packageName }}.${{ matrix.service.testPrefix }}ControllerTests" -x spotlessCheck -x openApiValidate
11287

11388
unit_test:
11489
runs-on: ubuntu-latest
@@ -144,8 +119,7 @@ jobs:
144119
runs-on: ubuntu-latest
145120
needs:
146121
- unit_test
147-
- home_controller_test
148-
- organization_controller_test
122+
- controller_tests
149123
env:
150124
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151125

@@ -176,8 +150,7 @@ jobs:
176150
runs-on: ubuntu-latest
177151
needs:
178152
- unit_test
179-
- home_controller_test
180-
- organization_controller_test
153+
- controller_tests
181154
env:
182155
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
183156

@@ -213,8 +186,7 @@ jobs:
213186
runs-on: ubuntu-latest
214187
needs:
215188
- unit_test
216-
- home_controller_test
217-
- organization_controller_test
189+
- controller_tests
218190
env:
219191
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
220192

@@ -250,8 +222,7 @@ jobs:
250222
runs-on: ubuntu-latest
251223
needs:
252224
- unit_test
253-
- home_controller_test
254-
- organization_controller_test
225+
- controller_tests
255226
env:
256227
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
257228

@@ -288,8 +259,7 @@ jobs:
288259
runs-on: ubuntu-latest
289260
needs:
290261
- unit_test
291-
- home_controller_test
292-
- organization_controller_test
262+
- controller_tests
293263
env:
294264
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
295265

@@ -326,8 +296,7 @@ jobs:
326296
runs-on: ubuntu-latest
327297
needs:
328298
- unit_test
329-
- home_controller_test
330-
- organization_controller_test
299+
- controller_tests
331300
env:
332301
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
333302

@@ -363,8 +332,7 @@ jobs:
363332
runs-on: ubuntu-latest
364333
needs:
365334
- unit_test
366-
- home_controller_test
367-
- organization_controller_test
335+
- controller_tests
368336
env:
369337
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
370338

0 commit comments

Comments
 (0)