Skip to content

Test

Test #3

Workflow file for this run

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
id: check_file
run: |
EXISTS=$(gh api repos/${{ github.repository }}/actions/artifacts | jq -r '.artifacts[] | select(.name=="test-coverage-${{ fromJson(steps.get_pr_data.outputs.result).number }}") | .name' || echo "notfound")
if [[ "$EXISTS" == "notfound" ]]; then
echo "Artifact not found. Skipping job."
exit 0
fi
- name: Download XML Artifact
uses: actions/download-artifact@v4
with:
name: test-coverage-${{ fromJson(steps.get_pr_data.outputs.result).number }}
path: reports/sonarqube-generic-coverage.xml
- run: |
ls
ls reports
- name: Run Sonar analysis
run: bundle exec fastlane sonar_upload
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}