Skip to content

feat: add origin property and set_origin() method #727

feat: add origin property and set_origin() method

feat: add origin property and set_origin() method #727

Workflow file for this run

name: CI
permissions:
contents: read
on:
workflow_dispatch:
push:
branches: ["master", "develop"]
paths-ignore:
- "docs/**"
- "**/*.md"
- "mkdocs.yml"
pull_request:
branches: ["master", "develop"]
paths-ignore:
- "docs/**"
- "**/*.md"
- "mkdocs.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: ${{ format('Test Python {0} {1}', matrix.python_version, ((matrix.dependencies == 'min' || matrix.dependencies == 'max') && format('{0} dependencies', matrix.dependencies)) || (matrix.os || 'ubuntu-latest')) }}
runs-on: ${{ matrix.os }}
env:
PYTHONIOENCODING: utf-8
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up uv
uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3 # v7.1.3
with:
version: "0.7.13" # Sync with pyproject.toml
enable-cache: true
- name: Setup dependencies
run: |
uv sync $CI_UV_UPGRADE_ARG
env:
CI_UV_UPGRADE_ARG: ${{ matrix.dependencies == 'max' && '--upgrade' || '' }}
UV_RESOLUTION: ${{ matrix.dependencies == 'min' && 'lowest-direct' || 'highest' }}
- name: Run checks
if: ${{ matrix.checks == null || matrix.checks == 'true' }}
run: |
uv run pre-commit run --all-files
uv run pyright
- name: Run pytest
uses: pavelzw/pytest-action@510c5e90c360a185039bea56ce8b3e7e51a16507 # v2.2.0
with:
custom-pytest: uv run pytest -m "not hypothesis"
custom-arguments: --cov --junitxml=junit.xml -o junit_family=legacy --cov-report=xml
env:
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
- name: Test README codeblocks
run: |
uv run pytest --codeblocks README.md -v
- name: Configure coverage reports directory
if: ${{ matrix.sonarqube != null && matrix.sonarqube == 'true' && !cancelled() }}
run: |
mkdir -p ./test-reports
- name: Upload coverage reports
if: ${{ matrix.sonarqube != null && matrix.sonarqube == 'true' && !cancelled() }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: coverage-reports
path: test-reports/coverage.xml
strategy:
matrix:
python_version: ["3.10", "3.14"]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
dependencies: ["lockfile"]
sonarqube: ["false"]
include:
- python_version: "3.11"
os: "ubuntu-latest"
- python_version: "3.12"
os: "ubuntu-latest"
- python_version: "3.13"
os: "ubuntu-latest"
- os: "ubuntu-latest"
python_version: "3.10"
dependencies: "min"
checks: "false"
sonarqube: "true"
- dependencies: "max"
python_version: "3.14"
os: "ubuntu-latest"
checks: "false"
code-analysis:
name: Analyse Code Quality
runs-on: ubuntu-latest
needs: tests
permissions:
pull-requests: write # SonarQube needs to post comments on PRs
if: always() && needs.tests.result == 'success'
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0 # Shallow clones should be disabled for better relevancy of analysis
persist-credentials: false
- name: Download coverage reports
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: coverage-reports
path: test-reports/
continue-on-error: true
- name: Create SonarQube properties
run: |
cat > sonar-project.properties << EOF
sonar.projectKey=${SONAR_PROJECT_KEY}
sonar.language=py
sonar.python.version=3.10
sonar.sources=./src
sonar.tests=./tests
sonar.python.coverage.reportPaths=./test-reports/coverage.xml
sonar.exclusions=**/Dockerfile,**/notebooks/**,**/scripts/**
sonar.verbose=false
EOF
env:
SONAR_PROJECT_KEY: ${{ vars.SONAR_PROJECT_KEY }}
- name: Run SonarQube analysis
uses: SonarSource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602 # v6.0.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}