Skip to content

Fixed test units failure #36

Fixed test units failure

Fixed test units failure #36

name: Python Package
on: ['push', 'pull_request', 'workflow_dispatch']
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml
- uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
with:
name: coverage-report
path: |
coverage.xml
xunit-result.xml
sonar-cloud:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Pull coverage report
uses: actions/download-artifact@v2
with:
name: coverage-report
path: ${{ github.workspace }}
- name: Adjust coverage source path
run: sed -i "s+$PWD/++g" coverage.xml
- name: SonarCloud Scan
if: env.SONAR_TOKEN != null
uses: sonarsource/sonarcloud-github-action@master
with:
args: >
-Dsonar.projectKey=RECETOX_gc-meox-tms
-Dsonar.organization=recetox
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.python.version="3.10"
-Dsonar.sources=gc_meox_tms/
-Dsonar.tests=tests/
-Dsonar.python.coverage.reportPaths=coverage.xml
-Dsonar.python.xunit.reportPath=xunit-results.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}