Skip to content

Commit 83b161b

Browse files
committed
GitHub CI workflows dependencies have been updated
1 parent da625e4 commit 83b161b

2 files changed

Lines changed: 126 additions & 14 deletions

File tree

.github/workflows/build_n_deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout repo
12-
uses: actions/checkout@v3
12+
uses: actions/checkout@v4
1313
- name: Setup Python environment
14-
uses: actions/setup-python@v4
14+
uses: actions/setup-python@v5
1515
with:
1616
python-version: '3.x'
1717
- name: Install development dependencies
18-
uses: py-actions/py-dependency-install@v4.0.0
18+
uses: py-actions/py-dependency-install@v4.1.0
1919
with:
2020
path: "dev-requirements.txt"
2121
- name: Build packages to be uploaded
2222
run: python -m build
2323
- name: pypi-publish
24-
uses: pypa/gh-action-pypi-publish@v1.8.7
24+
uses: pypa/gh-action-pypi-publish@v1.12.4
2525
with:
2626
user: __token__
2727
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/pre-commit.yml

Lines changed: 122 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ on:
44
pull_request:
55
push:
66
branches: [main]
7+
paths-ignore:
8+
- 'constraints-*.txt'
79

810
jobs:
911
pre-commit:
1012
runs-on: ubuntu-latest
1113
strategy:
1214
matrix:
13-
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
15+
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
1416
name: Pre-commit python ${{ matrix.python-version }}
1517
steps:
1618
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 100
1721
- uses: actions/setup-python@v5
1822
id: cachepy
1923
with:
@@ -24,15 +28,28 @@ jobs:
2428
mypy-requirements.txt
2529
dev-requirements.txt
2630
architecture: x64
31+
- name: Changed requirements.txt
32+
id: changed-requirements-txt
33+
uses: tj-actions/changed-files@v44
34+
with:
35+
files: requirements.txt
36+
2737
- name: 'Install requirements (standard)'
2838
run: |
2939
pip install --upgrade pip wheel
3040
pip install -r requirements.txt
31-
- name: 'Freeze Python ${{ matrix.python-version }} constraints'
41+
- name: 'Install requirements (standard with freeze) or constraints (Python ${{ matrix.python-version }})'
3242
run: |
33-
pip freeze > constraints-${{ matrix.python-version }}.txt
43+
pip install --upgrade pip wheel
44+
if [ ${{ steps.changed-requirements-txt.outputs.any_changed }} != 'true' ] && [ -f constraints-${{ matrix.python-version }}.txt ] ; then
45+
pip install -r requirements.txt -c constraints-${{ matrix.python-version }}.txt
46+
else
47+
pip install -r requirements.txt
48+
pip freeze > constraints-${{ matrix.python-version }}.txt
49+
fi
3450
- name: 'Install dev requirements'
35-
run: pip install -r dev-requirements.txt -r mypy-requirements.txt
51+
run: |
52+
pip install -r dev-requirements.txt -r mypy-requirements.txt -c constraints-${{ matrix.python-version }}.txt
3653
- name: MyPy cache
3754
uses: actions/cache@v4
3855
with:
@@ -66,32 +83,127 @@ jobs:
6683
retention-days: 2
6784
path: constraints-${{ matrix.python-version }}.txt
6885

86+
pre-commit-22_04:
87+
runs-on: ubuntu-22.04
88+
strategy:
89+
matrix:
90+
python-version: [ "3.7" ]
91+
name: Pre-commit python ${{ matrix.python-version }}
92+
steps:
93+
- uses: actions/checkout@v4
94+
with:
95+
fetch-depth: 100
96+
- uses: actions/setup-python@v5
97+
id: cachepy
98+
with:
99+
python-version: ${{ matrix.python-version }}
100+
cache: 'pip'
101+
cache-dependency-path: |
102+
requirements.txt
103+
mypy-requirements.txt
104+
dev-requirements.txt
105+
architecture: x64
106+
- name: Changed requirements.txt
107+
id: changed-requirements-txt
108+
uses: tj-actions/changed-files@v44
109+
with:
110+
files: requirements.txt
111+
112+
- name: 'Install requirements (standard)'
113+
run: |
114+
pip install --upgrade pip wheel
115+
pip install -r requirements.txt
116+
- name: 'Install requirements (standard with freeze) or constraints (Python ${{ matrix.python-version }})'
117+
run: |
118+
pip install --upgrade pip wheel
119+
if [ ${{ steps.changed-requirements-txt.outputs.any_changed }} != 'true' ] && [ -f constraints-${{ matrix.python-version }}.txt ] ; then
120+
pip install -r requirements.txt -c constraints-${{ matrix.python-version }}.txt
121+
else
122+
pip install -r requirements.txt
123+
pip freeze > constraints-${{ matrix.python-version }}.txt
124+
fi
125+
- name: 'Install dev requirements'
126+
run: |
127+
pip install -r dev-requirements.txt -r mypy-requirements.txt -c constraints-${{ matrix.python-version }}.txt
128+
- name: MyPy cache
129+
uses: actions/cache@v4
130+
with:
131+
path: .mypy_cache/${{ matrix.python-version }}
132+
key: mypy-${{ matrix.python-version }}
133+
- name: 'pre-commit'
134+
uses: pre-commit/action@v3.0.1
135+
# if: ${{ matrix.python-version != '3.6' }}
136+
with:
137+
extra_args: --all -c .pre-commit-config.yaml
138+
# - name: 'pre-commit (custom Python ${{ matrix.python-version }})'
139+
# uses: pre-commit/action@v3.0.1
140+
# if: ${{ matrix.python-version == '3.6' }}
141+
# with:
142+
# extra_args: --all -c .pre-commit-config-gh-${{ matrix.python-version }}.yaml
143+
- name: Check transitive dependencies licences
144+
id: license_check_report
145+
# uses: pilosus/action-pip-license-checker@v1.0.0
146+
# continue-on-error: true
147+
uses: pilosus/action-pip-license-checker@v2.0.0
148+
with:
149+
requirements: constraints-${{ matrix.python-version }}.txt
150+
fail: 'StrongCopyleft'
151+
exclude: 'pylint.*'
152+
- name: Print licences report
153+
if: ${{ always() }}
154+
run: echo "${{ steps.license_check_report.outputs.report }}"
155+
- uses: actions/upload-artifact@v4
156+
with:
157+
name: constraints-artifacts-${{ matrix.python-version }}
158+
retention-days: 2
159+
path: constraints-${{ matrix.python-version }}.txt
160+
161+
69162
pull_request_changes:
70163
runs-on: ubuntu-latest
71164
name: Pull request with the newly generated contents
72165
needs:
73166
- pre-commit
167+
- pre-commit-22_04
74168
steps:
169+
- name: Get analysis timestamp
170+
id: timestamp
171+
run: echo "timestamp=$(date -Is)" >> "$GITHUB_OUTPUT"
75172
- uses: actions/checkout@v4
76173
- uses: actions/download-artifact@v4
174+
id: download
77175
with:
78176
pattern: constraints-artifacts-*
79177
merge-multiple: true
80178
path: changes-dir
81179
- name: Move artifacts to their right place
180+
id: move
82181
run: |
83-
ls -lR changes-dir
84-
cp -dpr changes-dir/* .
85-
rm -r changes-dir/*
182+
skip=true
183+
if [ -d "${{steps.download.outputs.download-path}}" ] ; then
184+
for con in "${{steps.download.outputs.download-path}}"/constraints-*.txt ; do
185+
case "$con" in
186+
*/constraints-\*.txt)
187+
break
188+
;;
189+
*)
190+
cp -p "$con" .
191+
skip=false
192+
;;
193+
esac
194+
done
195+
fi
196+
echo "skip=$skip" >> "$GITHUB_OUTPUT"
86197
- name: Create Pull Request
87198
id: cpr
88199
uses: peter-evans/create-pull-request@v7
200+
if: steps.move.outputs.skip == 'false'
89201
with:
90202
title: Updated constraints (triggered by ${{ github.sha }})
91203
delete-branch: true
92-
commit-message: "[create-pull-request] Automatically commit updated contents (constraints, generated documentation)"
204+
commit-message: "[create-pull-request] Automatically commit updated contents (constraints)"
93205
- name: Check outputs
94206
if: ${{ steps.cpr.outputs.pull-request-number }}
95207
run: |
96-
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
97-
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
208+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" >> "$GITHUB_STEP_SUMMARY"
209+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)