Skip to content

Cloud integration

Cloud integration #561

Workflow file for this run

name: Cloud integration
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
workflow_dispatch:
schedule:
- cron: "0 0 * * *" # every day at midnight UTC
defaults:
run:
shell: bash
jobs:
access-secrets:
# try to access secrets to ensure they are available
# if not set job output to be false
runs-on: ubuntu-latest
outputs:
secrets_available: ${{ steps.check_secrets.outputs.secrets_available }}
steps:
- name: Check secrets
id: check_secrets
run: |
if [[ -z "${{ secrets.LIGHTNING_USER_ID }}" || -z "${{ secrets.LIGHTNING_API_KEY }}" ]]; then
echo "Secrets are not set. Exiting..."
echo "secrets_available=false" >> $GITHUB_OUTPUT
else
echo "Secrets are available."
echo "secrets_available=true" >> $GITHUB_OUTPUT
fi
integration:
needs: access-secrets
if: needs.access-secrets.outputs.secrets_available == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "macOS-13", "windows-2022"]
python-version: ["3.10"]
requires: ["latest"]
include:
- { os: "ubuntu-22.04", python-version: "3.9", requires: "oldest" }
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 25
env:
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Set min. dependencies
if: matrix.requires == 'oldest'
run: |
pip install 'lightning-utilities[cli]'
python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]'
- name: Install package & dependencies
run: |
pip --version
pip install -e '.[test,extra]' -U -q --find-links $TORCH_URL
pip list
- name: Test integrations
env:
LIGHTNING_USER_ID: ${{ secrets.LIGHTNING_USER_ID }}
LIGHTNING_API_KEY: ${{ secrets.LIGHTNING_API_KEY }}
run: |
coverage run --source litmodels -m pytest src tests -v -m cloud
timeout-minutes: 15
- name: Statistics
run: |
coverage report
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: integrations
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
integration-guardian:
runs-on: ubuntu-latest
needs: integration
if: always()
steps:
- run: echo "${{ needs.integration.result }}"
- name: failing...
if: needs.integration.result == 'failure'
run: exit 1
- name: cancelled or skipped...
if: contains(fromJSON('["cancelled", "skipped"]'), needs.integration.result)
timeout-minutes: 1
run: sleep 90
# todo add job to report failing tests with cron