Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI failures with Python 2.7 #1521

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/actions/setup-python/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Setup python

description: Setup python using either actions/setup-pythono or conda
JeanChristopheMorinPerso marked this conversation as resolved.
Show resolved Hide resolved

inputs:
python-version:
description: Python version to setup
required: true
os:
description: os
required: true

runs:
using: "composite"
steps:
- name: Set up Python ${{ inputs.python-version }} with actions/setup-python
if: ${{ inputs.python-version != '2.7' }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

# Conda comes pre-installed with the GitHub hosted runners.
- name: Create conda environment
if: ${{ inputs.python-version == '2.7' }}
shell: bash
run: |
if [[ "${OSTYPE}" == "msys" ]]; then
eval "$(/c/Miniconda/condabin/conda.bat shell.bash hook)"
else
eval "$(conda shell.bash hook)"
fi
conda create -n python python=2.7 setuptools wheel

- name: Fix conda installed python
if: inputs.python-version == '2.7' && (startsWith(inputs.os, 'ubuntu') || startsWith(inputs.os, 'macos'))
shell: bash -el {0}
run: |
set -ex

eval "$(conda shell.bash hook)"
conda activate python
conda info

if [[ "${{ inputs.os }}" = macos* ]]; then
install_name_tool -change @rpath/libpython2.7.dylib $(dirname $(which python))/../lib/libpython2.7.dylib $(which python)
else
sudo apt-get install patchelf

# This will allow virtualenv to work correctly.
# Basically, Python provided by conda is "fully portable". Its default
# RPATH is "$ORIGIN/../lib". The problem is that once the virtualenv
# is created, the copied/symlinked interpreter in the venv won't be
# able to load lib since the lib folder isn't copied in the venv.
patchelf --set-rpath $(dirname $(which python))/../lib $(which python)
fi
32 changes: 24 additions & 8 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,23 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Setup python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}
os: ubuntu-latest

- name: Install Rez
run: |
mkdir ./installdir

if [[ "${{ matrix.python-version }}" == "2.7" ]]; then
eval "$(conda shell.bash hook)"
conda activate python
fi

python ./install.py ./installdir

- name: Run Benchmark
Expand All @@ -46,9 +53,13 @@ jobs:

- name: Validate Result
run: |
if [[ "${{ matrix.python-version }}" == "2.7" ]]; then
eval "$(conda shell.bash hook)"
conda activate python
fi
python ./.github/scripts/validate_benchmark.py

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: "benchmark-result-${{ matrix.python-version }}"
path: ./out
Expand All @@ -68,18 +79,19 @@ jobs:
max-parallel: 1

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Setup python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}
os: ubuntu

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: "benchmark-result-${{ matrix.python-version }}"
path: .

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: master
path: src
Expand All @@ -102,6 +114,10 @@ jobs:

- name: Store Benchmark Result
run: |
if [[ "${{ matrix.python-version }}" == "2.7" ]]; then
eval "$(conda shell.bash hook)"
conda activate python
fi
python ./.github/scripts/store_benchmark.py
working-directory: src

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/copyright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 2.7
python-version: 3

- name: Run copyright checker
run: |
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,26 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Setup python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}
os: ubuntu-latest

- name: Install Rez
shell: bash
run: |
set -ex
mkdir ./installdir

if [[ "${{ matrix.python-version }}" == "2.7" ]]; then
eval "$(conda shell.bash hook)"
conda activate python
fi

python --version
python ./install.py ./installdir

- name: Install Rez test dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/flake8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.7

