feat: major overhaul #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Quality | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
push: | |
branches: | |
- master | |
- develop | |
env: | |
SONAR_PROJECT_KEY: EuleMitKeule_eq3btsmart | |
SONAR_PROJECT_ORGANIZATION: eule | |
jobs: | |
cache: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.12" | |
- "3.13" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
enable-cache: true | |
cache-suffix: uv-${{ runner.os }}-${{ matrix.python-version }} | |
- name: Install dependecies | |
run: uv sync --all-extras | |
ruff: | |
needs: cache | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.12" | |
- "3.13" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
enable-cache: true | |
cache-suffix: uv-${{ runner.os }}-${{ matrix.python-version }} | |
- name: Install dependecies | |
run: uv sync --all-extras | |
- name: Run ruff | |
run: | | |
uv run ruff check . | |
mypy: | |
needs: cache | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.12" | |
- "3.13" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
enable-cache: true | |
cache-suffix: uv-${{ runner.os }}-${{ matrix.python-version }} | |
- name: Install dependecies | |
run: uv sync --all-extras | |
- name: Run mypy | |
run: | | |
uv run mypy --strict . | |
tests: | |
needs: cache | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.12" | |
- "3.13" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
enable-cache: true | |
cache-suffix: uv-${{ runner.os }}-${{ matrix.python-version }} | |
- name: Install dependecies | |
run: uv sync --all-extras | |
- name: Run tests | |
run: | | |
uv run pytest --cov=. --cov-report=term tests | |
sonar: | |
needs: cache | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.12" | |
- "3.13" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
enable-cache: true | |
cache-suffix: uv-${{ runner.os }}-${{ matrix.python-version }} | |
- name: Install dependecies | |
run: uv sync --all-extras | |
- name: Run tests | |
run: | | |
uv run pytest --cov=. --cov-report=xml --cov-report=term tests | |
- name: fix code coverage paths | |
run: | | |
sed -i 's|/home/runner/work/eq3btsmart/eq3btsmart|/github/workspace|g' coverage.xml | |
- name: Run SonarCloud analysis | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
args: > | |
-Dsonar.organization=${{ env.SONAR_PROJECT_ORGANIZATION }} | |
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} | |
-Dsonar.python.coverage.reportPaths=coverage.xml | |
-Dsonar.sources=/github/workspace/eq3btsmart | |
-Dsonar.tests=/github/workspace/tests | |
-Dsonar.python.version=${{ matrix.python-version }} | |
-Dsonar.text.inclusions=**/*.py |