diff --git a/.github/scripts/validate_binaries.sh b/.github/scripts/validate_binaries.sh new file mode 100755 index 000000000..d08931fc9 --- /dev/null +++ b/.github/scripts/validate_binaries.sh @@ -0,0 +1,24 @@ +#!/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 + +if [[ ${PACKAGE_TYPE} == "libtorch" ]]; then + curl ${INSTALLATION} -o libtorch.zip + unzip libtorch.zip +else + conda create -y -n ${ENV_NAME} python=${DESIRED_PYTHON} numpy pillow + conda activate ${ENV_NAME} + export CONDA_LIBRARY_PATH="$(dirname $(which python))/../lib" + export LD_LIBRARY_PATH=$CONDA_LIBRARY_PATH:$LD_LIBRARY_PATH + INSTALLATION=${INSTALLATION/"conda install"/"conda install -y"} + eval $INSTALLATION + python ./test/smoke_test/smoke_test.py + if [[ ${TARGET_OS} != 'macos' && ${TARGET_OS} != 'windows' ]]; then + ${PWD}/check_binary.sh + fi +fi diff --git a/.github/workflows/validate-linux-binaries.yml b/.github/workflows/validate-linux-binaries.yml index a8f12c0ea..da9c60291 100644 --- a/.github/workflows/validate-linux-binaries.yml +++ b/.github/workflows/validate-linux-binaries.yml @@ -61,17 +61,4 @@ jobs: export DESIRED_DEVTOOLSET="${{ matrix.devtoolset }}" export PACKAGE_TYPE="${{ matrix.package_type }}" export TARGET_OS="linux" - conda create -y -n ${ENV_NAME} python=${{ matrix.python_version }} numpy pillow - conda activate ${ENV_NAME} - export CONDA_LIBRARY_PATH="$(dirname $(which python))/../lib" - export LD_LIBRARY_PATH=$CONDA_LIBRARY_PATH:$LD_LIBRARY_PATH - - if [[ ${{ matrix.package_type }} == "libtorch" ]]; then - curl ${{ matrix.installation }} -o libtorch.zip - unzip libtorch.zip - else - INSTALLATION=${INSTALLATION/"conda install"/"conda install -y"} - eval $INSTALLATION - python ./test/smoke_test/smoke_test.py - ${PWD}/check_binary.sh - fi + ./.github/scripts/validate_binaries.sh diff --git a/.github/workflows/validate-macos-binaries.yml b/.github/workflows/validate-macos-binaries.yml index 8cfac3f50..c79bb307c 100644 --- a/.github/workflows/validate-macos-binaries.yml +++ b/.github/workflows/validate-macos-binaries.yml @@ -67,20 +67,7 @@ jobs: export DESIRED_DEVTOOLSET="${{ matrix.devtoolset }}" export PACKAGE_TYPE="${{ matrix.package_type }}" export TARGET_OS="macos" - export LD_LIBRARY_PATH="$(dirname $(which python))/../lib" - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib - conda create -y -n ${ENV_NAME} python=${{ matrix.python_version }} numpy pillow - conda activate ${ENV_NAME} - - - if [[ ${{ matrix.package_type }} == "libtorch" ]]; then - curl ${{ matrix.installation }} -o libtorch.zip - unzip libtorch.zip - else - eval $INSTALLATION - python ./test/smoke_test/smoke_test.py - ${PWD}/check_binary.sh - fi + ./.github/scripts/validate_binaries.sh macos-arm64: needs: generate-macos-arm64-matrix @@ -104,11 +91,5 @@ jobs: export DESIRED_PYTHON="${{ matrix.python_version }}" export DESIRED_CUDA="${{ matrix.desired_cuda }}" export PACKAGE_TYPE="${{ matrix.package_type }}" - export TARGET_OS="macos" - export LD_LIBRARY_PATH="$(dirname $(which python))/../lib" - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib - conda create -y -n ${ENV_NAME} python=${{ matrix.python_version }} numpy pillow - conda activate ${ENV_NAME} - eval $INSTALLATION - python ./test/smoke_test/smoke_test.py - ${PWD}/check_binary.sh + export TARGET_OS="macos-arm64" + ./.github/scripts/validate_binaries.sh diff --git a/.github/workflows/validate-windows-binaries.yml b/.github/workflows/validate-windows-binaries.yml index 7ab7bf3b2..4d93e5db8 100644 --- a/.github/workflows/validate-windows-binaries.yml +++ b/.github/workflows/validate-windows-binaries.yml @@ -56,13 +56,9 @@ jobs: export GPU_ARCH_TYPE="${{ matrix.gpu_arch_type }}" export INSTALLATION="${{ matrix.installation }}" export CUDA_VER="${{ matrix.desired_cuda }}" - - if [[ ${{ matrix.package_type }} == "libtorch" ]]; then - curl ${{ matrix.installation }} -o libtorch.zip - unzip libtorch.zip - else - conda create -y -n ${ENV_NAME} python=${{ matrix.python_version }} numpy pillow - conda activate ${ENV_NAME} - eval $INSTALLATION - python ./test/smoke_test/smoke_test.py - fi + export DESIRED_PYTHON="${{ matrix.python_version }}" + export DESIRED_CUDA="${{ matrix.desired_cuda }}" + export DESIRED_DEVTOOLSET="${{ matrix.devtoolset }}" + export PACKAGE_TYPE="${{ matrix.package_type }}" + export TARGET_OS="windows" + ./.github/scripts/validate_binaries.sh