-
Notifications
You must be signed in to change notification settings - Fork 88
134 lines (115 loc) · 4.65 KB
/
build-docs.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: "CI: Build and update docs"
on:
workflow_call:
inputs:
build-ctk-ver:
type: string
required: true
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
# 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
continue-on-error: false
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.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
- name: Build all (latest) docs
id: build
run: |
pushd cuda_python/docs/
./build_all_docs.sh latest-only
ls -l build
popd
mkdir -p artifacts/docs
mv cuda_python/docs/build/html/* artifacts/docs/
# Note: currently this is only for manual inspection. This step will become
# required once we switch to use GHA for doc deployment (see the bottom).
- name: Upload doc artifacts
uses: actions/upload-pages-artifact@v3
with:
path: artifacts/
retention-days: 3
# The step below is not executed unless when building on main.
- name: Deploy doc update
if: ${{ github.ref_name == 'main' && success() }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: artifacts/docs/
git-config-name: cuda-python-bot
git-config-email: [email protected]
target-folder: docs/
commit-message: "Deploy latest docs: ${{ github.sha }}"
clean: false