2023-08-30 17:11:35 +00:00
|
|
|
name: Docker builds
|
2022-07-12 10:08:37 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [master, "release/*"]
|
|
|
|
pull_request:
|
|
|
|
branches: [master, "release/*"]
|
2023-09-25 12:34:41 +00:00
|
|
|
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
|
2022-07-12 10:08:37 +00:00
|
|
|
paths:
|
2023-06-15 15:25:59 +00:00
|
|
|
- ".actions/*"
|
2023-08-30 17:11:35 +00:00
|
|
|
- ".github/workflows/docker-build.yml"
|
2022-11-26 01:16:48 +00:00
|
|
|
- "dockers/**"
|
2023-01-14 03:02:10 +00:00
|
|
|
- "requirements/*.txt"
|
2022-11-11 16:38:09 +00:00
|
|
|
- "requirements/pytorch/**"
|
2023-01-04 15:57:18 +00:00
|
|
|
- "requirements/fabric/**"
|
2022-07-12 10:08:37 +00:00
|
|
|
- "setup.py"
|
2022-11-26 01:16:48 +00:00
|
|
|
- "!requirements/*/docs.txt"
|
2022-11-16 10:07:02 +00:00
|
|
|
- "!*.md"
|
|
|
|
- "!**/*.md"
|
2022-07-12 10:08:37 +00:00
|
|
|
schedule:
|
2023-09-25 12:34:41 +00:00
|
|
|
- cron: "0 0 * * *" # at the end of every day
|
2023-01-04 22:44:23 +00:00
|
|
|
release:
|
|
|
|
types: [published]
|
2023-09-11 18:05:09 +00:00
|
|
|
workflow_dispatch: {}
|
2022-07-12 10:08:37 +00:00
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}-${{ github.event_name }}
|
2023-12-21 22:49:18 +00:00
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
2022-07-12 10:08:37 +00:00
|
|
|
|
|
|
|
env:
|
2023-09-11 18:05:09 +00:00
|
|
|
PUSH_NIGHTLY: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
|
2023-08-30 17:11:35 +00:00
|
|
|
PUSH_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'release' }}
|
2022-07-12 10:08:37 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-pl:
|
2023-03-21 12:31:05 +00:00
|
|
|
# the images generated by this job are not used anywhere in this repository. they are just meant to be available
|
|
|
|
# for users
|
2022-11-04 16:17:48 +00:00
|
|
|
if: github.event.pull_request.draft == false
|
2023-06-15 12:14:43 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-07-12 10:08:37 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-08-10 10:37:50 +00:00
|
|
|
include:
|
|
|
|
# We only release one docker image per PyTorch version.
|
2024-01-26 16:44:24 +00:00
|
|
|
# Make sure the matrix here matches the one below.
|
2024-04-27 05:24:07 +00:00
|
|
|
- { python_version: "3.11", pytorch_version: "2.1", cuda_version: "12.1.0" }
|
|
|
|
- { python_version: "3.11", pytorch_version: "2.2", cuda_version: "12.1.0" }
|
2024-07-11 10:52:56 +00:00
|
|
|
- { python_version: "3.11", pytorch_version: "2.3", cuda_version: "12.1.0" }
|
2024-07-25 10:59:43 +00:00
|
|
|
- { python_version: "3.12", pytorch_version: "2.4", cuda_version: "12.1.0" }
|
2022-07-12 10:08:37 +00:00
|
|
|
steps:
|
2023-10-03 19:42:18 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-04-12 21:52:42 +00:00
|
|
|
with:
|
|
|
|
submodules: true
|
2023-09-18 13:28:07 +00:00
|
|
|
- uses: docker/setup-buildx-action@v3
|
2023-09-18 11:17:21 +00:00
|
|
|
- uses: docker/login-action@v3
|
2023-09-01 14:16:43 +00:00
|
|
|
if: env.PUSH_RELEASE == 'true' && github.repository_owner == 'Lightning-AI'
|
2023-08-30 17:11:35 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Get release version
|
|
|
|
if: github.event_name == 'release'
|
|
|
|
# For workflows triggered by release, `GITHUB_REF` is the release tag created.
|
|
|
|
run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
|
|
|
|
- name: Set tags
|
|
|
|
run: |
|
|
|
|
import os
|
|
|
|
|
|
|
|
repo = "pytorchlightning/pytorch_lightning"
|
|
|
|
ver = os.getenv('RELEASE_VERSION')
|
|
|
|
py_ver = "${{ matrix.python_version }}"
|
|
|
|
pt_ver = "${{ matrix.pytorch_version }}"
|
|
|
|
cuda_ver = "${{ matrix.cuda_version }}"
|
|
|
|
tags = [f"latest-py{py_ver}-torch{pt_ver}-cuda{cuda_ver}"]
|
|
|
|
if ver:
|
|
|
|
tags += [f"{ver}-py{py_ver}-torch{pt_ver}-cuda{cuda_ver}"]
|
2024-07-11 10:52:56 +00:00
|
|
|
if py_ver == '3.11' and pt_ver == '2.3' and cuda_ver == '12.1.0':
|
2023-08-30 17:11:35 +00:00
|
|
|
tags += ["latest"]
|
|
|
|
|
|
|
|
tags = [f"{repo}:{tag}" for tag in tags]
|
|
|
|
with open(os.getenv('GITHUB_ENV'), "a") as gh_env:
|
|
|
|
gh_env.write("DOCKER_TAGS=" + ",".join(tags))
|
|
|
|
shell: python
|
|
|
|
|
2024-06-24 05:46:29 +00:00
|
|
|
- uses: docker/build-push-action@v6
|
2022-07-12 10:08:37 +00:00
|
|
|
with:
|
|
|
|
build-args: |
|
|
|
|
PYTHON_VERSION=${{ matrix.python_version }}
|
|
|
|
PYTORCH_VERSION=${{ matrix.pytorch_version }}
|
2022-08-10 10:37:50 +00:00
|
|
|
CUDA_VERSION=${{ matrix.cuda_version }}
|
2023-08-30 17:11:35 +00:00
|
|
|
LIGHTNING_VERSION=${{ env.RELEASE_VERSION }}
|
2022-07-12 10:08:37 +00:00
|
|
|
file: dockers/release/Dockerfile
|
2023-09-25 12:34:41 +00:00
|
|
|
push: ${{ env.PUSH_RELEASE }} # pushed in release-docker.yml only when PL is released
|
2023-08-30 17:11:35 +00:00
|
|
|
tags: ${{ env.DOCKER_TAGS }}
|
|
|
|
timeout-minutes: 35
|
2022-07-12 10:08:37 +00:00
|
|
|
|
|
|
|
build-cuda:
|
2022-11-04 16:17:48 +00:00
|
|
|
if: github.event.pull_request.draft == false
|
2023-06-15 12:14:43 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-07-12 10:08:37 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
2024-01-26 16:44:24 +00:00
|
|
|
# These are the base images for PL release docker images.
|
|
|
|
# Make sure the matrix here matches the one above.
|
2024-01-26 15:42:09 +00:00
|
|
|
- { python_version: "3.11", pytorch_version: "2.1", cuda_version: "12.1.0" }
|
|
|
|
- { python_version: "3.11", pytorch_version: "2.2", cuda_version: "12.1.0" }
|
2024-04-29 11:16:13 +00:00
|
|
|
- { python_version: "3.11", pytorch_version: "2.3", cuda_version: "12.1.0" }
|
2024-07-25 10:59:43 +00:00
|
|
|
- { python_version: "3.12", pytorch_version: "2.4", cuda_version: "12.1.0" }
|
2022-07-12 10:08:37 +00:00
|
|
|
steps:
|
2023-10-03 19:42:18 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-09-18 13:28:07 +00:00
|
|
|
- uses: docker/setup-buildx-action@v3
|
2023-09-18 11:17:21 +00:00
|
|
|
- uses: docker/login-action@v3
|
2023-09-01 14:16:43 +00:00
|
|
|
if: env.PUSH_NIGHTLY == 'true' && github.repository_owner == 'Lightning-AI'
|
2022-07-12 10:08:37 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
2024-06-24 05:46:29 +00:00
|
|
|
- uses: docker/build-push-action@v6
|
2022-07-12 10:08:37 +00:00
|
|
|
with:
|
|
|
|
build-args: |
|
|
|
|
PYTHON_VERSION=${{ matrix.python_version }}
|
|
|
|
PYTORCH_VERSION=${{ matrix.pytorch_version }}
|
|
|
|
CUDA_VERSION=${{ matrix.cuda_version }}
|
|
|
|
file: dockers/base-cuda/Dockerfile
|
2023-01-04 22:44:23 +00:00
|
|
|
push: ${{ env.PUSH_NIGHTLY }}
|
2023-08-30 17:11:35 +00:00
|
|
|
tags: "pytorchlightning/pytorch_lightning:base-cuda-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }}-cuda${{ matrix.cuda_version }}"
|
2022-07-12 10:08:37 +00:00
|
|
|
timeout-minutes: 95
|
2022-08-26 20:41:36 +00:00
|
|
|
- uses: ravsamhq/notify-slack-action@v2
|
2023-01-04 22:44:23 +00:00
|
|
|
if: failure() && env.PUSH_NIGHTLY == 'true'
|
2022-07-12 10:08:37 +00:00
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
notification_title: ${{ format('CUDA; {0} py{1} for *{2}*', runner.os, matrix.python_version, matrix.pytorch_version) }}
|
2023-09-25 12:34:41 +00:00
|
|
|
message_format: "{emoji} *{workflow}* {status_message}, see <{run_url}|detail>, cc: <@U01A5T7EY9M>" # akihironitta
|
2022-07-12 10:08:37 +00:00
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
|
2022-07-15 21:36:19 +00:00
|
|
|
build-NGC:
|
2022-11-04 16:17:48 +00:00
|
|
|
if: github.event.pull_request.draft == false
|
2023-06-15 12:14:43 +00:00
|
|
|
# fixme: use larger machine or optimize image size
|
|
|
|
# runs-on: ubuntu-latest-4-cores
|
|
|
|
# then drop continue-on-error
|
|
|
|
runs-on: ubuntu-latest
|
2022-07-15 21:36:19 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-10-03 19:42:18 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-07-15 21:36:19 +00:00
|
|
|
- name: Build Conda Docker
|
|
|
|
# publish master/release
|
2023-06-15 12:14:43 +00:00
|
|
|
continue-on-error: true
|
2024-06-24 05:46:29 +00:00
|
|
|
uses: docker/build-push-action@v6
|
2022-07-15 21:36:19 +00:00
|
|
|
with:
|
|
|
|
file: dockers/nvidia/Dockerfile
|
|
|
|
push: false
|
|
|
|
timeout-minutes: 55
|