7979 inputs.gpu-arch-version)
8080 || inputs.docker-image }}
8181 REPOSITORY : ${{ inputs.repository || github.repository }}
82+ # Will be blank outside of this
83+ PR_NUMBER : ${{ github.event.pull_request.number }}
8284 SCRIPT : ${{ inputs.script }}
8385 runs-on : ${{ inputs.runner }}
8486 # TODO: Eventually this should run in a container, we need to make a container that matches up
@@ -155,6 +157,7 @@ jobs:
155157 # shellcheck disable=SC2086,SC2090
156158 container_name=$(docker run \
157159 -e RUNNER_ARTIFACT_DIR=/artifacts \
160+ -e RUNNER_DOCS_DIR=/docs \
158161 -e RUNNER_TEST_RESULTS_DIR=/test-results \
159162 --env-file="${RUNNER_TEMP}/github_env_${GITHUB_RUN_ID}" \
160163 `# It is unknown why the container sees a different value for this.` \
@@ -170,6 +173,7 @@ jobs:
170173 -v "${GITHUB_WORKSPACE}/${REPOSITORY}:/work" \
171174 -v "${GITHUB_WORKSPACE}/test-infra:/test-infra" \
172175 -v "${RUNNER_ARTIFACT_DIR}:/artifacts" \
176+ -v "${RUNNER_DOCS_DIR}:/docs" \
173177 -v "${RUNNER_TEST_RESULTS_DIR}:/test-results" \
174178 -v "${RUNNER_TEMP}/exec_script:/exec" \
175179 -v "${GITHUB_STEP_SUMMARY}":"${GITHUB_STEP_SUMMARY}" \
@@ -191,26 +195,37 @@ jobs:
191195 with :
192196 directory : ${{ github.workspace }}/${{ env.repository }}
193197
194- - name : Chown artifacts
198+ - name : Chown runner temp
195199 if : ${{ always() }}
196200 uses : ./test-infra/.github/actions/chown-directory
197201 with :
198- directory : ${{ env.RUNNER_ARTIFACT_DIR }}
202+ directory : ${{ env.RUNNER_TEMP }}
199203
200- - name : Check if there are potential artifacts and move them to the correct artifact location
204+ - name : Prepare artifacts for upload
201205 working-directory : ${{ inputs.repository }}
202206 id : check-artifacts
203- if : ${{ inputs.upload-artifact != '' }}
204207 env :
205208 UPLOAD_ARTIFACT_NAME : ${{ inputs.upload-artifact }}
206209 run : |
207- # If the default execution path is followed then we should get a wheel in the dist/ folder
208- # attempt to just grab whatever is in there and scoop it all up
209- if find "dist/" -name "*.whl" >/dev/null 2>/dev/null; then
210- mv -v dist/*.whl "${RUNNER_ARTIFACT_DIR}/"
210+ # Only do these steps if we actually want to upload an artifact
211+ if [[ -n "${UPLOAD_ARTIFACT_NAME}" ]]; then
212+ # If the default execution path is followed then we should get a wheel in the dist/ folder
213+ # attempt to just grab whatever is in there and scoop it all up
214+ if find "dist/" -name "*.whl" >/dev/null 2>/dev/null; then
215+ mv -v dist/*.whl "${RUNNER_ARTIFACT_DIR}/"
216+ fi
217+ # Set to fail upload step if there are no files for upload and expected files for upload
218+ echo 'if-no-files-found=error' >> "${GITHUB_OUTPUT}"
219+ fi
220+
221+ upload_docs=0
222+ # Check if there are things in the documentation folder to uplaod
223+ if find "${RUNNER_DOCS_DIR}" -mindepth 1 -maxdepth 1 | read; then
224+ # TODO: Add a check here to test if on ec2 because if we're not on ec2 then this
225+ # upload will probably not work correctly
226+ upload_docs=1
211227 fi
212- # Set to fail upload step if there are no files for upload and expected files for upload
213- echo 'if-no-files-found=error' >> "${GITHUB_OUTPUT}"
228+ echo "upload-docs=${upload_docs}" >> "${GITHUB_OUTPUT}"
214229
215230 - name : Upload artifacts to GitHub (if any)
216231 uses : actions/upload-artifact@v3
@@ -220,6 +235,27 @@ jobs:
220235 path : ${{ runner.temp }}/artifacts/
221236 if-no-files-found : ${{ steps.check-artifacts.outputs.if-no-files-found }}
222237
238+ # TODO: Remove once we converge on documentation paths
239+ - name : (legacy) Upload documentation to S3 (if any)
240+ uses : seemethere/upload-artifact-s3@v5
241+ if : ${{ steps.check-artifacts.outputs.upload-docs == 1 && github.event.pull_request.number != '' }}
242+ with :
243+ retention-days : 14
244+ s3-bucket : doc-previews
245+ if-no-files-found : error
246+ path : ${{ env.RUNNER_DOCS_DIR }}
247+ s3-prefix : pytorch/${{ env.REPOSITORY }}/${{ github.event.pull_request.number }}
248+
249+ - name : Upload documentation to S3 (if any)
250+ uses : seemethere/upload-artifact-s3@v5
251+ if : ${{ steps.check-artifacts.outputs.upload-docs == 1 && github.event.pull_request.number != '' }}
252+ with :
253+ retention-days : 14
254+ s3-bucket : doc-previews
255+ if-no-files-found : error
256+ path : ${{ env.RUNNER_DOCS_DIR }}
257+ s3-prefix : ${{ env.REPOSITORY }}/${{ github.event.pull_request.number }}
258+
223259 - name : Teardown Linux
224260 if : ${{ always() }}
225261 uses : ./test-infra/.github/actions/teardown-linux
0 commit comments