-
Notifications
You must be signed in to change notification settings - Fork 293
60 lines (58 loc) · 2.6 KB
/
build-nightly-docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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"
CONDA_ENV: "torchbench"
DOCKER_IMAGE: "ghcr.io/pytorch/torchbench:latest"
SETUP_SCRIPT: "/workspace/setup_instance.sh"
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
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: |
set -x
export NIGHTLY_DATE="${{ github.event.inputs.nightly_date }}"
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:latest
# Extract pytorch version from the docker
PYTORCH_VERSION=$(docker run -e SETUP_SCRIPT="${SETUP_SCRIPT}" ghcr.io/pytorch/torchbench:latest bash -c '. "${SETUP_SCRIPT}"; python -c "import torch; print(torch.__version__)"')
export DOCKER_TAG=$(awk '{match($0, /dev[0-9]+/, arr); print arr[0]}' <<< "${PYTORCH_VERSION}")
docker tag ghcr.io/pytorch/torchbench:latest ghcr.io/pytorch/torchbench:${DOCKER_TAG}
- name: Push docker to remote
if: ${{ env.WITH_PUSH == 'true' }}
run: |
# Extract pytorch version from the docker
PYTORCH_VERSION=$(docker run -e SETUP_SCRIPT="${SETUP_SCRIPT}" ghcr.io/pytorch/torchbench:latest bash -c '. "${SETUP_SCRIPT}"; python -c "import torch; print(torch.__version__)"')
export DOCKER_TAG=$(awk '{match($0, /dev[0-9]+/, arr); print arr[0]}' <<< "${PYTORCH_VERSION}")
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