diff --git a/.github/workflows/on-push-main.yml b/.github/workflows/on-push-main.yml index bda3fbafa..d24cf77db 100644 --- a/.github/workflows/on-push-main.yml +++ b/.github/workflows/on-push-main.yml @@ -9,8 +9,52 @@ on: - main jobs: + sonarqube: + name: SonarQube Trigger + runs-on: ubuntu-latest + steps: + - name: Checkout sources 🔰 + uses: actions/checkout@v4 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting + fetch-depth: 0 + + - name: Setup Node.js 🧮 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Cache Node.js modules 💾 + uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.OS }}-node- + ${{ runner.OS }}- + + - name: Install dependencies ⏬ + run: npm ci + + - name: Test code ✅ + run: npm run test + env: + CI: true + + - name: Get shogun-gis-client version 🔖 + run: | + echo "VERSION=$(node -pe "require('./package.json').version")" >> $GITHUB_ENV + + - name: SonarQube Scan 🔬 + uses: kitabisa/sonarqube-action@v1.2.1 + with: + host: ${{ secrets.SONARQUBE_HOST }} + login: ${{ secrets.SONARQUBE_TOKEN }} + projectVersion: ${{ env.VERSION }} + build: runs-on: ubuntu-latest + needs: sonarqube steps: - name: Checkout sources 🔰 uses: actions/checkout@v4 @@ -75,45 +119,3 @@ jobs: run: | docker push ${{ env.DOCKER_REGISTRY }}/shogun-gis-client-e2e-tests:main - sonarqube: - name: SonarQube Trigger - runs-on: ubuntu-latest - steps: - - name: Checkout sources 🔰 - uses: actions/checkout@v4 - with: - # Disabling shallow clone is recommended for improving relevancy of reporting - fetch-depth: 0 - - - name: Setup Node.js 🧮 - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Cache Node.js modules 💾 - uses: actions/cache@v4 - with: - path: ~/.npm - key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.OS }}-node- - ${{ runner.OS }}- - - - name: Install dependencies ⏬ - run: npm ci - - - name: Test code ✅ - run: npm run test - env: - CI: true - - - name: Get shogun-gis-client version 🔖 - run: | - echo "VERSION=$(node -pe "require('./package.json').version")" >> $GITHUB_ENV - - - name: SonarQube Scan 🔬 - uses: kitabisa/sonarqube-action@v1.2.1 - with: - host: ${{ secrets.SONARQUBE_HOST }} - login: ${{ secrets.SONARQUBE_TOKEN }} - projectVersion: ${{ env.VERSION }} diff --git a/sonar-project.properties b/sonar-project.properties index e1be28ec8..1e2a7d51b 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,3 +2,6 @@ sonar.projectBaseDir=/home/runner/work/shogun-demo-client/shogun-demo-client sonar.testExecutionReportPaths=./coverage/jest-report.xml sonar.tests=src sonar.test.inclusions=**/*.spec.tsx,**/*.spec.ts + +# quality gate rules +sonar.qualitygate.wait=true