forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (141 loc) · 5.9 KB
/
Copy path_binary-upload.yml
File metadata and controls
149 lines (141 loc) · 5.9 KB
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
name: upload
on:
workflow_call:
inputs:
build_name:
required: true
type: string
description: The build's name
use_s3:
type: boolean
default: true
description: If true, will download artifacts from s3. Otherwise will use the default GitHub artifact download action
PYTORCH_ROOT:
required: false
type: string
description: Root directory for the pytorch/pytorch repository. Not actually needed, but currently passing it in since we pass in the same inputs to the reusable workflows of all binary builds
PACKAGE_TYPE:
required: true
type: string
description: Package type
DESIRED_CUDA:
required: true
type: string
description: Desired CUDA version
GPU_ARCH_VERSION:
required: false
type: string
description: GPU Arch version
GPU_ARCH_TYPE:
required: true
type: string
description: GPU Arch type
DOCKER_IMAGE:
required: false
type: string
description: Docker image to use
DOCKER_IMAGE_TAG_PREFIX:
required: false
type: string
description: Docker image tag to use
LIBTORCH_CONFIG:
required: false
type: string
description: Desired libtorch config (for libtorch builds only)
LIBTORCH_VARIANT:
required: false
type: string
description: Desired libtorch variant (for libtorch builds only)
DESIRED_PYTHON:
required: false
type: string
description: Desired python version
secrets:
github-token:
required: true
description: Github Token
R2_ACCOUNT_ID:
required: false
description: Cloudflare R2 account ID for nightly uploads
R2_ACCESS_KEY_ID:
required: false
description: Cloudflare R2 access key ID for nightly uploads
R2_SECRET_ACCESS_KEY:
required: false
description: Cloudflare R2 secret access key for nightly uploads
jobs:
upload:
runs-on: ubuntu-22.04
environment: ${{ (github.event_name == 'push' && github.event.ref == 'refs/heads/nightly') && 'nightly-wheel-upload' || '' }}
container:
image: continuumio/miniconda3:4.12.0
env:
PYTORCH_ROOT: /pytorch
PACKAGE_TYPE: ${{ inputs.PACKAGE_TYPE }}
# TODO: This is a legacy variable that we eventually want to get rid of in
# favor of GPU_ARCH_VERSION
DESIRED_CUDA: ${{ inputs.DESIRED_CUDA }}
GPU_ARCH_VERSION: ${{ inputs.GPU_ARCH_VERSION }}
GPU_ARCH_TYPE: ${{ inputs.GPU_ARCH_TYPE }}
DOCKER_IMAGE: ${{ inputs.DOCKER_IMAGE }}
SKIP_ALL_TESTS: 1
LIBTORCH_CONFIG: ${{ inputs.LIBTORCH_CONFIG }}
LIBTORCH_VARIANT: ${{ inputs.LIBTORCH_VARIANT }}
DESIRED_PYTHON: ${{ inputs.DESIRED_PYTHON }}
BINARY_ENV_FILE: /tmp/env
GITHUB_TOKEN: ${{ secrets.github-token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PYTORCH_FINAL_PACKAGE_DIR: /artifacts
SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
- name: Checkout PyTorch
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
with:
no-sudo: true
- name: Configure AWS credentials(PyTorch account) for nightly
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/nightly' }}
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
with:
role-to-assume: arn:aws:iam::749337293305:role/gha_workflow_nightly_build_wheels
aws-region: us-east-1
- name: Configure AWS credentials(PyTorch account) for RC builds
if: ${{ github.event_name == 'push' && (startsWith(github.event.ref, 'refs/tags/') && !startsWith(github.event.ref, 'refs/tags/ciflow/')) }}
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
with:
role-to-assume: arn:aws:iam::749337293305:role/gha_workflow_test_build_wheels
aws-region: us-east-1
- name: Download Build Artifacts
id: download-artifacts
# NB: When the previous build job is skipped, there won't be any artifacts and
# this step will fail. Binary build jobs can only be skipped on CI, not nightly
continue-on-error: true
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: ${{ inputs.build_name }}
path: "${{ runner.temp }}/artifacts/"
- name: Set DRY_RUN (only for tagged pushes)
if: ${{ github.event_name == 'push' && (github.event.ref == 'refs/heads/nightly' || (startsWith(github.event.ref, 'refs/tags/') && !startsWith(github.event.ref, 'refs/tags/ciflow/'))) }}
run: |
echo "DRY_RUN=disabled" >> "$GITHUB_ENV"
- name: Set UPLOAD_CHANNEL (only for tagged pushes)
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') && !startsWith(github.event.ref, 'refs/tags/ciflow/') }}
shell: bash -e -l {0}
run: |
# reference ends with an RC suffix
if [[ "${GITHUB_REF_NAME}" = *-rc[0-9]* ]]; then
echo "UPLOAD_CHANNEL=test" >> "$GITHUB_ENV"
fi
- name: Upload binaries
if: steps.download-artifacts.outcome && steps.download-artifacts.outcome == 'success'
shell: bash
env:
PKG_DIR: "${{ runner.temp }}/artifacts"
UPLOAD_SUBFOLDER: "${{ env.DESIRED_CUDA }}"
BUILD_NAME: ${{ inputs.build_name }}
R2_UPLOAD: ${{ (github.event_name == 'push' && github.event.ref == 'refs/heads/nightly') && 'true' || '' }}
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
run: |
set -ex
bash .ci/pytorch/binary_upload.sh