Skip to content

Commit 26d6f1f

Browse files
committed
also update doc build workflow
1 parent eebef9f commit 26d6f1f

File tree

1 file changed

+60
-2
lines changed

1 file changed

+60
-2
lines changed

.github/workflows/build-docs.yml

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
build_ctk_ver:
77
type: string
88
required: true
9+
use_gh_cache:
10+
type: string
11+
required: true
912

1013
jobs:
1114
build:
@@ -61,28 +64,83 @@ jobs:
6164
REPO_DIR=$(pwd)
6265
6366
# make outputs from the previous job as env vars
64-
echo "CUDA_CORE_ARTIFACT_NAME=cuda-core-python${PYTHON_VERSION_FORMATTED}-linux-64-${{ github.sha }}" >> $GITHUB_ENV
67+
echo "CUDA_CORE_ARTIFACT_BASENAME=cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ matrix.host-platform }}" >> $GITHUB_ENV
68+
echo "CUDA_CORE_ARTIFACT_NAME=${CUDA_CORE_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
6569
echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV
66-
echo "CUDA_BINDINGS_ARTIFACT_NAME=cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ inputs.build_ctk_ver }}-linux-64-${{ github.sha }}" >> $GITHUB_ENV
70+
echo "CUDA_BINDINGS_ARTIFACT_BASENAME=cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ matrix.cuda-version }}-${{ matrix.host-platform }}" >> $GITHUB_ENV
71+
echo "CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${{ github.sha }}" >> $GITHUB_ENV
6772
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV
6873
74+
# When the CI is run due to merging to main, we want it to populate GHA Cache not Artifacts,
75+
# so that CI workflows running on every branch have a fallback to use.
76+
echo "USE_CACHE=${{ inputs.use_gh_cache }}" >> $GITHUB_ENV
77+
78+
# We'll try GHA Artifacts first, and then fall back to GHA Cache
6979
- name: Download cuda.bindings build artifacts
80+
id: cuda-bindings-download
7081
uses: actions/download-artifact@v4
7182
with:
7283
name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
7384
path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}
7485

86+
- name: Restore cuda.bindings cache
87+
if: ${{ failure() && steps.cuda-bindings-download.conclusion == 'failure' }}
88+
id: cuda-bindings-cache
89+
uses: actions/cache/restore@v4
90+
with:
91+
key: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }}
92+
path: ${{ env.CUDA_BINDINGS_ARTIFACTS_BASENAME }}.tar.gz
93+
restore-keys: ${{ env.CUDA_BINDINGS_ARTIFACT_BASENAME }}
94+
fail-on-cache-miss: true
95+
96+
- name: Report cache restore status (hit)
97+
if: ${{ steps.cuda-bindings-cache.conclusion != 'skipped' &&
98+
steps.cuda-bindings-cache.outputs.cache-hit == 'true' }}
99+
run: |
100+
echo "cache is found"
101+
CACHE_DIR="${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }}"
102+
CACHE_ARCHIVE="${{ env.CUDA_BINDINGS_ARTIFACTS_BASENAME }}.tar.gz"
103+
ls -l $CACHE_ARCHIVE
104+
mkdir -p $CACHE_DIR
105+
du -h $CACHE_ARCHIVE &&
106+
tar -x -f $CACHE_ARCHIVE -C $CACHE_DIR &&
107+
rm -f $CACHE_ARCHIVE || echo "WARNING: cache could not be retrieved."
108+
75109
- name: Display structure of downloaded cuda.bindings artifacts
76110
run: |
77111
pwd
78112
ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR
79113
80114
- name: Download cuda.core build artifacts
115+
id: cuda-core-download
81116
uses: actions/download-artifact@v4
82117
with:
83118
name: ${{ env.CUDA_CORE_ARTIFACT_NAME }}
84119
path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }}
85120

121+
- name: Restore cuda.core cache
122+
if: ${{ failure() && steps.cuda-core-download.conclusion == 'failure' }}
123+
id: cuda-core-cache
124+
uses: actions/cache/restore@v4
125+
with:
126+
key: ${{ env.CUDA_CORE_ARTIFACT_NAME }}
127+
path: ${{ env.CUDA_CORE_ARTIFACTS_BASENAME }}.tar.gz
128+
restore-keys: ${{ env.CUDA_CORE_ARTIFACT_BASENAME }}
129+
fail-on-cache-miss: true
130+
131+
- name: Report cache restore status (hit)
132+
if: ${{ steps.cuda-core-cache.conclusion != 'skipped' &&
133+
steps.cuda-core-cache.outputs.cache-hit == 'true' }}
134+
run: |
135+
echo "cache is found"
136+
CACHE_DIR="${{ env.CUDA_CORE_ARTIFACTS_DIR }}"
137+
CACHE_ARCHIVE="${{ env.CUDA_CORE_ARTIFACTS_BASENAME }}.tar.gz"
138+
ls -l $CACHE_ARCHIVE
139+
mkdir -p $CACHE_DIR
140+
du -h $CACHE_ARCHIVE &&
141+
tar -x -f $CACHE_ARCHIVE -C $CACHE_DIR &&
142+
rm -f $CACHE_ARCHIVE || echo "WARNING: cache could not be retrieved."
143+
86144
- name: Display structure of downloaded cuda.core build artifacts
87145
run: |
88146
pwd

0 commit comments

Comments
 (0)