Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a GitHub workflow to test plugin within SonarQube #54

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 37 additions & 7 deletions .github/workflows/build.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Build
name: CI

on:
push:
branches: [ main ]
branches: [main]
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- "[0-9]+.[0-9]+.[0-9]+"
pull_request:
types: [ opened, synchronize, reopened ]
types: [opened, synchronize, reopened]

jobs:
test:
Expand All @@ -15,8 +15,8 @@ jobs:

strategy:
matrix:
node-version: [ 18.x, 20.x ]
java-version: [ 11 ]
node-version: [18.x, 20.x]
java-version: [11]

steps:
- name: Checkout
Expand All @@ -30,7 +30,7 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Use JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java-version }}
Expand Down Expand Up @@ -60,3 +60,33 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

integration-test:
name: Integration test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Use JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11

- name: Install dependencies
run: yarn install --immutable
working-directory: eslint-plugin

- name: Build SonarQube plugin
run: mvn -e -B package
working-directory: sonar-plugin

- name: Check SonarQube with the plugin
run: docker compose up --wait
11 changes: 8 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: sonarqube_ecocode_javascript

services:
sonar:
image: sonarqube:10-community
image: sonarqube:10.7-community
container_name: sonar_ecocode_javascript
ports:
- "9000:9000"
Expand All @@ -24,9 +24,14 @@ services:
- "extensions:/opt/sonarqube/extensions"
- "logs:/opt/sonarqube/logs"
- "data:/opt/sonarqube/data"
healthcheck:
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
interval: 10s
timeout: 10s
retries: 5

db:
image: postgres:12
image: postgres:16-alpine
container_name: postgresql_ecocode_javascript
networks:
- sonarnet
Expand All @@ -38,7 +43,7 @@ services:
POSTGRES_DB: sonarqube
PGDATA: pg_data:/var/lib/postgresql/data/pgdata
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U sonar -d sonarqube" ]
test: ["CMD-SHELL", "pg_isready -U sonar -d sonarqube"]
interval: 5s
timeout: 5s
retries: 5
Expand Down