TorchBench nightly docker build #310
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TorchBench nightly docker build | |
on: | |
schedule: | |
# Push the nightly docker daily at 3 PM UTC | |
- cron: '0 15 * * *' | |
workflow_dispatch: | |
inputs: | |
nightly_date: | |
description: "PyTorch nightly version" | |
required: false | |
env: | |
WITH_PUSH: "true" | |
jobs: | |
build-push-docker: | |
if: ${{ github.repository_owner == 'pytorch' }} | |
runs-on: [self-hosted, linux.4xlarge] | |
environment: docker-s3-upload | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
path: benchmark | |
- name: Login to GitHub Container Registry | |
if: ${{ env.WITH_PUSH == 'true' }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: pytorch | |
password: ${{ secrets.TORCHBENCH_ACCESS_TOKEN }} | |
- name: Build TorchBench nightly docker | |
run: | | |
export NIGHTLY_DATE="${{ github.event.inputs.nightly_date }}" | |
if [ -z "${NIGHTLY_DATE}" ]; then | |
export TODAY=$(date +'%Y%m%d') | |
export DOCKER_TAG=dev${TODAY} | |
else | |
export DOCKER_TAG=dev${NIGHTLY_DATE} | |
fi | |
cd benchmark/docker | |
full_ref="${{ github.ref }}" | |
prefix="refs/heads/" | |
branch_name=${full_ref#$prefix} | |
docker build . --build-arg TORCHBENCH_BRANCH="${branch_name}" --build-arg FORCE_DATE="${NIGHTLY_DATE}" \ | |
-f torchbench-nightly.dockerfile -t ghcr.io/pytorch/torchbench:${DOCKER_TAG} | |
docker tag ghcr.io/pytorch/torchbench:${DOCKER_TAG} ghcr.io/pytorch/torchbench:latest | |
- name: Push docker to remote | |
if: ${{ env.WITH_PUSH == 'true' }} | |
run: | | |
export TODAY=$(date +'%Y%m%d') | |
export DOCKER_TAG=dev${TODAY} | |
docker push ghcr.io/pytorch/torchbench:${DOCKER_TAG} | |
docker push ghcr.io/pytorch/torchbench:latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} | |
cancel-in-progress: true |