diff --git a/.github/workflows/build.yml b/.github/workflows/ci.yml similarity index 60% rename from .github/workflows/build.yml rename to .github/workflows/ci.yml index 78c359f..23b2109 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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 @@ -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 }} @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 9b6c0b8..7bc4e26 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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" @@ -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 @@ -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