Skip to content

Commit

Permalink
Validate binaries (#2010)
Browse files Browse the repository at this point in the history
  • Loading branch information
atalman committed Dec 20, 2022
1 parent 7c7b640 commit de368d7
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/scripts/validate_binaries.sh
Original file line number Diff line number Diff line change
@@ -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
55 changes: 55 additions & 0 deletions .github/workflows/validate-binaries.yml
Original file line number Diff line number Diff line change
@@ -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"
27 changes: 27 additions & 0 deletions .github/workflows/validate-nightly-binaries.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit de368d7

Please sign in to comment.