name: Test Python (Reusable) on: workflow_call: inputs: python-version: required: true type: string secrets: CODECOV_TOKEN: required: false jobs: test: name: Test on Python ${{ inputs.python-version }} runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Python ${{ inputs.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e ".[dev]" - name: Run linting with ruff run: | ruff check src tests ruff format --check src tests - name: Run tests with pytest run: | pytest tests/ -v --cov=src --cov-report=term-missing --cov-report=xml - name: Upload coverage to Codecov if: inputs.python-version == '3.11' uses: codecov/codecov-action@v4 with: file: ./coverage.xml token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: false verbose: true