lightning/.github/workflows/ci_dockers.yml

146 lines
5.1 KiB
YAML
Raw Normal View History

name: CI build Docker
# https://www.docker.com/blog/first-docker-github-action-is-here
# https://github.com/docker/build-push-action
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the master branch
push:
branches: [master, "release/*"] # include release branches like release/1.0.x
pull_request:
branches: [master, "release/*"]
jobs:
build-PL:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python_version: [3.6]
pytorch_version: [1.3, 1.7]
steps:
- name: Checkout
uses: actions/checkout@v2
# https://github.com/docker/setup-buildx-action
# Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
- uses: docker/setup-buildx-action@v1
- name: Build PL Docker
# publish master/release
uses: docker/build-push-action@v2
with:
build-args: |
PYTHON_VERSION=${{ matrix.python_version }}
PYTORCH_VERSION=${{ matrix.pytorch_version }}
file: dockers/release/Dockerfile
push: false
timeout-minutes: 50
build-XLA:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python_version: [3.7]
xla_version: [1.6, "nightly"]
steps:
- name: Checkout
uses: actions/checkout@v2
# https://github.com/docker/setup-buildx-action
# Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
- uses: docker/setup-buildx-action@v1
- name: Build XLA Docker
# publish master/release
uses: docker/build-push-action@v2
with:
build-args: |
PYTHON_VERSION=${{ matrix.python_version }}
XLA_VERSION=${{ matrix.xla_version }}
cache-from: pytorchlightning/pytorch_lightning:base-xla-py${{ matrix.python_version }}-torch${{ matrix.xla_version }}
file: dockers/base-xla/Dockerfile
push: false
timeout-minutes: 50
build-cuda:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
# todo: see notes in Dockerfile
#- python_version: 3.7
# pytorch_version: 1.8
- python_version: 3.8
pytorch_version: 1.7
- python_version: 3.7
pytorch_version: 1.6
- python_version: 3.6
pytorch_version: 1.3
steps:
- name: Checkout
uses: actions/checkout@v2
# for PT 1.3 and 1.4 we need to use CUDA 10.1
- run: |
cuda=$(python -c "print(10.2 if float(${{matrix.pytorch_version}}) > 1.4 else 10.1)" 2>&1)
echo "::set-output name=CUDA::$cuda"
id: extend
# https://github.com/docker/setup-buildx-action
# Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
- uses: docker/setup-buildx-action@v1
- name: Build CUDA Docker
# publish master/release
uses: docker/build-push-action@v2
with:
build-args: |
PYTHON_VERSION=${{ matrix.python_version }}
PYTORCH_VERSION=${{ matrix.pytorch_version }}
CUDA_VERSION=${{ steps.extend.outputs.CUDA }}
cache-from: pytorchlightning/pytorch_lightning:base-cuda-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }}
file: dockers/base-cuda/Dockerfile
push: false
timeout-minutes: 50
build-conda:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- python_version: 3.8
pytorch_version: 1.6
- python_version: 3.6
pytorch_version: 1.4
- python_version: 3.7
pytorch_version: 1.7
- python_version: 3.7
pytorch_version: 1.8
steps:
- name: Checkout
uses: actions/checkout@v2
# for PT 1.3 and 1.4 we need to use CUDA 10.1
- run: |
cuda=$(python -c "print(10.2 if float(${{matrix.pytorch_version}}) > 1.4 else 10.1)" 2>&1)
echo "::set-output name=CUDA::$cuda"
channel=$(python -c "print('pytorch-nightly' if float(${{matrix.pytorch_version}}) > 1.7 else 'pytorch')" 2>&1)
echo "::set-output name=CHANNEL::$channel"
id: extend
# https://github.com/docker/setup-buildx-action
# Set up Docker Buildx - to use cache-from and cache-to argument of buildx command
- uses: docker/setup-buildx-action@v1
- name: Build CUDA Docker
# publish master/release
uses: docker/build-push-action@v2
with:
build-args: |
PYTHON_VERSION=${{ matrix.python_version }}
PYTORCH_VERSION=${{ matrix.pytorch_version }}
PYTORCH_CHANNEL=${{ steps.extend.outputs.CHANNEL }}
CUDA_VERSION=${{ steps.extend.outputs.CUDA }}
cache-from: pytorchlightning/pytorch_lightning:base-conda-py${{ matrix.python_version }}-torch${{ matrix.pytorch_version }}
file: dockers/base-conda/Dockerfile
push: false
timeout-minutes: 50