Skip to content
Open
Show file tree
Hide file tree
Changes from 12 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
33 changes: 13 additions & 20 deletions .github/workflows/check_example_nbs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,24 @@ on:
- "examples/**/*.py"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
convert-to-nbs:
name: "Check Example Notebooks"
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set Up Python
uses: actions/setup-python@v5
uses: actions/checkout@v6
- name: Set Up uv
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: 3.7
version: 0.12.3
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set Up Environment
run: |
make install-uv reset-venv
source .venv/bin/activate
make install-pinned-notebook
- name: Convert using Script
run: |
source .venv/bin/activate
make generate-example-notebooks
- name: Check for diff
run: |
source .venv/bin/activate
git add examples/notebooks/
if ! git diff --cached --exit-code; then
echo "Notebooks have changed! Please run 'make generate-example-notebooks' and commit the changes."
exit 1
fi
run: make install-notebook
- name: Check Notebooks Are Up To Date
run: make test-notebooks
25 changes: 16 additions & 9 deletions .github/workflows/release_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Checkout latest release tag
Expand All @@ -21,18 +21,25 @@ jobs:
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $LATEST_TAG
echo "tag_name=$LATEST_TAG" >> $GITHUB_OUTPUT;
- name: Set up Python 3.12
uses: actions/setup-python@v5
- name: Set Up uv
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: "3.12"
version: 0.12.3
enable-cache: true
cache-dependency-glob: "uv.lock"
# This job builds the release tag that was checked out above, not the default
# branch, so it deliberately avoids `make` targets and dependency groups: those
# only exist in the tag's own Makefile/pyproject.toml. `uv build` needs nothing
# but [build-system], and `uvx` installs twine into a throwaway environment.
- name: Build and release
id: build_and_release
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER_NAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip3 install wheel
pip3 install twine
pip3 install build
make dist
twine upload -u ${{ secrets.PYPI_USER_NAME }} -p ${{ secrets.PYPI_PASSWORD }} dist/*
uv build

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll only see if this works once we release.

ls -l dist
uvx twine upload dist/*
- name: Convert success/failure strings to emojis
id: emoji_status
run: |
Expand Down
76 changes: 28 additions & 48 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,22 @@ on:
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
LIGHTLY_SERVER_LOCATION: "localhost:-1"

jobs:
detect-code-changes:
name: Detect Code Changes
runs-on: ubuntu-22.04
outputs:
run-tests: ${{ steps.filter.outputs.run-tests }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
list-files: shell
Expand All @@ -31,37 +38,19 @@ jobs:
needs: detect-code-changes
if: needs.detect-code-changes.outputs.run-tests == 'true'
runs-on: ubuntu-22.04
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
uses: actions/checkout@v6
- name: Set Up uv
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: ${{ matrix.python }}
version: 0.12.3
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set Up Environment
run: |
make install-uv reset-venv
source .venv/bin/activate
make install-pinned-extras-${{ matrix.python }}
- name: Run Pytest (Python 3.7)
if: matrix.python == '3.7'
run: |
source .venv/bin/activate
python -m pytest -s -v --runslow
- name: Run Pytest (Python 3.12)
if: matrix.python == '3.12'
run: |
source .venv/bin/activate
python -m pytest -s -v --runslow
run: make install-maximal-extras
- name: Run Pytest
run: make test-maximal-extras

distributed-tests:
name: Distributed Tests
Expand All @@ -70,25 +59,16 @@ jobs:
runs-on: ubuntu-22.04
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
uses: actions/checkout@v6
- name: Set Up uv
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: "3.12"
version: 0.12.3
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set Up Environment
run: |
make install-uv reset-venv
source .venv/bin/activate
make install-pinned-extras-3.12
# Run the @pytest.mark.DDP tests on the shared gloo pool (real multi-rank
# collective, not mocked). USE_PYTEST_POOL enables it; off by default. See #1982.
run: make install-maximal-extras
# Runs the @pytest.mark.DDP tests on the shared gloo pool (real multi-rank
# collective, not mocked). See #1982.
- name: Run Distributed Tests (gloo pool)
run: |
source .venv/bin/activate
export USE_PYTEST_POOL=1
python -m pytest -s -v --runslow -m DDP
run: make test-distributed
39 changes: 17 additions & 22 deletions .github/workflows/test_code_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,30 @@ on:
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Check
runs-on: ubuntu-22.04
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
uses: actions/checkout@v6
- name: Set Up uv
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: ${{ matrix.python }}
version: 0.12.3
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set Up Environment
run: |
make install-uv reset-venv
source .venv/bin/activate
make install-pinned-extras
run: make install-maximal
# ruff and mypy are version-pinned in the dev dependency group, so their results do
# not depend on the Python version. Checking a single environment is enough.
- name: Check Lockfile
run: make lock-check
- name: Run Format Check
run: |
source .venv/bin/activate
make format-check
run: make format-check
- name: Run Type Check
run: |
source .venv/bin/activate
make type-check
run: make type-check
35 changes: 19 additions & 16 deletions .github/workflows/test_minimal_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,22 @@ on:
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
LIGHTLY_SERVER_LOCATION: "localhost:-1"

jobs:
detect-code-changes:
name: Detect Code Changes
runs-on: ubuntu-22.04
outputs:
run-tests: ${{ steps.filter.outputs.run-tests }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
list-files: shell
Expand All @@ -33,22 +40,18 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python: ["3.7"]
# Tests the lowest supported dependency versions on the lowest supported
# Python version. uv provisions the interpreter, so no setup-python needed.
dependencies: ["minimal", "minimal-extras"]
steps:
- uses: actions/checkout@v4
- name: Set Up Python
uses: actions/setup-python@v5
- uses: actions/checkout@v6
- name: Set Up uv
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: ${{ matrix.python }}
version: 0.12.3
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set Up Environment
run: |
# Install system dependencies required by PyAV on CI.
make install-av-system-deps
make install-uv reset-venv
source .venv/bin/activate
make install-${{ matrix.dependencies }}
run: make install-${{ matrix.dependencies }}
- name: Run Tests
run: |
source .venv/bin/activate
python -m pytest -s -v --runslow
run: make test-${{ matrix.dependencies }}
47 changes: 18 additions & 29 deletions .github/workflows/test_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,22 @@ on:
merge_group:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
LIGHTLY_SERVER_LOCATION: "localhost:-1"

jobs:
detect-code-changes:
name: Detect Code Changes
runs-on: ubuntu-22.04
outputs:
run-tests: ${{ steps.filter.outputs.run-tests }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
list-files: shell
Expand All @@ -29,36 +36,18 @@ jobs:
needs: detect-code-changes
if: needs.detect-code-changes.outputs.run-tests == 'true'
runs-on: ubuntu-22.04

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
uses: actions/checkout@v6
- name: Set Up uv
uses: astral-sh/setup-uv@v9.0.0
with:
python-version: 3.7
version: 0.12.3
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set Up Environment
run: |
make install-uv reset-venv
source .venv/bin/activate
make install-pinned
run: make install-maximal
- name: Test CLI
run: |
source .venv/bin/activate
lightly-crop --help
lightly-ssl-train --help
lightly-embed --help
lightly-magic --help
lightly-version
run: make test-cli
- name: Test CLI on Dataset
run: |
source .venv/bin/activate
git clone https://github.com/alexeygrigorev/clothing-dataset-small clothing_dataset_small
INPUT_DIR_1="clothing_dataset_small/test/dress"
lightly-ssl-train input_dir=$INPUT_DIR_1 trainer.max_epochs=1 loader.num_workers=6
lightly-embed input_dir=$INPUT_DIR_1
run: make test-cli-dataset
Loading
Loading