Skip to content

Commit

Permalink
Linux Wheel builds for Manylinux1. Use alternative to actions, checko…
Browse files Browse the repository at this point in the history
…ut, upload (#5941)

This skip usage of for Manylinux1 images:
``actions/checkout@v4``
``actions/download-artifact@v3``
``actions/upload-artifact@v3``

Uses https://github.com/atalman/checkout-action which does not use
nodejs to checkout.

This does not require full rewrite of the Build Linux Wheels at this
point and will allow us to use Build Linux Wheels for both Manylinx 2.28
and Manylinx1 images. This should not disrupt any of the existing
Domains, since workflow will be exactly the same. Basically instead of
complete rewrite, we rewrite only part that failing in Github actions.


Test Workflow:
https://github.com/pytorch/test-infra/actions/runs/11937438064/job/33273483586?pr=5941
Please note Linux jobs are using Manylinux2_28 while Rocm are using
Manylinux1

This should also fix the SEV, since it bring back the support for both
platforms: pytorch/pytorch#140631
  • Loading branch information
atalman authored Nov 21, 2024
1 parent 8ec25b0 commit 7b1ffef
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 7 deletions.
57 changes: 57 additions & 0 deletions .github/actions/binary-upload/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Binary upload action

description: pull a specific docker image

inputs:
repository:
description: 'Repository to checkout, defaults to ""'
default: ''
type: string
trigger-event:
description: "Trigger Event in caller that determines whether or not to upload"
type: string
default: ''

runs:
using: composite
steps:
- name: Configure aws credentials (pytorch account)
if: ${{ inputs.trigger-event == 'schedule' || (inputs.trigger-event == 'push' && startsWith(github.event.ref, 'refs/heads/nightly')) }}
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::749337293305:role/gha_workflow_nightly_build_wheels
aws-region: us-east-1

- name: Configure aws credentials (pytorch account)
if: ${{ env.CHANNEL == 'test' && startsWith(github.event.ref, 'refs/tags/v') }}
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::749337293305:role/gha_workflow_test_build_wheels
aws-region: us-east-1

- name: Nightly or release RC
if: ${{ inputs.trigger-event == 'schedule' || (inputs.trigger-event == 'push' && startsWith(github.event.ref, 'refs/heads/nightly')) || (env.CHANNEL == 'test' && startsWith(github.event.ref, 'refs/tags/')) }}
shell: bash
run: |
set -ex
echo "NIGHTLY_OR_TEST=1" >> "${GITHUB_ENV}"
- name: Upload package to pytorch.org
shell: bash
working-directory: ${{ inputs.repository }}
run: |
set -ex
# shellcheck disable=SC1090
source "${BUILD_ENV_FILE}"
pip install awscli==1.32.18
AWS_CMD="aws s3 cp --dryrun"
if [[ "${NIGHTLY_OR_TEST:-0}" == "1" ]]; then
AWS_CMD="aws s3 cp"
fi
for pkg in dist/*; do
${AWS_CMD} "$pkg" "${PYTORCH_S3_BUCKET_PATH}" --acl public-read
done
15 changes: 15 additions & 0 deletions .github/actions/setup-binary-builds/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ inputs:
required: false
type: boolean
default: no
use-github-checkout:
description: One of the parameter used by pkg-helpers
required: false
type: boolean
default: true

runs:
using: composite
Expand All @@ -51,12 +56,22 @@ runs:
run: |
set -euxo pipefail
rm -rf "${REPOSITORY}"
- uses: actions/checkout@v4
if: ${{ inputs.use-github-checkout == 'true' }}
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
submodules: ${{ inputs.submodules }}
path: ${{ inputs.repository }}

- uses: atalman/checkout-action@main
if: ${{ inputs.use-github-checkout == 'false' }}
with:
repository: ${{ inputs.repository }}
path: ${{ inputs.repository }}
ref: ${{ inputs.ref }}

- name: Log Available Webhook Fields
shell: bash
run: |
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/_binary_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ jobs:
matrix: ${{ fromJSON(inputs.build-matrix) }}
timeout-minutes: 30
name: ${{ matrix.build_name }}
env:
SKIP-UPLOAD: ${{ !contains(matrix.container_image, '2_28') }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -70,6 +72,7 @@ jobs:
upload-to-base-bucket: ${{ matrix.upload_to_base_bucket }}

- name: Download the artifact
if: ${{ !env.SKIP-UPLOAD }}
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
Expand Down Expand Up @@ -97,6 +100,7 @@ jobs:
echo "NIGHTLY_OR_TEST=1" >> "${GITHUB_ENV}"
- name: Upload package to pytorch.org
if: ${{ !env.SKIP-UPLOAD }}
shell: bash
working-directory: ${{ inputs.repository }}
run: |
Expand All @@ -117,7 +121,7 @@ jobs:
done
- name: Upload package to pypi
if: ${{ env.NIGHTLY_OR_TEST == '1' && contains(inputs.upload-to-pypi, matrix.desired_cuda) }}
if: ${{ !env.SKIP-UPLOAD && env.NIGHTLY_OR_TEST == '1' && contains(inputs.upload-to-pypi, matrix.desired_cuda) }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
Expand Down
23 changes: 17 additions & 6 deletions .github/workflows/build_wheels_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ jobs:
CU_VERSION: ${{ matrix.desired_cuda }}
UPLOAD_TO_BASE_BUCKET: ${{ matrix.upload_to_base_bucket }}
ARCH: ${{ inputs.architecture }}
IS_MANYLINUX2_28: ${{ contains(matrix.container_image, '2_28') }}
name: ${{ matrix.build_name }}
runs-on: ${{ matrix.validation_runner }}
container:
Expand All @@ -141,23 +142,22 @@ jobs:
if [[ "${{ inputs.architecture }}" = "aarch64" ]]; then
rm -rf "${RUNNER_TEMP}/*"
fi
echo "::endgroup::"
- uses: actions/checkout@v4
- uses: atalman/checkout-action@main
with:
# Support the use case where we need to checkout someone's fork
repository: ${{ inputs.test-infra-repository }}
ref: ${{ inputs.test-infra-ref }}
path: test-infra
- name: Set linux aarch64 CI

- name: Install Miniforge
if: ${{ inputs.architecture == 'aarch64' }}
shell: bash -l {0}
env:
DESIRED_PYTHON: ${{ matrix.python_version }}
run: |
set -euxo pipefail
# TODO: Get rid of Conda, we already have all versions of PyThon one needs in the docker
###############################################################################
# Install conda
# disable SSL_verify due to getting "Could not find a suitable TLS CA certificate bundle, invalid path"
Expand Down Expand Up @@ -185,10 +185,12 @@ jobs:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
submodules: ${{ inputs.submodules }}
setup-miniconda: ${{ inputs.setup-miniconda }}
setup-miniconda: false
python-version: ${{ env.PYTHON_VERSION }}
cuda-version: ${{ env.CU_VERSION }}
arch: ${{ env.ARCH }}
use-github-checkout: ${{ env.IS_MANYLINUX2_28 }}

- name: Combine Env Var and Build Env Files
if: ${{ inputs.env-var-script != '' }}
working-directory: ${{ inputs.repository }}
Expand Down Expand Up @@ -281,7 +283,16 @@ jobs:
${CONDA_RUN} python "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT}"
fi
# NB: Only upload to GitHub after passing smoke tests

- name: Upload wheel
if: ${{ env.IS_MANYLINUX2_28 != 'true' }}
uses: ./test-infra/.github/actions/binary-upload
with:
repository: ${{ inputs.repository }}
trigger-event: ${{ inputs.trigger-event }}

- name: Upload wheel to GitHub
if: ${{ env.IS_MANYLINUX2_28 == 'true' }}
continue-on-error: true
uses: actions/upload-artifact@v3
with:
Expand Down

0 comments on commit 7b1ffef

Please sign in to comment.