forked from alibaba/BladeDISC
-
Notifications
You must be signed in to change notification settings - Fork 1
134 lines (127 loc) · 4.35 KB
/
resuable_gpu_build.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: CUDA Reusable workflow
on:
workflow_call:
inputs:
cuda_version:
required: true
type: string
extra_build_args:
required: false
type: string
extra_envs:
required: false
type: string
exec_command:
required: true
type: string
tf_blade_command:
required: false
type: string
deploy_command:
required: false
type: string
remote_runtime_docker:
required: false
type: string
develop_base_image:
required: false
type: string
default: "nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04"
runtime_base_image:
required: false
type: string
runner_tag:
required: false
type: string
default: gpu-a10
secrets:
ALIYUN_DOCKER_USERNAME:
required: false
ALIYUN_DOCKER_PASSWORD:
required: false
DOCKER_USERNAME:
required: false
DOCKER_PASSWORD:
required: false
jobs:
CUDA:
if: github.repository == 'alibaba/BladeDISC'
# The type of runner that the job will run on
runs-on: ${{ inputs.runner_tag }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Checkout
uses: actions/[email protected]
- name: pre-commit
shell: bash
run: |
export PATH=$HOME/.local/bin:$PATH
pre-commit run -a --show-diff-on-failure
- name: Build Dev Docker
run: |
set -e
git submodule sync
git submodule update --depth=1 --init --recursive
docker build -t disc-dev-${{ inputs.cuda_version }} \
--build-arg BASEIMAGE=${{ inputs.develop_base_image }} \
--build-arg DEVICE=${{ inputs.cuda_version }} \
${{ inputs.extra_build_args }} \
-f docker/dev/Dockerfile .
- name: Build And Test
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' }}
run: |
set -e
nvidia-docker run --rm -t --user $(id -u):$(id -g) \
-v $HOME/.cache:$HOME/.cache \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-v $PWD:/disc \
-e GITHUB_WORKFLOW=$GITHUB_WORKFLOW \
${{ inputs.extra_envs }} \
-w /disc \
disc-dev-${{ inputs.cuda_version }} ${{ inputs.exec_command }}
- name: Build, Test And Examples
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
set -e
nvidia-docker run --rm -t --user $(id -u):$(id -g) \
-v $HOME/.cache:$HOME/.cache \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-v $PWD:/disc \
-e GITHUB_WORKFLOW=$GITHUB_WORKFLOW \
-e TORCH_BLADE_RUN_EXAMPLES=ON \
${{ inputs.extra_envs }} \
-w /disc \
disc-dev-${{ inputs.cuda_version }} ${{ inputs.exec_command }}
- name: Build And Test TF Blade
if: ${{ inputs.tf_blade_command }}
run: |
set -e
nvidia-docker run --rm -t --user $(id -u):$(id -g) \
-v $HOME/.cache:$HOME/.cache \
-v /etc/passwd:/etc/passwd:ro \
-v /etc/group:/etc/group:ro \
-v $PWD:/disc \
-e GITHUB_WORKFLOW=$GITHUB_WORKFLOW \
-w /disc \
disc-dev-${{ inputs.cuda_version }} ${{ inputs.tf_blade_command }}
- name: Deploy Docker Image
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
env:
ALIYUN_DOCKER_USERNAME: ${{ secrets.ALIYUN_DOCKER_USERNAME }}
ALIYUN_DOCKER_PASSWORD: ${{ secrets.ALIYUN_DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
GITHUB_PULL_REQUEST: ${{ github.event.number }}
LOCAL_DEV_DOCKER: disc-dev-${{ inputs.cuda_version }}
REMOTE_DEV_DOCKER: bladedisc:latest-devel-${{ inputs.cuda_version }}
REMOTE_RUNTIME_DOCKER: ${{ inputs.remote_runtime_docker }}
RUNTIME_BASEIMAGE: ${{ inputs.runtime_base_image }}
run: |
set -e
if [[ ! -z "${{ inputs.deploy_command }}" ]]; then
echo "executing runtime Docker deployment"
${{ inputs.deploy_command }}
fi