Fix SonarQube scan in CI #22
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: | |
# Trigger analysis when pushing to your main branches, and when creating a pull request. | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install-yarn-dependencies | |
lint: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install-yarn-dependencies | |
- run: yarn lint | |
test: | |
runs-on: ubuntu-latest | |
needs: [lint] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/install-yarn-dependencies | |
- run: yarn test --ci --forceExit --detectOpenHandles | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: reports | |
path: reports/ | |
sonar: | |
name: Run sonar scanner | |
runs-on: [ self-hosted, linux ] | |
needs: [ test ] | |
steps: | |
- name: Checking out | |
uses: actions/checkout@v4 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- name: Download test coverage report artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-coverage | |
path: reports/coverage/ | |
- name: Run scan | |
uses: amalgamaco/github-actions/.github/actions/sonar-scan@main | |
with: | |
sonar-token: ${{ secrets.SONAR_TOKEN }} |