Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for code changes in github actions #1500

Merged
merged 10 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 49 additions & 39 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,64 @@ name: Unit Tests

on:
push:
paths-ignore:
- 'docs/**'
- 'examples/**'
- 'benchmarks/**'
branches:
- master
pull_request:
paths-ignore:
- 'docs/**'
- 'examples/**'
- 'benchmarks/**'
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: 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 }}
- 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 }}
2 changes: 2 additions & 0 deletions .github/workflows/test_code_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Code Format Check

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

Expand Down
66 changes: 39 additions & 27 deletions .github/workflows/test_minimal_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,54 @@ name: Minimal Dependency Tests

on:
push:
paths-ignore:
- 'docs/**'
- 'examples/**'
- 'benchmarks/**'
branches:
- master
pull_request:
paths-ignore:
- 'docs/**'
- 'examples/**'
- 'benchmarks/**'
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"]


steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Cache Python Dependencies
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: minimal-env-${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('requirements/minimal_requirements.txt') }}
- name: Install Minimal Dependencies
run: pip install -r requirements/minimal_requirements.txt
- name: Install Package Without Dependencies
run: pip install --no-deps .
- name: Run Tests
run: |
export LIGHTLY_SERVER_LOCATION="localhost:-1"
python -m pytest -s -v --runslow
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Cache Python Dependencies
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: minimal-env-${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('requirements/minimal_requirements.txt') }}
- name: Install Minimal Dependencies
run: pip install -r requirements/minimal_requirements.txt
- name: Install Package Without Dependencies
run: pip install --no-deps .
- name: Run Tests
run: |
export LIGHTLY_SERVER_LOCATION="localhost:-1"
python -m pytest -s -v --runslow
90 changes: 52 additions & 38 deletions .github/workflows/test_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,64 @@ name: check setup.py

on:
push:
paths-ignore:
- 'docs/**'
branches:
- master
pull_request:
paths-ignore:
- 'docs/**'
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/**'

test:
name: Test setup.py
needs: detect-code-changes
if: needs.detect-code-changes.outputs.run-tests == 'true'
runs-on: ubuntu-latest


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 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
- uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: cache_v2_${{ env.pythonLocation }}-${{ hashFiles('requirements/**') }}
- name: Install Dependencies and lightly
run: pip install .
- name: basic tests of CLI
run: |
LIGHTLY_SERVER_LOCATION="localhost:-1"
lightly-crop --help
lightly-train --help
lightly-embed --help
lightly-magic --help
lightly-download --help
lightly-version
- name: test of CLI on a real dataset
run: |
LIGHTLY_SERVER_LOCATION="localhost:-1"
git clone https://github.com/alexeygrigorev/clothing-dataset-small clothing_dataset_small
INPUT_DIR_1="clothing_dataset_small/test/dress"
lightly-train input_dir=$INPUT_DIR_1 trainer.max_epochs=1 loader.num_workers=6
lightly-embed input_dir=$INPUT_DIR_1
- 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 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
- uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: cache_v2_${{ env.pythonLocation }}-${{ hashFiles('requirements/**') }}
- name: Install Dependencies and lightly
run: pip install .
- name: basic tests of CLI
run: |
LIGHTLY_SERVER_LOCATION="localhost:-1"
lightly-crop --help
lightly-train --help
lightly-embed --help
lightly-magic --help
lightly-download --help
lightly-version
- name: test of CLI on a real dataset
run: |
LIGHTLY_SERVER_LOCATION="localhost:-1"
git clone https://github.com/alexeygrigorev/clothing-dataset-small clothing_dataset_small
INPUT_DIR_1="clothing_dataset_small/test/dress"
lightly-train input_dir=$INPUT_DIR_1 trainer.max_epochs=1 loader.num_workers=6
lightly-embed input_dir=$INPUT_DIR_1
Loading