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: ...@@ -8,11 +8,21 @@ on:
branches: branches:
- main - main
- release/* - release/*
workflow_dispatch:
jobs: jobs:
docker: docker:
name: Docker build name: Docker build ${{ matrix.name }}
runs-on: ubuntu-latest 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: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
...@@ -30,14 +40,12 @@ jobs: ...@@ -30,14 +40,12 @@ jobs:
- name: Prepare metadata - name: Prepare metadata
id: metadata id: metadata
run: | run: |
DOCKER_IMAGE=superbench/superbench TAGS=${{ matrix.tags }}
IMAGE_TAG=latest DOCKERFILE=dockerfile/${{ matrix.name }}.dockerfile
DOCKERFILE=dockerfile/cuda11.1.1.dockerfile CACHE_FROM="type=registry,ref=$(cut -d, -f1 <<< ${TAGS})"
TAGS="${DOCKER_IMAGE}:${IMAGE_TAG}"
CACHE_FROM="type=registry,ref=${DOCKER_IMAGE}:${IMAGE_TAG}"
CACHE_TO="" CACHE_TO=""
if [ "${{ github.event_name }}" = "push" ]; then if [ "${{ github.event_name }}" != "pull_request" ]; then
CACHE_TO="type=inline,mode=max" CACHE_TO="type=inline,mode=max"
fi fi
...@@ -51,7 +59,7 @@ jobs: ...@@ -51,7 +59,7 @@ jobs:
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v1 uses: docker/login-action@v1
if: ${{ github.event_name == 'push' }} if: ${{ github.event_name != 'pull_request' }}
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
...@@ -62,7 +70,7 @@ jobs: ...@@ -62,7 +70,7 @@ jobs:
platforms: linux/amd64 platforms: linux/amd64
context: . context: .
file: ${{ steps.metadata.outputs.dockerfile }} file: ${{ steps.metadata.outputs.dockerfile }}
push: ${{ github.event_name == 'push' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.metadata.outputs.tags }} tags: ${{ steps.metadata.outputs.tags }}
cache-from: ${{ steps.metadata.outputs.cache_from }} cache-from: ${{ steps.metadata.outputs.cache_from }}
cache-to: ${{ steps.metadata.outputs.cache_to }} 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