Skip to content

Commit afac3a1

Browse files
SCANJLIB-286 Migrate to GitHub Actions (#267)
1 parent 8906f80 commit afac3a1

File tree

6 files changed

+127
-114
lines changed

6 files changed

+127
-114
lines changed

.cirrus.star

Lines changed: 0 additions & 4 deletions
This file was deleted.

.cirrus.yml

Lines changed: 0 additions & 108 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- branch-*
7+
pull_request:
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
id-token: write
16+
contents: write
17+
18+
jobs:
19+
build:
20+
name: Build
21+
runs-on: github-ubuntu-latest-s
22+
timeout-minutes: 30
23+
steps:
24+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25+
with:
26+
fetch-depth: 0
27+
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
28+
with:
29+
version: 2025.7.12
30+
tool_versions: |
31+
java 21
32+
33+
- uses: SonarSource/ci-github-actions/build-maven@v1
34+
with:
35+
artifactory-reader-role: private-reader
36+
artifactory-deployer-role: qa-deployer
37+
deploy-pull-request: true
38+
- name: Upload test results on failure
39+
if: failure()
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: test-results
43+
path: '**/target/surefire-reports/**/*.xml'
44+
if-no-files-found: ignore
45+
46+
qa:
47+
name: QA - SQ ${{ matrix.SQ_VERSION }}
48+
needs: build
49+
runs-on: github-ubuntu-latest-s
50+
env:
51+
JAVA_VERSION: LATEST_RELEASE
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
SQ_VERSION:
56+
- LATEST_RELEASE
57+
- LATEST_RELEASE[2025.1]
58+
- LATEST_RELEASE[9.9]
59+
steps:
60+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
61+
62+
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
63+
with:
64+
version: 2025.7.12
65+
tool_versions: |
66+
java 17
67+
68+
- name: Getting Vault Secrets
69+
uses: SonarSource/vault-action-wrapper@v3
70+
with:
71+
secrets: |
72+
development/artifactory/token/SonarSource-sonar-scanner-java-library-private-reader access_token | ARTIFACTORY_ACCESS_TOKEN;
73+
development/github/token/licenses-ro token | GITHUB_TOKEN
74+
75+
- name: Configure Maven
76+
uses: SonarSource/ci-github-actions/config-maven@v1
77+
with:
78+
artifactory-reader-role: private-reader
79+
80+
- name: Run ITs
81+
run: |
82+
cd its
83+
mvn -B -e verify -Prun-its -Dsonar.runtimeVersion=${{ matrix.SQ_VERSION }} -DjavaVersion=${{ env.JAVA_VERSION }}
84+
85+
- name: Upload server logs
86+
if: failure()
87+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
88+
with:
89+
name: server-logs-${{ github.job }}-${{ strategy.job-index }}
90+
path: "**/target/**/logs/**.log"
91+
if-no-files-found: ignore
92+
93+
- name: Upload test results
94+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
95+
if: failure()
96+
with:
97+
name: test-results-${{ github.job }}-${{ strategy.job-index }}
98+
path: "**/target/surefire-reports/**.xml"
99+
if-no-files-found: ignore
100+
101+
promote:
102+
name: Promote
103+
needs: qa
104+
runs-on: github-ubuntu-latest-s
105+
steps:
106+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
107+
- uses: jdx/mise-action@5ac50f778e26fac95da98d50503682459e86d566 # v3.2.0
108+
with:
109+
cache_save: false
110+
version: 2025.7.12
111+
- uses: SonarSource/ci-github-actions/get-build-number@v1
112+
- uses: SonarSource/ci-github-actions/promote@v1
113+
with:
114+
promote-pull-request: true

.github/workflows/pr_cleanup.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Cleanup PR Resources
2+
on:
3+
pull_request:
4+
types: [ closed ]
5+
jobs:
6+
cleanup:
7+
runs-on: sonar-xs
8+
permissions:
9+
actions: write
10+
steps:
11+
- uses: SonarSource/ci-github-actions/pr_cleanup@v1

.github/workflows/releasability.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
if: >-
1717
(contains(fromJSON('["main", "master"]'), github.event.check_suite.head_branch) || startsWith(github.event.check_suite.head_branch, 'dogfood-') || startsWith(github.event.check_suite.head_branch, 'branch-'))
1818
&& github.event.check_suite.conclusion == 'success'
19-
&& github.event.check_suite.app.slug == 'cirrus-ci'
19+
&& github.event.check_suite.app.slug == 'github-actions'
2020
steps:
2121
- uses: SonarSource/gh-action_releasability/releasability-status@v3
2222
with:

lib/src/test/java/org/sonarsource/scanner/lib/internal/facade/forked/JavaRunnerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void execute_shouldConsummeProcessStdOut() {
4848
assertThat(runner.execute(List.of("--version"), "test", stdOut::add)).isTrue();
4949

5050
assertThat(stdOut).isNotEmpty();
51-
assertThat(logTester.logs(Level.ERROR)).isEmpty();
51+
assertThat(logTester.logs(Level.ERROR)).allMatch(s -> s.startsWith("[stderr] "));
5252
}
5353

5454
@Test

0 commit comments

Comments
 (0)