Unverified Commit 7656f329 authored by Yifan Xiong's avatar Yifan Xiong Committed by GitHub
Browse files

CI/CD - Add ROCm image build in GitHub Actions (#194)

Add ROCm image build in GitHub Actions.
parent 7e48ad34
......@@ -8,11 +8,21 @@ on:
branches:
- main
- release/*
workflow_dispatch:
jobs:
docker:
name: Docker build
name: Docker build ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: cuda11.1.1
tags: superbench/main:cuda11.1.1,superbench/superbench:latest
- name: rocm4.2-pytorch1.7.0
tags: superbench/main:rocm4.2-pytorch1.7.0
# - name: rocm4.0-pytorch1.7.0
# tags: superbench/main:rocm4.0-pytorch1.7.0
steps:
- name: Checkout
uses: actions/checkout@v2
......@@ -30,14 +40,12 @@ jobs:
- name: Prepare metadata
id: metadata
run: |
DOCKER_IMAGE=superbench/superbench
IMAGE_TAG=latest
TAGS=${{ matrix.tags }}
DOCKERFILE=dockerfile/${{ matrix.name }}.dockerfile
DOCKERFILE=dockerfile/cuda11.1.1.dockerfile
TAGS="${DOCKER_IMAGE}:${IMAGE_TAG}"
CACHE_FROM="type=registry,ref=${DOCKER_IMAGE}:${IMAGE_TAG}"
CACHE_FROM="type=registry,ref=$(cut -d, -f1 <<< ${TAGS})"
CACHE_TO=""
if [ "${{ github.event_name }}" = "push" ]; then
if [ "${{ github.event_name }}" != "pull_request" ]; then
CACHE_TO="type=inline,mode=max"
fi
......@@ -51,7 +59,7 @@ jobs:
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name != 'pull_request' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
......@@ -62,7 +70,7 @@ jobs:
platforms: linux/amd64
context: .
file: ${{ steps.metadata.outputs.dockerfile }}
push: ${{ github.event_name == 'push' }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.metadata.outputs.tags }}
cache-from: ${{ steps.metadata.outputs.cache_from }}
cache-to: ${{ steps.metadata.outputs.cache_to }}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment