Skip to content

Make codecov only run on Python3.10 #6739

Make codecov only run on Python3.10

Make codecov only run on Python3.10 #6739

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@v3
- 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.10"]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- 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@v4
with:
python-version: ${{ matrix.python }}
- uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: general-env-${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('requirements/**') }}
- name: Install Dependencies and lightly
run: pip install -e '.[all]'
- name: Clean Previous Coverage Data
run: rm -f .coverage
- name: Run Pytest (Python 3.7)
if: matrix.python == '3.7'
run: |
export LIGHTLY_SERVER_LOCATION="localhost:-1"
python -m pytest -s -v --runslow --ignore=./lightly/openapi_generated/
- name: Run Pytest with Coverage (Python 3.10)
if: matrix.python == '3.10'
run: |
export LIGHTLY_SERVER_LOCATION="localhost:-1"
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.10'
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}