This is an automated email from the ASF dual-hosted git repository. jdanek pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-python.git
commit ad5ab960e9f47ac18a7eab84d8ffc4253053e40a Author: Jiri Daněk <jda...@redhat.com> AuthorDate: Fri Sep 29 11:59:31 2023 +0200 NO-JIRA: fix Python 2.7 CI jobs after actions/setup-python removed this version --- .github/workflows/python-package.yml | 131 +++++++++++++++++++++++++++++++++-- 1 file changed, 126 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 784593e..fd54bc9 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -43,11 +43,30 @@ jobs: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version != '2.7' uses: actions/setup-python@v4 - id: python + id: setup-python with: python-version: ${{ matrix.python-version }} + # Python 2.7 was removed from actions/setup-python https://github.com/actions/setup-python/issues/672 + - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version == '2.7' + run: | + sudo apt install -y python2 + curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py + sudo python2 get-pip.py + id: apt-install-python + + - name: Configure steps.python.outputs + run: | + if [[ -f "${{ steps.setup-python.outputs.python-path }}" ]]; then + echo "python-path=${{ steps.setup-python.outputs.python-path }}" >> "$GITHUB_OUTPUT" + else + echo "python-path=/usr/bin/python2.7" >> "$GITHUB_OUTPUT" + fi + id: python + - name: Install dependencies run: | ${{ steps.python.outputs.python-path }} -m pip install --upgrade pip @@ -113,11 +132,39 @@ jobs: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version != '2.7' uses: actions/setup-python@v4 - id: python + id: setup-python with: python-version: ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version == '2.7' && matrix.os == 'ubuntu-latest' + run: | + sudo apt install -y python2 + curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py + sudo python2 get-pip.py + id: apt-install-python + + - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version == '2.7' && matrix.os == 'windows-latest' + run: | + choco install python2 + id: choco-install-python + shell: pwsh + + - name: Configure steps.python.outputs + run: | + if (Test-Path "${{ steps.setup-python.outputs.python-path }}") { + "python-path=${{ steps.setup-python.outputs.python-path }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } elseif (Test-Path C:/Python27/python.exe) { + "python-path=C:/Python27/python.exe" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } else { + "python-path=/usr/bin/python2.7" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } + id: python + shell: pwsh + - name: Install dependencies run: | ${{ steps.python.outputs.python-path }} -m pip install --upgrade pip @@ -161,11 +208,39 @@ jobs: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version != '2.7' uses: actions/setup-python@v4 - id: python + id: setup-python with: python-version: ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version == '2.7' && matrix.os == 'ubuntu-latest' + run: | + sudo apt install -y python2 + curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py + sudo python2 get-pip.py + id: apt-install-python + + - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version == '2.7' && matrix.os == 'windows-latest' + run: | + choco install python2 + id: choco-install-python + shell: pwsh + + - name: Configure steps.python.outputs + run: | + if (Test-Path "${{ steps.setup-python.outputs.python-path }}") { + "python-path=${{ steps.setup-python.outputs.python-path }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } elseif (Test-Path C:/Python27/python.exe) { + "python-path=C:/Python27/python.exe" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } else { + "python-path=/usr/bin/python2.7" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } + id: python + shell: pwsh + - name: Test setup.py install run: | ${{ steps.python.outputs.python-path }} setup.py install --user @@ -186,11 +261,39 @@ jobs: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version != '2.7' uses: actions/setup-python@v4 - id: python + id: setup-python with: python-version: ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version == '2.7' && matrix.os == 'ubuntu-latest' + run: | + sudo apt install -y python2 + curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py + sudo python2 get-pip.py + id: apt-install-python + + - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version == '2.7' && matrix.os == 'windows-latest' + run: | + choco install python2 + id: choco-install-python + shell: pwsh + + - name: Configure steps.python.outputs + run: | + if (Test-Path "${{ steps.setup-python.outputs.python-path }}") { + "python-path=${{ steps.setup-python.outputs.python-path }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } elseif (Test-Path C:/Python27/python.exe) { + "python-path=C:/Python27/python.exe" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } else { + "python-path=/usr/bin/python2.7" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + } + id: python + shell: pwsh + - name: Install dependencies run: | ${{ steps.python.outputs.python-path }} -m pip install --upgrade pip @@ -231,11 +334,29 @@ jobs: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version != '2.7' uses: actions/setup-python@v4 - id: python + id: setup-python with: python-version: ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.python-version }} + if: matrix.python-version == '2.7' + run: | + sudo apt install -y python2 + curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py + sudo python2 get-pip.py + id: apt-install-python + + - name: Configure steps.python.outputs + run: | + if [[ -f "${{ steps.setup-python.outputs.python-path }}" ]]; then + echo "python-path=${{ steps.setup-python.outputs.python-path }}" >> "$GITHUB_OUTPUT" + else + echo "python-path=/usr/bin/python2.7" >> "$GITHUB_OUTPUT" + fi + id: python + - name: Install dependencies run: | ${{ steps.python.outputs.python-path }} -m pip install --upgrade pip --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org