Skip to content

Check for code changes in github actions #6582

Check for code changes in github actions

Check for code changes in github actions #6582

Workflow file for this run

name: Unit Tests
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
check-paths:
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: check-paths
if: needs.check-paths.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: Run Pytest
run: |
export LIGHTLY_SERVER_LOCATION="localhost:-1"
pip install pytest-cov
python -m pytest -s -v --runslow --cov=./lightly --cov-report=xml --ignore=./lightly/openapi_generated/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}