Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions .github/actions/pip-list/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ runs:
echo '<summary>pip list</summary>' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
pip list >> $GITHUB_STEP_SUMMARY
uv pip list >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '</details>' >> $GITHUB_STEP_SUMMARY
pip list # also print to stdout
uv pip list # also print to stdout
shell: bash
2 changes: 1 addition & 1 deletion .github/actions/pkg-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ runs:

- name: Install package (archive)
if: ${{ inputs.install-from == 'archive' }}
working-directory: pypi/
working-directory: ${{ inputs.pkg-folder }}
run: |
set -ex
pip install '${{ env.PKG_SOURCE }}${{ inputs.pkg-extras }}' \
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ defaults:
env:
# just use CPU version since running on CPU machine
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
UV_TORCH_BACKEND: cpu
# default 0 means to keep for the maximum time
KEEP_DAYS: 0

Expand All @@ -72,11 +73,12 @@ jobs:
with:
submodules: recursive

- name: Set up Python 🐍 ${{ inputs.python-version }}
uses: actions/setup-python@v6
- name: Set up uv and Python 🐍 ${{ inputs.python-version }}
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
python-version: ${{ inputs.python-version }}
cache: "pip"
enable-cache: true

- name: Install pandoc & texlive
if: ${{ inputs.install-tex == 'true' }}
Expand All @@ -92,9 +94,9 @@ jobs:
- name: Install dependencies
timeout-minutes: 20
run: |
pip --version
pip install -e . -U -r ${{ inputs.requirements-file }} -f ${TORCH_URL}
pip list
uv --version
uv pip install -e . -U -r ${{ inputs.requirements-file }} -f ${TORCH_URL}
uv pip list

- name: Pull reusable 🤖 actions️
if: ${{ inputs.actions-ref != '' }}
Expand Down Expand Up @@ -123,3 +125,6 @@ jobs:
path: ${{ inputs.docs-dir }}/build/
retention-days: ${{ env.KEEP_DAYS }}
include-hidden-files: true

- name: Minimize uv cache
run: uv cache prune --ci
27 changes: 21 additions & 6 deletions .github/workflows/check-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ jobs:
with:
fetch-depth: 0 # checkout entire history for all branches (required when using scm-based versioning)
submodules: recursive
- name: Set up Python 🐍
uses: actions/setup-python@v6
- name: Set up uv and Python 🐍
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
python-version: ${{ matrix.python-version || '3.x' }}
enable-cache: true

- name: Pull reusable 🤖 actions️
uses: actions/checkout@v5
Expand All @@ -93,8 +95,8 @@ jobs:
repository: Lightning-AI/utilities
- name: Prepare build env.
run: |
pip install -q -r ./.cicd/requirements/gha-package.txt
pip list
uv pip install -q -r ./.cicd/requirements/gha-package.txt
uv pip list
- name: Create package 📦
uses: ./.cicd/.github/actions/pkg-create
- name: Upload 📤 packages
Expand All @@ -104,6 +106,9 @@ jobs:
name: ${{ inputs.artifact-name }}-build-${{ strategy.job-index }}
path: dist

- name: Minimize uv cache
run: uv cache prune --ci

merge-artifacts:
needs: pkg-build
runs-on: ubuntu-latest
Expand All @@ -114,10 +119,16 @@ jobs:
ref: ${{ inputs.actions-ref }}
path: .cicd
repository: Lightning-AI/utilities
- name: Set up uv and Python
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
python-version: "3.10"
enable-cache: true
- name: Prepare build env.
run: |
pip install -q -r ./.cicd/requirements/gha-package.txt
pip list
uv pip install -q -r ./.cicd/requirements/gha-package.txt
uv pip list

- name: Download 📥
uses: actions/download-artifact@v6
Expand All @@ -136,6 +147,9 @@ jobs:
name: ${{ inputs.artifact-name }}
path: dist

- name: Minimize uv cache
run: uv cache prune --ci

pkg-check:
needs: merge-artifacts
runs-on: ${{ matrix.os }}
Expand All @@ -148,6 +162,7 @@ jobs:
uses: actions/checkout@v5
with:
submodules: recursive
# NOTE: use pip as gold standard for package validation
- name: Set up Python 🐍 ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/check-precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ jobs:
submodules: recursive
token: ${{ secrets.github-token || github.token }}

- name: Set up Python 🐍
uses: actions/setup-python@v6
- name: Set up uv and Python 🐍
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
python-version: ${{ inputs.python-version }}
enable-cache: true

- name: Cache 💽 pre-commit
if: ${{ inputs.use-cache == true }}
Expand All @@ -53,9 +55,12 @@ jobs:
- name: Run pre-commit 🤖
id: precommit
run: |
pip install -q pre-commit
uv pip install -q pre-commit
pre-commit run --all-files

- name: Minimize uv cache
run: uv cache prune --ci

- name: Fixing Pull Request ↩️
if: always() && inputs.push-fixes == true && steps.precommit.outcome == 'failure'
uses: actions-js/push@v1.5
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/check-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ jobs:
uses: actions/checkout@v5
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v6
- name: Set up uv and Python
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
python-version: "3.10"
enable-cache: true

