From 67138174649677a9719a26c10c2f6243f895b4a3 Mon Sep 17 00:00:00 2001 From: atalman Date: Tue, 13 Dec 2022 09:10:27 -0800 Subject: [PATCH] Validate binaries --- .github/scripts/validate_binaries.sh | 31 +++++++++++ .github/workflows/validate-binaries.yml | 55 +++++++++++++++++++ .../workflows/validate-nightly-binaries.yml | 27 +++++++++ 3 files changed, 113 insertions(+) create mode 100755 .github/scripts/validate_binaries.sh create mode 100644 .github/workflows/validate-binaries.yml create mode 100644 .github/workflows/validate-nightly-binaries.yml diff --git a/.github/scripts/validate_binaries.sh b/.github/scripts/validate_binaries.sh new file mode 100755 index 000000000..63700f76f --- /dev/null +++ b/.github/scripts/validate_binaries.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +set -ex + +if [[ ${TARGET_OS} == 'windows' ]]; then + source /c/Jenkins/Miniconda3/etc/profile.d/conda.sh +else + eval "$(conda shell.bash hook)" +fi + +conda create -y -n ${ENV_NAME} python=${DESIRED_PYTHON} numpy +conda activate ${ENV_NAME} +export CONDA_CHANNEL="pytorch" +export PIP_DOWNLOAD_URL="https://download.pytorch.org/whl/cpu" +export PIP_PREFIX="" + +if [[ ${CHANNEL} = 'nightly' ]]; then + export PIP_PREFIX="--pre " + export PIP_DOWNLOAD_URL="https://download.pytorch.org/whl/nightly/cpu" + export CONDA_CHANNEL="pytorch-nightly" +elif [[ ${CHANNEL} = 'test' ]]; then + export PIP_DOWNLOAD_URL="https://download.pytorch.org/whl/test/cpu" + export CONDA_CHANNEL="pytorch-test" +fi + +if [[ ${PACKAGE_TYPE} = 'conda' ]]; then + conda install -y torchtext pytorch -c ${CONDA_CHANNEL} +else + pip install ${PIP_PREFIX} torchtext torch --extra-index-url ${PIP_DOWNLOAD_URL} +fi + +python ./test/smoke_tests/smoke_tests.py diff --git a/.github/workflows/validate-binaries.yml b/.github/workflows/validate-binaries.yml new file mode 100644 index 000000000..ad4c423b7 --- /dev/null +++ b/.github/workflows/validate-binaries.yml @@ -0,0 +1,55 @@ +name: Validate binaries + +on: + workflow_call: + inputs: + channel: + description: "Channel to use (nightly, test, release, all)" + required: false + type: string + default: release + os: + description: "Operating system to generate for (linux, windows, macos, macos-arm64)" + required: true + type: string + ref: + description: 'Reference to checkout, defaults to empty' + default: "" + required: false + type: string + workflow_dispatch: + inputs: + channel: + description: "Channel to use (nightly, test, release, all)" + required: true + type: choice + options: + - release + - nightly + - test + - all + os: + description: "Operating system to generate for (linux, windows, macos)" + required: true + type: choice + default: all + options: + - windows + - linux + - macos + - all + ref: + description: 'Reference to checkout, defaults to empty' + default: "" + required: false + type: string + +jobs: + validate-binaries: + uses: pytorch/builder/.github/workflows/validate-domain-library.yml@main + with: + package_type: "conda,wheel" + os: ${{ inputs.os }} + channel: ${{ inputs.channel }} + repository: "pytorch/text" + smoke_test: "./.github/scripts/validate_binaries.sh" diff --git a/.github/workflows/validate-nightly-binaries.yml b/.github/workflows/validate-nightly-binaries.yml new file mode 100644 index 000000000..ce954412c --- /dev/null +++ b/.github/workflows/validate-nightly-binaries.yml @@ -0,0 +1,27 @@ +# Scheduled validation of the nightly binaries +name: cron + +on: + schedule: + # At 5:30 pm UTC (7:30 am PDT) + - cron: "30 17 * * *" + # Have the ability to trigger this job manually through the API + workflow_dispatch: + push: + branches: + - main + paths: + - .github/workflows/validate-nightly-binaries.yml + - .github/workflows/validate-binaries.yml + - .github/scripts/validate-binaries.sh + pull_request: + paths: + - .github/workflows/validate-nightly-binaries.yml + - .github/workflows/validate-binaries.yml + - .github/scripts/validate-binaries.sh +jobs: + nightly: + uses: ./.github/workflows/validate-binaries.yml + with: + channel: nightly + os: all