Skip to content

Commit

Permalink
NO-JIRA: fix Python 2.7 CI jobs after actions/setup-python removed th…
Browse files Browse the repository at this point in the history
…is version
  • Loading branch information
jiridanek committed Sep 30, 2023
1 parent 5573c89 commit 62aaa4c
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,42 @@ jobs:

- uses: actions/checkout@v3

- name: Setup python
id: python
# 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'
uses: actions/setup-python@v4
id: setup-python
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version == '2.7' && matrix.os == 'ubuntu-20.04'
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

# Cannot use https://github.com/ilammy/msvc-dev-cmd/blob/a742a854f54111d83b78e97091b5d85ccdaa3e89/index.js#L163
# as (unapproved) 3rd party GitHub Actions are forbidden on Apache org projects

Expand Down

0 comments on commit 62aaa4c

Please sign in to comment.