Skip to content

Commit 1c4a77e

Browse files
SONARJAVA-5850 Migrate Windows Build from Cirrus to GitHub action (#5346)
1 parent 36301b6 commit 1c4a77e

File tree

6 files changed

+47
-7
lines changed

6 files changed

+47
-7
lines changed

.cirrus.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ test_analyze_task:
129129
- ./check-license-compliance.sh
130130
cleanup_before_cache_script: cleanup_maven_repository
131131

132+
# Migrated to GHA.
132133
qa_os_win_task:
133134
ec2_instance:
134135
image: base-windows-jdk21-v*

.github/workflows/build.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,42 @@ jobs:
271271
-Dmaven.test.redirectTestOutputToFile=false
272272
-Dparallel=methods
273273
-DuseUnlimitedThreads=true
274+
275+
qa-os-win:
276+
name: Build and Unit Test on Windows
277+
# No dependency on build step, because we do not need the build number.
278+
runs-on: github-windows-latest-m
279+
permissions:
280+
id-token: write # Required for Vault OIDC authentication
281+
contents: write # Required for repository access and tagging
282+
steps:
283+
- name: Config Git
284+
run: git config --global core.autocrlf input
285+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
286+
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
287+
with:
288+
version: 2025.7.12
289+
- name: Run Maven
290+
run: mvn clean verify --batch-mode
291+
292+
promote:
293+
needs:
294+
- build
295+
- ruling-qa
296+
- plugin-qa
297+
- sanity
298+
- test-analyze
299+
- autoscan
300+
- qa-os-win
301+
if: ${{ needs.build.outputs.deployed }}
302+
runs-on: github-ubuntu-latest-s # Public repo uses custom GitHub-hosted runners
303+
name: Promote
304+
permissions:
305+
id-token: write
306+
contents: write
307+
env:
308+
BUILD_NUMBER: ${{ needs.build.outputs.build-number }}
309+
steps:
310+
- uses: SonarSource/ci-github-actions/promote@v1
311+
with:
312+
promote-pull-request: true

java-checks-test-sources/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
<fileSeparator>/</fileSeparator>
4444
<pathSeparator>:${line.separator}</pathSeparator>
4545
<includeScope>test</includeScope>
46-
<!-- $$ to not evaluate M2_REPO now, this will become ${M2_REPO} in the output file -->
47-
<localRepoProperty>$${M2_REPO}</localRepoProperty>
46+
<localRepoProperty>M2_REPO</localRepoProperty>
4847
<outputEncoding>UTF-8</outputEncoding>
4948
<outputFile>${project.build.directory}/test-classpath.txt</outputFile>
5049
</configuration>

java-checks-test-sources/test-classpath-reader/src/main/java/org/sonar/java/test/classpath/TestClasspathUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,12 @@ public static List<File> loadFromFile(String classpathTextFilePath) {
158158
String mavenRepository = findMavenLocalRepository(System::getenv, System::getProperty);
159159
try {
160160
String content = Files.readString(toPath(classpathTextFilePath), UTF_8);
161-
Arrays.stream(content.split(":"))
161+
// Split on ":", but not when it follows Windows drive letter (e.g. "C:\").
162+
Arrays.stream(content.split("(?<![A-Z]):"))
162163
.map(String::trim)
163164
.filter(line -> !line.isBlank())
164165
.map(TestClasspathUtils::fixSeparator)
165-
.map(line -> line.replace("${M2_REPO}", mavenRepository))
166+
.map(line -> line.replace("M2_REPO", mavenRepository))
166167
.map(Paths::get)
167168
.forEach(dependencyPath -> {
168169
if (!Files.exists(dependencyPath)) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
${M2_REPO}/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:
1+
M2_REPO/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:
22

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
${M2_REPO}/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:
2-
${M2_REPO}/org/bad/luck/missing-artifact/666/missing-artifact-666.jar:
1+
M2_REPO/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:
2+
M2_REPO/org/bad/luck/missing-artifact/666/missing-artifact-666.jar:

0 commit comments

Comments
 (0)