# if actions version is given install defined versions
- name: "[optional] Pull reusable 🤖 actions"
Expand All @@ -48,15 +50,16 @@ jobs:
if: inputs.actions-ref != ''
timeout-minutes: 5
run: |
pip install -r ./.cicd/requirements/gha-schema.txt
pip list | grep "check-jsonschema"
uv pip install -r ./.cicd/requirements/gha-schema.txt
uv pip list | grep "check-jsonschema"

# otherwise fall back to using the latest
- name: "[default] Install recommended dependencies"
if: inputs.actions-ref == ''
timeout-minutes: 5
run: |
pip install -q check-jsonschema
pip list | grep "check-jsonschema"
uv pip install -q check-jsonschema
uv pip list | grep "check-jsonschema"

- name: Scan repo
id: folders
Expand Down Expand Up @@ -92,3 +95,6 @@ jobs:
echo $f;
check-jsonschema -v $f --schemafile "$SCHEMA_FILE" --regex-variant="nonunicode";
done

- name: Minimize uv cache
run: uv cache prune --ci
15 changes: 11 additions & 4 deletions .github/workflows/check-typing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,28 @@ defaults:
jobs:
mypy:
runs-on: ubuntu-24.04
env:
UV_TORCH_BACKEND: cpu
steps:
- name: Checkout 🛎️
uses: actions/checkout@v5
with:
submodules: recursive

- name: Set up Python 🐍 ${{ inputs.python-version }}
uses: actions/setup-python@v6
- name: Set up uv and Python 🐍 ${{ inputs.python-version }}
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
python-version: ${{ inputs.python-version }}
enable-cache: true

- name: Install dependencies
timeout-minutes: 20
run: |
# don't use --upgrade to respect the version installed via setup.py
pip install -e '.[${{ inputs.extra-typing }}]' mypy \
uv pip install -e '.[${{ inputs.extra-typing }}]' mypy types-requests \
--extra-index-url https://download.pytorch.org/whl/cpu/torch_stable.html
pip list
uv pip list

- name: Pull reusable 🤖 actions️
if: ${{ inputs.actions-ref != '' }}
Expand Down Expand Up @@ -94,3 +98,6 @@ jobs:
| sed 's/\.py//g; s|${SOURCE_DIR}||g; s|\/__init__||g; s|\/|\.|g' \
| xargs -I {} echo '"{}",' \
|| true

- name: Minimize uv cache
run: uv cache prune --ci
13 changes: 9 additions & 4 deletions .github/workflows/ci-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ jobs:
steps:
- name: Checkout 🛎
uses: actions/checkout@v5
- name: Set up Python 🐍 ${{ matrix.python-version }}
uses: actions/setup-python@v6
- name: Set up uv and Python 🐍 ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: install package
run: |
pip install -e '.[cli]'
pip list
uv pip install -e '.[cli]'
uv pip list

- name: run CLI
working-directory: ./requirements
Expand All @@ -40,6 +42,9 @@ jobs:
python -m lightning_utilities.cli requirements set-oldest --req_files="cli.txt"
python -m lightning_utilities.cli requirements set-oldest --req_files='["cli.txt", "docs.txt"]'

- name: Minimize uv cache
run: uv cache prune --ci

cli-guardian:
runs-on: ubuntu-latest
needs: test-cli
Expand Down
35 changes: 22 additions & 13 deletions .github/workflows/ci-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,58 @@ jobs:
steps:
- name: Checkout 🛎
uses: actions/checkout@v5
- name: Set up Python 🐍 ${{ matrix.python-version }}
uses: actions/setup-python@v6
- name: Set up uv and Python 🐍 ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
python-version: ${{ matrix.python-version }}
cache: "pip"
enable-cache: true

- name: Install dependencies
timeout-minutes: 5
run: |
pip install -r requirements/_tests.txt
pip --version
pip list
uv pip install -r requirements/_tests.txt
uv --version
uv pip list

- name: test Scripts
working-directory: ./scripts
run: pytest . -v
run: uv run pytest . -v

- name: Minimize uv cache
run: uv cache prune --ci

standalone-run:
runs-on: "ubuntu-22.04"
timeout-minutes: 20
env:
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
UV_TORCH_BACKEND: cpu
steps:
- name: Checkout 🛎
uses: actions/checkout@v5
- name: Set up Python 🐍 ${{ matrix.python-version }}
uses: actions/setup-python@v6
- name: Set up uv and Python 🐍 ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
python-version: "3.10"
cache: "pip"
enable-cache: true
- name: Install dependencies
timeout-minutes: 20
run: |
set -e
pip install -e ".[cli]" -U -r requirements/_tests.txt -f $TORCH_URL
pip --version
pip list
uv pip install -e ".[cli]" -U -r requirements/_tests.txt -f $TORCH_URL
uv --version
uv pip list

- name: Run standalone script
run: bash ./scripts/run_standalone_tests.sh "tests"
env:
COVERAGE_SOURCE: "lightning_utilities"

- name: Minimize uv cache
run: uv cache prune --ci

scripts-guardian:
runs-on: ubuntu-latest
needs: [test-scripts, standalone-run]
Expand Down
Loading