Skip to content

Commit 6fb40a9

Browse files
SONARJAVA-6253 Ensure integration tests do not share cache (#5568)
1 parent 5421a08 commit 6fb40a9

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Write File
2+
description: Writes a file with the given content
3+
4+
inputs:
5+
file-path:
6+
description: 'Path to the file to write.'
7+
required: true
8+
content:
9+
description: 'Content to write to the file.'
10+
required: true
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Write Content to File
16+
shell: bash
17+
env:
18+
FILE_PATH: ${{ inputs.file-path }}
19+
CONTENT: ${{ inputs.content }}
20+
run: |
21+
mkdir -p "$(dirname "$FILE_PATH")"
22+
echo "$CONTENT" > "$FILE_PATH"
23+
echo "$CONTENT"

.github/workflows/build.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ jobs:
7979
version: 2025.7.12
8080
- name: Select Java Version
8181
run: mise use java@21
82+
- name: Ensure Separate Job Cache Key
83+
uses: ./.github/actions/write-file
84+
with:
85+
file-path: target/just_for_cache_key_calculation/pom.xml
86+
content: ${{ github.job }}-${{ toJSON(matrix.item) }}
8287
- name: Configure Maven
8388
uses: SonarSource/ci-github-actions/config-maven@v1
8489
with:
@@ -141,6 +146,11 @@ jobs:
141146
version: 2025.7.12
142147
- name: Select Java Version
143148
run: mise use java@21
149+
- name: Ensure Separate Job Cache Key
150+
uses: ./.github/actions/write-file
151+
with:
152+
file-path: target/just_for_cache_key_calculation/pom.xml
153+
content: ${{ github.job }}-${{ matrix.sq_version }}
144154
- name: Configure Maven
145155
uses: SonarSource/ci-github-actions/config-maven@v1
146156
with:
@@ -186,6 +196,11 @@ jobs:
186196
secrets: |
187197
development/kv/data/next url | SONAR_HOST_URL;
188198
development/kv/data/next token | SONAR_TOKEN;
199+
- name: Ensure Separate Job Cache Key
200+
uses: ./.github/actions/write-file
201+
with:
202+
file-path: target/just_for_cache_key_calculation/pom.xml
203+
content: ${{ github.job }}
189204
- uses: SonarSource/ci-github-actions/config-maven@v1
190205
with:
191206
artifactory-reader-role: private-reader
@@ -263,6 +278,11 @@ jobs:
263278
secrets: |
264279
development/kv/data/next url | SONAR_HOST_URL;
265280
development/kv/data/next token | SONAR_TOKEN;
281+
- name: Ensure Separate Job Cache Key
282+
uses: ./.github/actions/write-file
283+
with:
284+
file-path: target/just_for_cache_key_calculation/pom.xml
285+
content: ${{ github.job }}
266286
- uses: SonarSource/ci-github-actions/config-maven@v1
267287
with:
268288
artifactory-reader-role: private-reader
@@ -315,6 +335,11 @@ jobs:
315335
development/kv/data/next url | SONAR_HOST_URL;
316336
development/kv/data/next token | SONAR_TOKEN;
317337
development/github/token/licenses-ro token | GITHUB_TOKEN;
338+
- name: Ensure Separate Job Cache Key
339+
uses: ./.github/actions/write-file
340+
with:
341+
file-path: target/just_for_cache_key_calculation/pom.xml
342+
content: ${{ github.job }}
318343
- uses: SonarSource/ci-github-actions/config-maven@v1
319344
with:
320345
artifactory-reader-role: private-reader
@@ -369,6 +394,11 @@ jobs:
369394
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
370395
with:
371396
version: 2025.7.12
397+
- name: Ensure Separate Job Cache Key
398+
uses: ./.github/actions/write-file
399+
with:
400+
file-path: target/just_for_cache_key_calculation/pom.xml
401+
content: ${{ github.job }}
372402
- name: Configure Maven
373403
uses: SonarSource/ci-github-actions/config-maven@v1
374404
with:

0 commit comments

Comments
 (0)