Skip to content

Fix/only return string #81

Fix/only return string

Fix/only return string #81

Workflow file for this run

name: Main
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Set up the environment
uses: ./.github/actions/setup-python-env
- name: Run pre-commit
run: uv run pre-commit run -a
tests-and-type-check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
fail-fast: false
defaults:
run:
shell: bash
steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up the environment
uses: ./.github/actions/setup-python-env
with:
python-version: ${{ matrix.python-version }}
- run: mkdir coverage
- name: Run tests
run: uv run coverage run -m pytest tests
env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
- name: Store coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
path: coverage
include-hidden-files: true
- name: Check typing
run: uv run pyright
coverage-combine:
needs: tests-and-type-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up the environment
uses: ./.github/actions/setup-python-env
- name: Get coverage files
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: coverage-*
path: coverage
- run: ls -la coverage
- run: uv run coverage combine coverage
- run: uv run coverage report
- run: uv run coverage html --show-contexts --title "markmagic coverage for ${{ github.sha }}"
- name: Store coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data
path: .coverage
include-hidden-files: true
- name: Store coverage HTML
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: htmlcov
coverage-pr-comment:
needs: coverage-combine
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Download coverage data
uses: actions/download-artifact@v4
with:
name: coverage-data
- name: Generate coverage comment
id: coverage-comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Store coverage comment
uses: actions/upload-artifact@v4
if: steps.coverage-comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
name: python-coverage-comment-action
path: python-coverage-comment-action.txt