forked from NVIDIA/cuda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (179 loc) · 6.85 KB
/
build-docs.yml
File metadata and controls
204 lines (179 loc) · 6.85 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
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: "CI: Build and update docs"
on:
workflow_call:
inputs:
build-ctk-ver:
type: string
required: true
component:
description: "Component(s) to build docs for"
required: false
default: "all"
type: string
# below are the acceptable options:
# - cuda-core
# - cuda-bindings
# - cuda-python
# - all
git-tag:
description: "Target git tag to build docs for"
required: false
default: ""
type: string
is-release:
description: "Are we building release docs?"
required: false
default: false
type: boolean
jobs:
build:
name: Build docs
# The build stage could fail but we want the CI to keep moving.
if: ${{ github.repository_owner == 'nvidia' && !cancelled() }}
# WAR: Building the doc currently requires a GPU (NVIDIA/cuda-python#326,327)
runs-on: linux-amd64-gpu-t4-latest-1-testing
#runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
# WAR: Building the doc currently requires a GPU (NVIDIA/cuda-python#326,327)
- name: Ensure GPU is working
run: nvidia-smi
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.git-tag }}
# TODO: cache conda env to speed up the workflow once conda-incubator/setup-miniconda#267
# is resolved
- name: Set up miniforge
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: cuda-python-docs
environment-file: ./cuda_python/docs/environment-docs.yml
miniforge-version: latest
conda-remove-defaults: "true"
python-version: 3.12
- name: Check conda env
run: |
conda info
conda list
conda config --show-sources
conda config --show
# WAR: Building the doc currently requires CTK installed (NVIDIA/cuda-python#326,327)
- name: Set up mini CTK
uses: ./.github/actions/fetch_ctk
with:
host-platform: linux-64
cuda-version: ${{ inputs.build-ctk-ver }}
- name: Set environment variables
run: |
PYTHON_VERSION_FORMATTED="312" # see above
REPO_DIR=$(pwd)
# make outputs from the previous job as env vars
CUDA_CORE_ARTIFACT_BASENAME="cuda-core-python${PYTHON_VERSION_FORMATTED}-linux-64"
echo "CUDA_CORE_ARTIFACT_BASENAME=${CUDA_CORE_ARTIFACT_BASENAME}" >> $GITHUB_ENV
echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV
CUDA_BINDINGS_ARTIFACT_BASENAME="cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ inputs.build-ctk-ver }}-linux-64"
echo "CUDA_BINDINGS_ARTIFACT_BASENAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}" >> $GITHUB_ENV
echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
- name: Download cuda-python build artifacts
uses: actions/download-artifact@v4
with:
name: cuda-python-wheel
path: .
- name: Display structure of downloaded cuda-python artifacts
run: |
pwd
ls -lahR .
- name: Download cuda.bindings build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
- name: Display structure of downloaded cuda.bindings artifacts
run: |
pwd
ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR
- name: Download cuda.core build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}
path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
- name: Display structure of downloaded cuda.core build artifacts
run: |
pwd
ls -lahR $CUDA_CORE_ARTIFACTS_DIR
- name: Install all packages
run: |
pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}"
pip install *.whl
popd
pushd "${CUDA_CORE_ARTIFACTS_DIR}"
pip install *.whl
popd
pip install cuda_python*.whl
# This step sets the PR_NUMBER/BUILD_LATEST/BUILD_PREVIEW env vars.
- name: Get PR number
if: ${{ !inputs.is-release }}
uses: ./.github/actions/get_pr_number
- name: Set up artifact directories
run: |
mkdir -p artifacts/docs
# create an empty folder for removal use
mkdir -p artifacts/empty_docs
- name: Build all docs
if: ${{ inputs.component == 'all' }}
env:
DOC_ACTION: ${{ (inputs.is-release && '') || 'latest-only' }}
run: |
pushd cuda_python/docs/
./build_all_docs.sh $DOC_ACTION
if [[ -z "$DOC_ACTION" ]]; then
# At release time, we don't want to update the latest docs
rm -rf build/html/latest
fi
ls -l build
popd
mv cuda_python/docs/build/html/* artifacts/docs/
- name: Build component docs
if: ${{ inputs.component != 'all' }}
env:
DOC_ACTION: ${{ (inputs.is-release && '') || 'latest-only' }}
run: |
COMPONENT=$(echo "${{ inputs.component }}" | tr '-' '_')
pushd ${COMPONENT}/docs/
./build_docs.sh $DOC_ACTION
if [[ -z "$DOC_ACTION" ]]; then
# At release time, we don't want to update the latest docs
rm -rf build/html/latest
fi
ls -l build
popd
mv ${COMPONENT}/docs/build/html/* artifacts/docs/
# TODO: Consider removing this step?
- name: Upload doc artifacts
uses: actions/upload-pages-artifact@v3
with:
path: artifacts/
retention-days: 3
- name: Deploy or clean up doc preview
if: ${{ !inputs.is-release }}
uses: ./.github/actions/doc_preview
with:
source-folder: ${{ (github.ref_name != 'main' && 'artifacts/docs') ||
'artifacts/empty_docs' }}
pr-number: ${{ env.PR_NUMBER }}
- name: Deploy doc update
if: ${{ github.ref_name == 'main' || inputs.is-release }}
uses: JamesIves/github-pages-deploy-action@v4
with:
git-config-name: cuda-python-bot
git-config-email: cuda-python-bot@users.noreply.github.com
folder: artifacts/docs/
target-folder: docs/
commit-message: "Deploy ${{ (inputs.is-release && 'release') || 'latest' }} docs: ${{ github.sha }}"
clean: false