Skip to content

Commit 8809ea6

Browse files
authored
Add a GitHub workflow to test plugin within SonarQube (#54)
Co-authored-by: utarwyn <[email protected]>
1 parent 74ae843 commit 8809ea6

File tree

2 files changed

+45
-10
lines changed

2 files changed

+45
-10
lines changed

.github/workflows/build.yml renamed to .github/workflows/ci.yml

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Build
1+
name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
tags:
7-
- '[0-9]+.[0-9]+.[0-9]+'
7+
- "[0-9]+.[0-9]+.[0-9]+"
88
pull_request:
9-
types: [ opened, synchronize, reopened ]
9+
types: [opened, synchronize, reopened]
1010

1111
jobs:
1212
test:
@@ -15,8 +15,8 @@ jobs:
1515

1616
strategy:
1717
matrix:
18-
node-version: [ 18.x, 20.x ]
19-
java-version: [ 11 ]
18+
node-version: [18.x, 20.x]
19+
java-version: [11]
2020

2121
steps:
2222
- name: Checkout
@@ -30,7 +30,7 @@ jobs:
3030
node-version: ${{ matrix.node-version }}
3131

3232
- name: Use JDK ${{ matrix.java-version }}
33-
uses: actions/setup-java@v3
33+
uses: actions/setup-java@v4
3434
with:
3535
distribution: temurin
3636
java-version: ${{ matrix.java-version }}
@@ -60,3 +60,33 @@ jobs:
6060
env:
6161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6262
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
63+
64+
integration-test:
65+
name: Integration test
66+
runs-on: ubuntu-latest
67+
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v4
71+
72+
- name: Use Node.js 20.x
73+
uses: actions/setup-node@v4
74+
with:
75+
node-version: 20.x
76+
77+
- name: Use JDK 11
78+
uses: actions/setup-java@v4
79+
with:
80+
distribution: temurin
81+
java-version: 11
82+
83+
- name: Install dependencies
84+
run: yarn install --immutable
85+
working-directory: eslint-plugin
86+
87+
- name: Build SonarQube plugin
88+
run: mvn -e -B package
89+
working-directory: sonar-plugin
90+
91+
- name: Check SonarQube with the plugin
92+
run: docker compose up --wait

docker-compose.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: sonarqube_ecocode_javascript
33

44
services:
55
sonar:
6-
image: sonarqube:10-community
6+
image: sonarqube:10.7-community
77
container_name: sonar_ecocode_javascript
88
ports:
99
- "9000:9000"
@@ -24,9 +24,14 @@ services:
2424
- "extensions:/opt/sonarqube/extensions"
2525
- "logs:/opt/sonarqube/logs"
2626
- "data:/opt/sonarqube/data"
27+
healthcheck:
28+
test: wget -qO- http://sonar:9000/api/system/status | grep -q -e '"status":"UP"' -e '"status":"DB_MIGRATION_NEEDED"' -e '"status":"DB_MIGRATION_RUNNING"' || exit 1
29+
interval: 10s
30+
timeout: 10s
31+
retries: 5
2732

2833
db:
29-
image: postgres:12
34+
image: postgres:16-alpine
3035
container_name: postgresql_ecocode_javascript
3136
networks:
3237
- sonarnet
@@ -38,7 +43,7 @@ services:
3843
POSTGRES_DB: sonarqube
3944
PGDATA: pg_data:/var/lib/postgresql/data/pgdata
4045
healthcheck:
41-
test: [ "CMD-SHELL", "pg_isready -U sonar -d sonarqube" ]
46+
test: ["CMD-SHELL", "pg_isready -U sonar -d sonarqube"]
4247
interval: 5s
4348
timeout: 5s
4449
retries: 5

0 commit comments

Comments
 (0)