Skip to content

Remove maven and synchronise release workflow #38

Remove maven and synchronise release workflow

Remove maven and synchronise release workflow #38

Workflow file for this run

name: "UnitTests"
on:
# add push to main trigger for sonarcloud scan
push:
branches:
- "main"
- "master"
workflow_dispatch:
pull_request:
paths:
- "nuvla/**"
- "tests/**"
- ".github/workflows/unittest.yml"
jobs:
run-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
cache: 'pip'
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v4
with:
path: ~/.local # the path depends on the OS
key: poetry-${{ matrix.python_version }} # increment to reset cache
- name: Setup Poetry
uses: snok/install-poetry@v1
if: steps.cached-poetry.outputs.cache-hit != 'true'
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: |
poetry install --with=tests
- name: Run Unittests
run: >
poetry run pytest
--junitxml=test-report.xml
--cov=nuvla
--cov-report=xml
--cov-report term
--cov-config=.coveragerc
--cov-branch
- name: Install jq (For Quality Gate)
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: SonarCloud Scan
if: matrix.python_version == '3.11'
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
- name: SonarQube Quality Gate check
if: matrix.python_version == '3.11'
uses: sonarsource/[email protected]
# Force to fail step after specific time
timeout-minutes: 5
with:
scanMetadataReportFile: .scannerwork/report-task.txt
env:
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
check_name: "| UnitTest for Py${{ matrix.python_version }} |"
files: test-report.xml