Skip to content

Improve Sonar coverage and quality compliance (#213) #1763

Improve Sonar coverage and quality compliance (#213)

Improve Sonar coverage and quality compliance (#213) #1763

Workflow file for this run

name: Build, Test & Publish to Test PyPi
on:
push:
branches:
- master
- main
- 'feature/UAT*' # only publish to TestPyPI for these
pull_request:
branches: [ master, main ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
UV_HTTP_TIMEOUT: 300
PIP_DISABLE_PIP_VERSION_CHECK: 1
jobs:
tests:
strategy:
fail-fast: true
matrix:
python-versions: ["3.9", "3.10", "3.11", "3.12", "3.13"]
name: Tests on Python ${{ matrix.python-versions }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v4
- name: Set up Python ${{ matrix.python-versions }}
run: uv python install ${{ matrix.python-versions }}
- name: Install project (dev + extras)
run: uv sync --all-extras --dev
- name: Setup git for documentation
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Run tox (lint + test + docs + py)
run: |
uv python pin ${{ matrix.python-versions }}
uv run tox -e lint,test,doc,py
build-and-integ:
needs: tests
runs-on: ubuntu-latest
name: Build + Integration Tests (Python 3.9)
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v4
- name: Set up Python 3.9
run: uv python install 3.9
- name: Install project (dev + extras)
run: uv sync --all-extras --dev
- name: Build sdist & wheel
run: uv build --sdist --wheel
- name: Integration test artifacts (install wheel)
run: |
ls -l dist
rm -rf .venv
for pkg in dist/*.whl; do
echo "Testing wheel: $pkg"
uv venv
uv pip install "$pkg" pytest pytest-random-order --force-reinstall
.venv/bin/pytest -v py_integ -s
done
env:
FUSION_CLIENT_ID: ${{ secrets.FUSION_CLIENT_ID }}
FUSION_CLIENT_SECRET: ${{ secrets.FUSION_CLIENT_SECRET }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: |
dist/*.tar.gz
dist/*.whl
# Only publish when branch starts with feature/UAT
- name: Publish to TestPyPI
if: startsWith(github.ref, 'refs/heads/feature/UAT')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TEST_API_FUSIONDEVS }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true