Skip to content

Commit 5bfd46e

Browse files
MCP-86 Migrate to GitHub Actions
1 parent 451aec9 commit 5bfd46e

File tree

6 files changed

+160
-0
lines changed

6 files changed

+160
-0
lines changed

.github/workflows/build.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- branch-*
8+
- dogfood-*
9+
pull_request:
10+
merge_group:
11+
workflow_dispatch:
12+
13+
# Workflow-level concurrency
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
18+
# Required permissions for Vault OIDC and repo operations
19+
permissions:
20+
id-token: write
21+
contents: write
22+
23+
jobs:
24+
build:
25+
runs-on: github-ubuntu-latest-s # Public repository runner
26+
name: Build
27+
steps:
28+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
29+
- uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2.4.4
30+
with:
31+
version: 2025.7.12
32+
- uses: SonarSource/ci-github-actions/build-gradle@v1
33+
with:
34+
deploy-pull-request: true
35+
# Public repo + Cirrus used private-reader & qa-deployer → override roles
36+
artifactory-reader-role: private-reader
37+
artifactory-deployer-role: qa-deployer
38+
# Cirrus used SonarCloud EU → set platform accordingly
39+
sonar-platform: sqc-eu
40+
# Additional Gradle tasks seen in Cirrus
41+
gradle-args: ":cyclonedxBom jacocoTestReport"
42+
43+
promote:
44+
needs: [build]
45+
runs-on: github-ubuntu-latest-s # Public repository runner
46+
name: Promote
47+
steps:
48+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
49+
- uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2.4.4
50+
with:
51+
cache_save: false
52+
version: 2025.7.12
53+
- uses: SonarSource/ci-github-actions/promote@v1
54+
with:
55+
promote-pull-request: true

.github/workflows/pr-cleanup.yml

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

.github/workflows/shadow_scans.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Shadow scans
2+
on:
3+
schedule:
4+
# Run the workflow every day at 04:00 UTC
5+
- cron: '0 4 * * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
scan:
10+
runs-on: github-ubuntu-latest-s
11+
name: Scan on shadow platforms
12+
permissions:
13+
id-token: write
14+
contents: write
15+
steps:
16+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
17+
- uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2.4.4
18+
with:
19+
version: 2025.7.12
20+
- uses: SonarSource/ci-github-actions/build-gradle@master # dogfood
21+
with:
22+
run-shadow-scans: true
23+
artifactory-reader-role: private-reader
24+
artifactory-deployer-role: qa-deployer
25+
gradle-args: ":cyclonedxBom jacocoTestReport"
26+
- name: Run IRIS Analysis
27+
uses: SonarSource/unified-dogfooding-actions/run-iris@v1
28+
with:
29+
primary_project_key: "SonarSource_sonarqube-mcp-server"
30+
primary_platform: "SQC-EU"
31+
shadow1_project_key: "SonarSource_sonarqube-mcp-server"
32+
shadow1_platform: "Next"
33+
shadow2_project_key: "SonarSource_sonarqube-mcp-server"
34+
shadow2_platform: "SQC-US"

mise.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[tools]
2+
java = "21.0"
3+
gradle = "8.13"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* SonarQube MCP Server
3+
* Copyright (C) 2025 SonarSource
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
* See the Sonar Source-Available License for more details.
13+
*
14+
* You should have received a copy of the Sonar Source-Available License
15+
* along with this program; if not, see https://sonarsource.com/license/ssal/
16+
*/
17+
package org.sonarsource.sonarqube.mcp.tools.analysis;
18+
19+
class ANewClass {
20+
public String returnAString() {
21+
// TODO: This should be detected by SQC
22+
return "Hello, World!";
23+
}
24+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* SonarQube MCP Server
3+
* Copyright (C) 2025 SonarSource
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
* See the Sonar Source-Available License for more details.
13+
*
14+
* You should have received a copy of the Sonar Source-Available License
15+
* along with this program; if not, see https://sonarsource.com/license/ssal/
16+
*/
17+
package org.sonarsource.sonarqube.mcp.tools.analysis;
18+
19+
import org.junit.jupiter.api.Test;
20+
21+
import static org.junit.jupiter.api.Assertions.assertEquals;
22+
23+
public class ANewClassTests {
24+
25+
@Test
26+
public void testReturnAString() {
27+
ANewClass aNewClass = new ANewClass();
28+
assertEquals("Hello, World!", aNewClass.returnAString());
29+
}
30+
31+
}

0 commit comments

Comments
 (0)