Skip to content

Run Format Check on Multiple Python Versions #7064

Run Format Check on Multiple Python Versions

Run Format Check on Multiple Python Versions #7064

Workflow file for this run

name: Unit Tests
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
detect-code-changes:
name: Detect Code Changes
runs-on: ubuntu-latest
outputs:
run-tests: ${{ steps.filter.outputs.run-tests }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
list-files: shell
filters: |
run-tests:
- '!docs/**'
- '!examples/**'
- '!benchmarks/**'
test:
name: Test
needs: detect-code-changes
if: needs.detect-code-changes.outputs.run-tests == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.7", "3.12"]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Hack to get setup-python to work on nektos/act
run: |
if [ ! -f "/etc/lsb-release" ] ; then
echo "DISTRIB_RELEASE=18.04" > /etc/lsb-release
fi
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Set Up Environment
run: |
make install-uv reset-venv
source .venv/bin/activate
make install-pinned-extras
- name: Clean Previous Coverage Data
run: rm -f .coverage
- name: Run Pytest (Python 3.7)
if: matrix.python == '3.7'
run: |
source .venv/bin/activate
export LIGHTLY_SERVER_LOCATION="localhost:-1"
python -m pytest -s -v --runslow --ignore=./lightly/openapi_generated/
- name: Run Pytest with Coverage (Python 3.12)
if: matrix.python == '3.12'
run: |
source .venv/bin/activate
export LIGHTLY_SERVER_LOCATION="localhost:-1"
uv pip install pytest-cov==5.0.0
python -m pytest -s -v --runslow --cov=./lightly --cov-report=xml --ignore=./lightly/openapi_generated/
- name: Upload Coverage to Codecov
if: matrix.python == '3.12'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}