Add a GitHub workflow to test plugin within SonarQube #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
test: | |
name: Lint and Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
java-version: [11] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Use JDK ${{ matrix.java-version }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: ${{ matrix.java-version }} | |
- name: Install dependencies | |
run: yarn install --immutable | |
working-directory: eslint-plugin | |
- name: Lint eslint-plugin | |
run: yarn lint | |
working-directory: eslint-plugin | |
- name: Test eslint-plugin | |
run: yarn test:cov | |
working-directory: eslint-plugin | |
- name: Verify SonarQube plugin | |
run: mvn -e -B verify | |
working-directory: sonar-plugin | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
if: | | |
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && | |
matrix.node-version == '20.x' && | |
github.actor != 'dependabot[bot]' | |
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 |