Skip to content

deactivate sonar

deactivate sonar #6

Workflow file for this run

# SPDX-FileCopyrightText: 2017-2023 Contributors to the OpenSTEF project <[email protected]> # noqa E501
#
# SPDX-License-Identifier: MPL-2.0
name: Python Build
on:
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.9", "3.11", "3.12"]
steps:
# Checkout
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
# Setup
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Restore
- name: Restore pip cache
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
# Install
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
# Very limited linting with Flake8 (see setup.cfg for configuration)
- name: Lint
run: |
pip install flake8
# Stop build on a couple more serious violations
# See https://flake8.pycqa.org/en/latest/user/error-codes.html for more details
flake8 . --count --select=E9,F63,F7,F8 --show-source --statistics
# Only print warnings on all other errors
flake8 . --count --exit-zero --show-source --statistics
# Test
- name: Unit test with pytest
run: |
pip install -r test-requirements.txt
pytest --cov-report=xml --cov=openstef/ test/ --junitxml=pytest-report.xml
# Fix relative paths in coverage file
# Known bug: https://community.sonarsource.com/t/sonar-on-github-actions-with-python-coverage-source-issue/36057
- name: fix code coverage paths
run: |
sed -i 's/\/home\/runner\/work\/openstef\/openstef\//\/github\/workspace\//g' coverage.xml
# Sonar cloud scan
- name: Build Python package
run: |
python setup.py sdist bdist_wheel