|
| 1 | +name: Release artifacts on Linux |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + job-name: |
| 7 | + description: "Name of task" |
| 8 | + default: "" |
| 9 | + type: string |
| 10 | + repository: |
| 11 | + description: 'Repository to checkout, defaults to ""' |
| 12 | + default: "" |
| 13 | + type: string |
| 14 | + ref: |
| 15 | + description: 'Reference to checkout, defaults to "nightly"' |
| 16 | + default: "nightly" |
| 17 | + type: string |
| 18 | + pre-script: |
| 19 | + description: "Pre script to run prior to build" |
| 20 | + default: "" |
| 21 | + type: string |
| 22 | + test-infra-repository: |
| 23 | + description: "Test infra repository to use" |
| 24 | + default: "pytorch/test-infra" |
| 25 | + type: string |
| 26 | + test-infra-ref: |
| 27 | + description: "Test infra reference to use" |
| 28 | + default: "release/2.3" |
| 29 | + type: string |
| 30 | + build-matrix: |
| 31 | + description: "Build matrix to utilize" |
| 32 | + default: "" |
| 33 | + type: string |
| 34 | + architecture: |
| 35 | + description: Architecture to build for x86_64 for default Linux, or aarch64 for Linux aarch64 builds |
| 36 | + required: false |
| 37 | + type: string |
| 38 | + default: x86_64 |
| 39 | + setup-miniconda: |
| 40 | + description: Works as stated in actions/checkout, but the default value is recursive |
| 41 | + required: false |
| 42 | + type: boolean |
| 43 | + default: true |
| 44 | + # script: |
| 45 | + # description: 'Script to utilize' |
| 46 | + # default: "python setup.py bdist_wheel" |
| 47 | + # type: string |
| 48 | + continue-on-error: |
| 49 | + description: "Prevents a job from failing when a step fails. Set to true to allow a job to pass when exec script step fails." |
| 50 | + default: false |
| 51 | + type: boolean |
| 52 | + upload-artifact: |
| 53 | + description: 'Name to give artifacts uploaded from ${RUNNER_ARTIFACT_DIR}' |
| 54 | + default: '' |
| 55 | + type: string |
| 56 | + |
| 57 | +jobs: |
| 58 | + build: |
| 59 | + strategy: |
| 60 | + fail-fast: false |
| 61 | + matrix: ${{ fromJSON(inputs.build-matrix) }} |
| 62 | + env: |
| 63 | + PYTHON_VERSION: ${{ matrix.python_version }} |
| 64 | + PACKAGE_TYPE: wheel |
| 65 | + REPOSITORY: ${{ inputs.repository }} |
| 66 | + REF: ${{ inputs.ref }} |
| 67 | + CU_VERSION: ${{ matrix.desired_cuda }} |
| 68 | + # SCRIPT: ${{ inputs.script }} |
| 69 | + # RUNNER_TEST_RESULTS_DIR: /tmp/test_results |
| 70 | + ARCH: ${{ inputs.architecture }} |
| 71 | + name: ${{ inputs.job-name }}-${{ matrix.desired_cuda }} |
| 72 | + runs-on: ${{ matrix.validation_runner }} |
| 73 | + container: |
| 74 | + image: ${{ matrix.container_image }} |
| 75 | + options: ${{ matrix.gpu_arch_type == 'cuda' && '--gpus all' || ' ' }} |
| 76 | + if: ${{ env.CU_VERSION == '12.1' }} |
| 77 | + # If a build is taking longer than 60 minutes on these runners we need |
| 78 | + # to have a conversation |
| 79 | + timeout-minutes: 60 |
| 80 | + steps: |
| 81 | + - name: Clean workspace |
| 82 | + run: | |
| 83 | + set -euxo pipefail |
| 84 | + echo "::group::Cleanup debug output" |
| 85 | + rm -rfv "${GITHUB_WORKSPACE}" |
| 86 | + mkdir -p "${GITHUB_WORKSPACE}" |
| 87 | + echo "::endgroup::" |
| 88 | + - uses: actions/checkout@v3 |
| 89 | + with: |
| 90 | + # Support the use case where we need to checkout someone's fork |
| 91 | + repository: ${{ inputs.test-infra-repository }} |
| 92 | + ref: ${{ inputs.test-infra-ref }} |
| 93 | + path: test-infra |
| 94 | + - name: Setup SSH |
| 95 | + uses: ./test-infra/.github/actions/setup-ssh |
| 96 | + with: |
| 97 | + github-secret: ${{ github.token }} |
| 98 | + - uses: ./test-infra/.github/actions/set-channel |
| 99 | + - uses: ./test-infra/.github/actions/setup-binary-builds |
| 100 | + with: |
| 101 | + repository: ${{ inputs.repository }} |
| 102 | + ref: ${{ inputs.ref }} |
| 103 | + setup-miniconda: ${{ inputs.setup-miniconda }} |
| 104 | + python-version: ${{ env.PYTHON_VERSION }} |
| 105 | + cuda-version: ${{ env.CU_VERSION }} |
| 106 | + arch: ${{ env.ARCH }} |
| 107 | + - name: Run Pre-Script with Caching |
| 108 | + if: ${{ inputs.pre-script != '' }} |
| 109 | + uses: ./test-infra/.github/actions/run-script-with-cache |
| 110 | + with: |
| 111 | + cache-path: ${{ inputs.cache-path }} |
| 112 | + cache-key: ${{ inputs.cache-key }} |
| 113 | + repository: ${{ inputs.repository }} |
| 114 | + script: ${{ inputs.pre-script }} |
| 115 | + - name: Download artifacts |
| 116 | + uses: actions/download-artifact@v3 |
| 117 | + with: |
| 118 | + name: ${{ env.ARTIFACT_NAME }} |
| 119 | + path: /opt/torch-tensorrt-builds/ |
| 120 | + # - name: Install torch and torch-tensorrt |
| 121 | + # if: ${{ inputs.pre-script != '' }} |
| 122 | + # uses: ./test-infra/.github/actions/run-script-with-cache |
| 123 | + # with: |
| 124 | + # repository: ${{ inputs.repository }} |
| 125 | + # script: .github/scripts/install-torch-tensorrt.sh |
| 126 | + - name: Pack script |
| 127 | + continue-on-error: ${{ inputs.continue-on-error }} |
| 128 | + working-directory: ${{ inputs.repository }} |
| 129 | + env: |
| 130 | + ALL_SECRETS: ${{ toJSON(secrets) }} |
| 131 | + run: | |
| 132 | + set -euxo pipefail |
| 133 | + source "${BUILD_ENV_FILE}" |
| 134 | + { |
| 135 | + echo "${SCRIPT}"; |
| 136 | + } > "user_script" |
| 137 | + cat .github/scripts/build-linux-release-artifacts.sh user_script > exec_script |
| 138 | + - name: Run Script |
| 139 | + uses: ./test-infra/.github/actions/run-script-with-cache |
| 140 | + with: |
| 141 | + repository: ${{ inputs.repository }} |
| 142 | + script: exec_script |
| 143 | + # - name: Surface failing tests |
| 144 | + # if: always() |
| 145 | + |
| 146 | + # with: |
| 147 | + # path: ${{ env.RUNNER_TEST_RESULTS_DIR }} |
| 148 | + # fail-on-empty: false |
| 149 | + |
| 150 | + # - name: Prepare artifacts for upload |
| 151 | + # working-directory: ${{ inputs.repository }} |
| 152 | + # id: check-artifacts |
| 153 | + # env: |
| 154 | + # UPLOAD_ARTIFACT_NAME: ${{ inputs.upload-artifact }} |
| 155 | + # run: | |
| 156 | + # if [ -d "dist" ] && [ -n "$(ls -A dist)" ]; then |
| 157 | + # mv -v dist/* "${RUNNER_ARTIFACT_DIR}/" |
| 158 | + # fi |
| 159 | + |
| 160 | + # # if [[ -n "${UPLOAD_ARTIFACT_NAME}" ]]; then |
| 161 | + # # # If the default execution path is followed then we should get a wheel in the dist/ folder |
| 162 | + # # # attempt to just grab whatever is in there and scoop it all up |
| 163 | + # # if find "dist/" -name "*.whl" >/dev/null 2>/dev/null; then |
| 164 | + # # mv -v dist/*.whl "${RUNNER_ARTIFACT_DIR}/" |
| 165 | + # # fi |
| 166 | + # # # Set to fail upload step if there are no files for upload and expected files for upload |
| 167 | + # # echo 'if-no-files-found=error' >> "${GITHUB_OUTPUT}" |
| 168 | + # # fi |
| 169 | + |
| 170 | + # # upload_docs=0 |
| 171 | + # # # Check if there are things in the documentation folder to uplaod |
| 172 | + # # if find "${RUNNER_DOCS_DIR}" -mindepth 1 -maxdepth 1 | read -r; then |
| 173 | + # # # TODO: Add a check here to test if on ec2 because if we're not on ec2 then this |
| 174 | + # # # upload will probably not work correctly |
| 175 | + # # upload_docs=1 |
| 176 | + # # fi |
| 177 | + # # echo "upload-docs=${upload_docs}" >> "${GITHUB_OUTPUT}" |
| 178 | + |
| 179 | + # - name: Upload artifacts to GitHub (if any) |
| 180 | + # uses: actions/upload-artifact@v3 |
| 181 | + # if: ${{ inputs.upload-artifact != '' }} |
| 182 | + # with: |
| 183 | + # name: ${{ inputs.upload-artifact }} |
| 184 | + # path: ${{ runner.temp }}/artifacts/ |
| 185 | + # if-no-files-found: ${{ steps.check-artifacts.outputs.if-no-files-found }} |
| 186 | + |
| 187 | + # - name: Upload documentation to S3 (if any) |
| 188 | + # uses: seemethere/upload-artifact-s3@v5 |
| 189 | + # if: ${{ steps.check-artifacts.outputs.upload-docs == 1 && github.event.pull_request.number != '' }} |
| 190 | + # with: |
| 191 | + # retention-days: 14 |
| 192 | + # s3-bucket: doc-previews |
| 193 | + # if-no-files-found: error |
| 194 | + # path: ${{ env.RUNNER_DOCS_DIR }} |
| 195 | + # # ${{ env.repository }} is $OWNER/$REPO |
| 196 | + # s3-prefix: ${{ env.REPOSITORY }}/${{ github.event.pull_request.number }} |
| 197 | + |
| 198 | +concurrency: |
| 199 | + group: ${{ github.workflow }}-${{ github.ref_name }} |
| 200 | + cancel-in-progress: true |
0 commit comments