-
Notifications
You must be signed in to change notification settings - Fork 4.1k
179 lines (155 loc) · 6.39 KB
/
build-tutorials.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Build tutorials
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
cancel-in-progress: true
jobs:
worker:
name: pytorch_tutorial_build_worker
strategy:
matrix:
include:
- { shard: 1, num_shards: 15, runner: "linux.g5.12xlarge.nvidia.gpu" }
- { shard: 2, num_shards: 15, runner: "linux.g5.4xlarge.nvidia.gpu" }
- { shard: 3, num_shards: 15, runner: "linux.g5.4xlarge.nvidia.gpu" }
- { shard: 4, num_shards: 15, runner: "linux.g5.4xlarge.nvidia.gpu" }
- { shard: 5, num_shards: 15, runner: "linux.g5.4xlarge.nvidia.gpu" }
- { shard: 6, num_shards: 15, runner: "linux.g5.4xlarge.nvidia.gpu" }
- { shard: 7, num_shards: 15, runner: "linux.4xlarge.nvidia.gpu" }
- { shard: 8, num_shards: 15, runner: "linux.4xlarge.nvidia.gpu" }
- { shard: 9, num_shards: 15, runner: "linux.4xlarge.nvidia.gpu" }
- { shard: 10, num_shards: 15, runner: "linux.4xlarge.nvidia.gpu" }
- { shard: 11, num_shards: 15, runner: "linux.4xlarge.nvidia.gpu" }
- { shard: 12, num_shards: 15, runner: "linux.4xlarge.nvidia.gpu" }
- { shard: 13, num_shards: 15, runner: "linux.4xlarge.nvidia.gpu" }
- { shard: 14, num_shards: 15, runner: "linux.4xlarge.nvidia.gpu" }
- { shard: 15, num_shards: 15, runner: "linux.4xlarge.nvidia.gpu" }
fail-fast: false
runs-on: ${{ matrix.runner }}
steps:
- name: Setup SSH (Click me for login details)
uses: pytorch/test-infra/.github/actions/setup-ssh@main
with:
github-secret: ${{ secrets.GITHUB_TOKEN }}
instructions: |
All testing is done inside the container, to start an interactive session run:
docker exec -it $(docker container ps --format '{{.ID}}') bash
- name: Checkout Tutorials
uses: actions/checkout@v3
- name: Setup Linux
uses: pytorch/pytorch/.github/actions/setup-linux@main
- name: Install nvidia driver, nvidia-docker runtime, set GPU_FLAG
uses: pytorch/test-infra/.github/actions/setup-nvidia@main
- name: Calculate/build docker image
id: calculate-docker-image
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
with:
docker-image-name: tutorials
- name: Pull docker image
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
with:
docker-image: ${{ steps.calculate-docker-image.outputs.docker-image }}
- name: Build
shell: bash
env:
DOCKER_IMAGE: ${{ steps.calculate-docker-image.outputs.docker-image }}
NUM_WORKERS: ${{ matrix.num_shards }}
WORKER_ID: ${{ matrix.shard }}
COMMIT_ID: ${{ github.sha }}
JOB_TYPE: worker
COMMIT_SOURCE: ${{ github.ref }}
run: |
set -ex
chmod +x ".jenkins/build.sh"
container_name=$(docker run \
${GPU_FLAG:-} \
-e WORKER_ID \
-e NUM_WORKERS \
-e COMMIT_ID \
-e JOB_TYPE \
-e COMMIT_SOURCE \
--env-file="/tmp/github_env_${GITHUB_RUN_ID}" \
--tty \
--detach \
--shm-size=2gb \
--name="${container_name}" \
-v "${GITHUB_WORKSPACE}:/var/lib/workspace" \
-w /var/lib/workspace \
"${DOCKER_IMAGE}"
)
docker exec -u ci-user -t "${container_name}" sh -c ".jenkins/build.sh"
- name: Teardown Linux
uses: pytorch/test-infra/.github/actions/teardown-linux@main
if: always()
manager:
name: pytorch_tutorial_build_manager
needs: worker
runs-on: [self-hosted, linux.2xlarge]
environment: ${{ github.ref == 'refs/heads/main' && 'pytorchbot-env' || '' }}
steps:
- name: Setup SSH (Click me for login details)
uses: pytorch/test-infra/.github/actions/setup-ssh@main
with:
github-secret: ${{ secrets.GITHUB_TOKEN }}
instructions: |
All testing is done inside the container, to start an interactive session run:
docker exec -it $(docker container ps --format '{{.ID}}') bash
- name: Checkout Tutorials
uses: actions/checkout@v3
- name: Setup Linux
uses: pytorch/pytorch/.github/actions/setup-linux@main
- name: Calculate/build docker image
id: calculate-docker-image
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
with:
docker-image-name: tutorials
- name: Pull docker image
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
with:
docker-image: ${{ steps.calculate-docker-image.outputs.docker-image }}
- name: Build
shell: bash
env:
DOCKER_IMAGE: ${{ steps.calculate-docker-image.outputs.docker-image }}
NUM_WORKERS: 15
WORKER_ID: ${{ matrix.shard }}
COMMIT_ID: ${{ github.sha }}
JOB_TYPE: manager
COMMIT_SOURCE: ${{ github.ref }}
GITHUB_PYTORCHBOT_TOKEN: ${{ secrets.PYTORCHBOT_TOKEN }}
run: |
set -ex
chmod +x ".jenkins/build.sh"
container_name=$(docker run \
${GPU_FLAG:-} \
-e WORKER_ID \
-e NUM_WORKERS \
-e COMMIT_ID \
-e JOB_TYPE \
-e COMMIT_SOURCE \
-e GITHUB_PYTORCHBOT_TOKEN \
--env-file="/tmp/github_env_${GITHUB_RUN_ID}" \
--tty \
--detach \
--name="${container_name}" \
-v "${GITHUB_WORKSPACE}:/var/lib/workspace" \
-w /var/lib/workspace \
"${DOCKER_IMAGE}"
)
docker exec -u ci-user -t "${container_name}" sh -c ".jenkins/build.sh"
- name: Upload docs preview
uses: seemethere/upload-artifact-s3@v5
if: ${{ github.event_name == 'pull_request' }}
with:
retention-days: 14
s3-bucket: doc-previews
if-no-files-found: error
path: docs
s3-prefix: pytorch/tutorials/${{ github.event.pull_request.number }}
- name: Teardown Linux
uses: pytorch/test-infra/.github/actions/teardown-linux@main
if: always()