Skip to content

chore: update Python dependencies (#32) #81

chore: update Python dependencies (#32)

chore: update Python dependencies (#32) #81

Workflow file for this run

name: Matrix-debug-update-Python
on:
push:
branches: [ master ]
workflow_dispatch:
env:
GH_TOKEN: ${{ github.token }}
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- name: Checkout source repo
uses: actions/checkout@v4
matrix-job:
runs-on: ubuntu-latest
needs: prepare
strategy:
matrix:
distro: [ el ]
distro-version: [ 8, 9 ]
arch: [ amd64, ppc64le, s390x ]
include:
- distro: debian
distro-version: 10
arch: amd64
- distro: debian
distro-version: 11
arch: amd64
- distro: debian
distro-version: 12
arch: amd64
- distro: debian
distro-version: 12
arch: arm64
- distro: ubuntu
distro-version: 20.04
arch: amd64
- distro: ubuntu
distro-version: 22.04
arch: amd64
- distro: sles
distro-version: 12sp5
arch: amd64
- distro: sles
distro-version: 12sp5
arch: ppc64le
- distro: sles
distro-version: 12sp5
arch: s390x
- distro: sles
distro-version: 15sp4
arch: amd64
- distro: sles
distro-version: 15sp4
arch: ppc64le
- distro: sles
distro-version: 15sp4
arch: s390x
- distro: windows
distro-version: 2017
arch: x64
steps:
- name: Checkout source repo
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set Python version
shell: bash
run: |
if [[ "${{ matrix.name }}" == "windows-x64" ]] ; then
DIST=windows
ARCH=x64
else
DIST=${{ matrix.distro}}-${{ matrix.distro-version}}
ARCH=${{ matrix.arch }}
fi
if [[ "$DIST" == "sles-12sp5" ]] || [[ "$DIST" == "el-7" ]] || [[ "$DIST" == "el-9" ]] ; then
echo "PYTHON_VERSION=3.9" >> $GITHUB_ENV
elif [[ "$DIST" == "debian-12" ]]; then
echo "PYTHON_VERSION=3.11" >> $GITHUB_ENV
else
echo "PYTHON_VERSION=3.10" >> $GITHUB_ENV
fi
- uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install Python dependencies
shell: bash
run: |
sudo apt-get install -y libkrb5-dev
cp requirements.txt pip_requirements.txt
# urllib3 2.x requires openssl 1.1.1+, while RHEL/7 and SLES/12 have openssl 1.0.2 from system
if [[ "${{ matrix.distro}}-${{ matrix.distro-version}}" == "sles-12sp5" ]] || [[ "${{ matrix.distro}}-${{ matrix.distro-version}}" == "el-7" ]] ; then
sed -ie 's|urllib3=.*$|urllib3==1.*|' pip_requirements.txt
# Cryptography new version is not supporting openssl < 1.1.1
# Reference: https://cryptography.io/en/latest/faq/#installing-cryptography-with-openssl-0-9-8-1-0-0-1-0-1-1-0-2-1-1-0-fails
if [[ "${{ matrix.arch }}" != "amd64" ]]; then
sed -ie 's|cryptography.*$|cryptography<=3.0|' pip_requirements.txt
fi
fi
python -m venv venv
venv/bin/pip install -r pip_requirements.txt
rm -f pip_requirements.txt
venv/bin/pip freeze | tee -a requirements.${{ matrix.distro }}-${{ matrix.distro-version }}-${{ matrix.arch }}.txt
if [[ "${{ matrix.distro }}" == "windows" ]]; then
grep -w win32 requirements.txt >> requirements.${{ matrix.distro }}-${{ matrix.distro-version }}-${{ matrix.arch }}.txt
fi
- name: Upload file
uses: actions/upload-artifact@v4
with:
name: requirements.${{ matrix.distro }}-${{ matrix.distro-version }}-${{ matrix.arch }}.txt
path: requirements.${{ matrix.distro }}-${{ matrix.distro-version }}-${{ matrix.arch }}.txt
collect:
runs-on: ubuntu-latest
needs: matrix-job
steps:
- name: Checkout source repo
uses: actions/checkout@v4
- name: Download files
uses: actions/download-artifact@v4
with:
path: python-dependency
merge-multiple: true
- name: check download artifacts
shell: bash
run: |
pwd
ls -al
ls -altr python-dependency
mkdir -p web/python-dependencies
mv python-dependency/requirements.*.txt web/python-dependencies/
rm -rf python-dependency
git push -d origin update-python-dependencies || true
git checkout -b update-python-dependencies
git add web/python-dependencies
git status
git remote -v
git config --global user.name 'PEM CI'
git config --global user.email 'PEM-CI@users.noreply.github.com'
git commit -am "chore: update Python dependencies" || { echo "No changes to commit"; exit 0; }
git push origin update-python-dependencies:update-python-dependencies || { echo "Remote branch already exists"; exit 0; }
echo "current branch: ${GITHUB_REF}"
gh pr create -B master -H $(git branch --show-current) -t "Update Python dependencies" -b "This PR is generated by workflow: Update-Python-Dependencies" || echo "PR already exists"