Add sonar config #4
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: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "**" | |
pull_request: | |
env: | |
PYTEST_ADDOPTS: --color=yes | |
GITHUB_PR_NUMBER: ${{ github.event.number }} | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Python setup | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
check-latest: true | |
- name: Install dependencies | |
run: | | |
pip install -e ".[tests]" | |
- name: Tests | |
run: pytest --cov --cov-report=xml | |
- name: Store info for sonar | |
env: | |
REF_NAME: ${{ github.ref_name }} | |
REF_TYPE: ${{ github.ref_type }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
SOURCE_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }} | |
SOURCE_BRANCH: ${{ github.event.pull_request.head.ref }} | |
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }} | |
run: | | |
echo "PR_NUMBER=${PR_NUMBER}" >> sonar_env | |
echo "SOURCE_REPOSITORY=${SOURCE_REPOSITORY}" >> sonar_env | |
echo "SOURCE_BRANCH=${SOURCE_BRANCH}" >> sonar_env | |
echo "TARGET_BRANCH=${TARGET_BRANCH}" >> sonar_env | |
cat sonar_env | |
# upload coverage report for sonar workflow | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ctapipe-coverage-report | |
path: | | |
coverage.xml | |
sonar_env |