Skip to content

Add SonarCloud integration #10

Add SonarCloud integration

Add SonarCloud integration #10

Workflow file for this run

name: MISP2 tests
on:
push:
branches:
- develop
paths:
- 'web-app/**'
- '.github/**'
- 'orbeon-war/**'
- 'packages/**'
- 'utils/**'
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'web-app/**'
- '.github/**'
- 'orbeon-war/**'
- 'packages/**'
- 'utils/**'
jobs:
run-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
gradle-home-cache-cleanup: true
- name: Run test
run: ./gradlew test
- name: Test report
env:
NODE_OPTIONS: '--max-old-space-size=6144'
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Unit and integration tests
path: web-app/build/test-results/**/TEST-*.xml
reporter: java-junit
list-suites: 'failed'
list-tests: 'failed'
- name: Store test screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: Test results
path: /home/runner/work/misp2/misp2/web-app/build/it-screenshots/
sonar-analysis:
name: Analyse source
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
# Bit of a hacky solution so that the CLI would run (exits with code 1 if build.gradle is found)
- name: Remove build.gradle so that we can use the CLI
run: rm web-app/build.gradle
# Running CLI because JAVA 8 is not supported by the plugin anymore
- name: Sonar analysis
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}