Fix #7
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: Sonar Scan | |
on: | |
push: | |
branches: | |
- develop | |
- ci/extract-llc-tests # FIXME | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
sonar: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 100 | |
- uses: actions/github-script@v6 | |
id: get_pr_data | |
with: | |
script: | | |
return ( | |
await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
commit_sha: context.sha, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}) | |
).data[0]; | |
- uses: ./.github/actions/bootstrap | |
env: | |
INSTALL_SONAR: true | |
SKIP_MINT_BOOTSTRAP: true | |
- uses: ./.github/actions/python-cache | |
- name: Check if Test Coverage Exists | |
run: | | |
EXISTS=$(gh api repos/${{ github.repository }}/actions/artifacts | jq -r '.artifacts[] | select(.name=="test-coverage-${{ fromJson(steps.get_pr_data.outputs.result).number }}")') | |
if [[ "$EXISTS" == "" ]]; then | |
echo "Artifact not found. Skipping job." | |
echo "scan=false" >> $GITHUB_ENV | |
else | |
echo "scan=true" >> $GITHUB_ENV | |
fi | |
- name: Download XML Artifact | |
if: env.scan == 'true' | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-coverage-${{ fromJson(steps.get_pr_data.outputs.result).number }} | |
path: reports/sonarqube-generic-coverage.xml | |
- if: env.scan == 'true' | |
run: | | |
ls | |
ls reports | |
- name: Run Sonar analysis | |
if: env.scan == 'true' | |
run: bundle exec fastlane sonar_upload | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |