-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (122 loc) · 4.4 KB
/
matrix-update-python.yaml
File metadata and controls
144 lines (122 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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: 11
arch: amd64
- distro: debian
distro-version: 12
arch: amd64
- distro: debian
distro-version: 12
arch: arm64
- distro: ubuntu
distro-version: 24.04
arch: amd64
- distro: ubuntu
distro-version: 22.04
arch: amd64
- 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: |
DIST=${{ matrix.distro}}-${{ matrix.distro-version}}
ARCH=${{ matrix.arch }}
if [[ "$DIST" == "sles-12sp5" ]] || [[ "$DIST" == "el-7" ]] || [[ "$DIST" == "el-9" ]] ; then
echo "PYTHON_VERSION=3.9" >> $GITHUB_ENV
elif [[ "$DIST" == "ubuntu-24.04" ]]; then
echo "PYTHON_VERSION=3.12" >> $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
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
venv/bin/pip install pipdeptree
venv/bin/pipdeptree
# add windows specific packages back
if [[ "${{ matrix.distro }}" == "windows" ]]; then
grep 'sys_platform=="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"