Expand Down
79 changes: 65 additions & 14 deletions .github/workflows/installation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ jobs:
name: ${{ matrix.os }} - ${{ matrix.python-version }} - ${{ matrix.method }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macOS-latest
- macos-latest
- windows-2019
python-version:
- '2.7'
Expand All @@ -34,48 +35,98 @@ jobs:
include:
# ubuntu
- os: ubuntu-latest
method: install
method: install
REZ_SET_PATH_COMMAND: 'export PATH=${PATH}:/opt/rez/bin/rez'
REZ_INSTALL_COMMAND: 'python ./install.py /opt/rez'
REZ_INSTALL_COMMAND: |
set -ex
if [[ "${MATRIX_PYTHON_VERSION}" == "2.7" ]]; then
eval "$(conda shell.bash hook)"
conda activate python
fi
python ./install.py /opt/rez

- os: ubuntu-latest
method: pip
REZ_SET_PATH_COMMAND: 'export PATH=${PATH}:/opt/rez/bin PYTHONPATH=${PYTHONPATH}:/opt/rez'
REZ_INSTALL_COMMAND: 'pip install --target /opt/rez .'
REZ_INSTALL_COMMAND: |
set -ex
if [[ "${MATRIX_PYTHON_VERSION}" == "2.7" ]]; then
eval "$(conda shell.bash hook)"
conda activate python
fi
pip install --target /opt/rez .
# macOS
- os: macOS-latest
- os: macos-latest
method: install
REZ_SET_PATH_COMMAND: 'export PATH=${PATH}:~/rez/bin/rez'
REZ_INSTALL_COMMAND: 'python ./install.py ~/rez'
- os: macOS-latest
REZ_INSTALL_COMMAND: |
set -e
if [[ "${MATRIX_PYTHON_VERSION}" == "2.7" ]]; then
eval "$(conda shell.bash hook)"
conda activate python

echo "otool -L $(dirname $(which python))/../lib/libpython2.7.dylib"
otool -L $(dirname $(which python))/../lib/libpython2.7.dylib
echo "otool -l $(dirname $(which python))/../lib/libpython2.7.dylib"
otool -l $(dirname $(which python))/../lib/libpython2.7.dylib
fi

python ./install.py ~/rez
- os: macos-latest
method: pip
REZ_SET_PATH_COMMAND: 'export PATH="$PATH:~/rez/bin" PYTHONPATH=$PYTHONPATH:$HOME/rez'
REZ_INSTALL_COMMAND: 'pip install --target ~/rez .'
REZ_INSTALL_COMMAND: |
set -ex
if [[ "${MATRIX_PYTHON_VERSION}" == "2.7" ]]; then
eval "$(conda shell.bash hook)"
conda activate python
fi
pip install --target ~/rez .
# windows
- os: windows-2019
method: install
REZ_SET_PATH_COMMAND: '$env:PATH="$env:PATH;C:\ProgramData\rez\Scripts\rez"'
REZ_INSTALL_COMMAND: 'python ./install.py C:\ProgramData\rez'
REZ_INSTALL_COMMAND: |
if ($env:MATRIX_PYTHON_VERSION -eq "2.7") {
& 'C:\Miniconda\shell\condabin\conda-hook.ps1'
conda activate python
}
python ./install.py C:\ProgramData\rez
- os: windows-2019
method: pip
REZ_SET_PATH_COMMAND: '[System.Environment]::SetEnvironmentVariable("PATH","$env:PATH;C:\ProgramData\rez\bin"); $env:PYTHONPATH="$env:PYTHONPATH;C:\ProgramData\rez"'
REZ_INSTALL_COMMAND: 'pip install --target C:\ProgramData\rez .'

REZ_INSTALL_COMMAND: |
if ($env:MATRIX_PYTHON_VERSION -eq "2.7") {
& 'C:\Miniconda\shell\condabin\conda-hook.ps1'
conda activate python
}
pip install --target C:\ProgramData\rez .

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3

- name: Setup python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}

- name: Install
env:
MATRIX_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
${{ matrix.REZ_INSTALL_COMMAND }}

- name: Run rez-status
env:
MATRIX_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
${{ matrix.REZ_SET_PATH_COMMAND }}
rez-status

- name: Install rez with rez-pip
env:
MATRIX_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
${{ matrix.REZ_SET_PATH_COMMAND }}
rez-pip --install .
rez-pip --install .
12 changes: 9 additions & 3 deletions .github/workflows/mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ concurrency:
jobs:
main:
name: main
runs-on: macOS-${{ matrix.os-version }}
runs-on: macos-${{ matrix.os-version }}

strategy:
matrix:
Expand All @@ -36,10 +36,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Setup python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}
os: macos-latest

- name: Verify cmake
run: |
Expand All @@ -51,7 +52,12 @@ jobs:

- name: Install Rez
run: |
if [[ "${{ matrix.python-version }}" == "2.7" ]]; then
eval "$(conda shell.bash hook)"
conda activate python
fi
mkdir ./installdir
python --version
python ./install.py ./installdir

- name: Install Rez test dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 2.7
python-version: 3

- name: Install Dependencies
run: |
Expand Down
Loading
Loading