Skip to content

Commit

Permalink
ci: fix & fuse docker builds (Lightning-AI#18440)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Aug 30, 2023
1 parent 183dba8 commit 3a70714
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 89 deletions.
12 changes: 1 addition & 11 deletions .github/checkgroup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ subprojects:
- id: "pytorch_lightning: Docker"
paths:
- ".actions/*"
- ".github/workflows/ci-dockers.yml"
- ".github/workflows/docker-build.yml"
- "dockers/**"
- "requirements/pytorch/**"
- "requirements/fabric/**"
Expand Down Expand Up @@ -425,13 +425,3 @@ subprojects:
- "install-pkg (windows-2022, lightning, 3.11)"
- "install-pkg (windows-2022, notset, 3.8)"
- "install-pkg (windows-2022, notset, 3.11)"

- id: "release dockers"
paths:
- ".github/workflows/release-docker.yml"
- "dockers/release/*"
checks:
- "publish-docker (3.9, 1.13, 12.0.1)"
- "publish-docker (3.9, 1.13, 12.0.1)"
- "publish-docker (3.10, 2.0, 11.8.0)"
- "publish-docker (3.10, 2.0, 12.0.1)"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker
name: Docker builds

on:
push:
Expand All @@ -8,7 +8,7 @@ on:
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
paths:
- ".actions/*"
- ".github/workflows/ci-dockers.yml"
- ".github/workflows/docker-build.yml"
- "dockers/**"
- "requirements/*.txt"
- "requirements/pytorch/**"
Expand All @@ -28,7 +28,7 @@ concurrency:

env:
PUSH_NIGHTLY: ${{ github.event_name == 'schedule' }}
PUSH_RELEASE: ${{ github.event_name == 'release' }}
PUSH_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'release' }}

jobs:
build-pl:
Expand All @@ -52,15 +52,47 @@ jobs:
with:
submodules: true
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
if: env.PUSH_RELEASE == 'true'
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}"]
if py_ver == '3.10' and pt_ver == '2.0' and cuda_ver == '12.0.1':
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

- uses: docker/build-push-action@v4
with:
build-args: |
PYTHON_VERSION=${{ matrix.python_version }}
PYTORCH_VERSION=${{ matrix.pytorch_version }}
CUDA_VERSION=${{ matrix.cuda_version }}
LIGHTNING_VERSION=${{ env.RELEASE_VERSION }}
file: dockers/release/Dockerfile
push: ${{ env.PUSH_RELEASE }} # pushed in release-docker.yml only when PL is released
timeout-minutes: 50
tags: ${{ env.DOCKER_TAGS }}
timeout-minutes: 35

build-cuda:
if: github.event.pull_request.draft == false
Expand Down Expand Up @@ -92,7 +124,7 @@ jobs:
CUDA_VERSION=${{ matrix.cuda_version }}
file: dockers/base-cuda/Dockerfile
push: ${{ env.PUSH_NIGHTLY }}
tags: pytorchlightning/pytorch_lightning:base-cuda-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }}-cuda${{ matrix.cuda_version }}
tags: "pytorchlightning/pytorch_lightning:base-cuda-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }}-cuda${{ matrix.cuda_version }}"
timeout-minutes: 95
- uses: ravsamhq/notify-slack-action@v2
if: failure() && env.PUSH_NIGHTLY == 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Docs
name: Docs builds
# https://github.com/marketplace/actions/sphinx-build

on:
Expand Down
72 changes: 0 additions & 72 deletions .github/workflows/release-docker.yml

This file was deleted.

0 comments on commit 3a70714

Please sign in to comment.