@@ -15,10 +15,10 @@ jobs:
1515 python-version : [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
1616 name : Pre-commit python ${{ matrix.python-version }}
1717 steps :
18- - uses : actions/checkout@v4
18+ - uses : actions/checkout@v5
1919 with :
2020 fetch-depth : 100
21- - uses : actions/setup-python@v5
21+ - uses : actions/setup-python@v6
2222 id : cachepy
2323 with :
2424 python-version : ${{ matrix.python-version }}
@@ -28,32 +28,35 @@ jobs:
2828 mypy-requirements.txt
2929 dev-requirements.txt
3030 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-
37- - name : ' Install requirements (standard)'
38- run : |
39- pip install --upgrade pip wheel
40- pip install -r requirements.txt
41- - name : ' Install requirements (standard with freeze) or constraints (Python ${{ matrix.python-version }})'
31+ - name : ' Install requirements (standard or constraints ${{ matrix.python-version }})'
4232 run : |
4333 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
34+ constraints_file="constraints-${{ matrix.python-version }}.txt"
35+ regen_constraints=
36+ if [ -f "$constraints_file" ] ; then
37+ at="$(git --no-pager log -p -1 "--format=tformat:%at" --no-patch -- "$constraints_file")"
38+ dat="$(git --no-pager log -p -1 "--format=tformat:%at" --no-patch -- "requirements.txt")"
39+ if [ "$at" -lt "$dat" ] ; then
40+ regen_constraints=true
41+ fi
4642 else
43+ regen_constraints=true
44+ fi
45+ if [ -n "$regen_constraints" ] ; then
4746 pip install -r requirements.txt
48- pip freeze > constraints-${{ matrix.python-version }}.txt
47+ pip freeze > "$constraints_file"
48+ grep -vF git+ "$constraints_file" > "$constraints_file"-relaxed
49+ else
50+ grep -vF git+ "$constraints_file" > "$constraints_file"-relaxed
51+ pip install -r requirements.txt -c "$constraints_file"-relaxed
4952 fi
50- - name : ' Install dev requirements'
53+ - name : ' Install development requirements'
5154 run : |
52- pip install -r dev-requirements.txt -r mypy-requirements.txt -c constraints-${{ matrix.python-version }}.txt
55+ pip install -r dev-requirements.txt -r mypy-requirements.txt -c constraints-${{ matrix.python-version }}.txt-relaxed
5356 - name : MyPy cache
5457 uses : actions/cache@v4
5558 with :
56- path : .mypy_cache/${{ matrix.python-version }}
59+ path : ' .mypy_cache/[0-9]* '
5760 key : mypy-${{ matrix.python-version }}
5861 - name : ' pre-commit'
5962 uses : pre-commit/action@v3.0.1
@@ -65,18 +68,25 @@ jobs:
6568 # if: ${{ matrix.python-version == '3.6' }}
6669 # with:
6770 # extra_args: --all -c .pre-commit-config-gh-${{ matrix.python-version }}.yaml
71+ - name : Get transitive dependencies licences
72+ id : license_check_print_report
73+ # uses: pilosus/action-pip-license-checker@v1.0.0
74+ # continue-on-error: true
75+ uses : pilosus/action-pip-license-checker@v3.1.0
76+ with :
77+ requirements : constraints-${{ matrix.python-version }}.txt
6878 - name : Check transitive dependencies licences
6979 id : license_check_report
7080# uses: pilosus/action-pip-license-checker@v1.0.0
7181# continue-on-error: true
72- uses : pilosus/action-pip-license-checker@v2.0 .0
82+ uses : pilosus/action-pip-license-checker@v3.1 .0
7383 with :
7484 requirements : constraints-${{ matrix.python-version }}.txt
7585 fail : ' StrongCopyleft'
7686 exclude : ' pylint.*'
7787 - name : Print licences report
7888 if : ${{ always() }}
79- run : echo "${{ steps.license_check_report .outputs.report }}"
89+ run : echo "${{ steps.license_check_print_report .outputs.report }}"
8090 - uses : actions/upload-artifact@v4
8191 with :
8292 name : constraints-artifacts-${{ matrix.python-version }}
@@ -90,10 +100,10 @@ jobs:
90100 python-version : [ "3.7" ]
91101 name : Pre-commit python ${{ matrix.python-version }}
92102 steps :
93- - uses : actions/checkout@v4
103+ - uses : actions/checkout@v5
94104 with :
95105 fetch-depth : 100
96- - uses : actions/setup-python@v5
106+ - uses : actions/setup-python@v6
97107 id : cachepy
98108 with :
99109 python-version : ${{ matrix.python-version }}
@@ -103,32 +113,34 @@ jobs:
103113 mypy-requirements.txt
104114 dev-requirements.txt
105115 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 }})'
116+ - name : ' Install requirements (standard or constraints ${{ matrix.python-version }})'
117117 run : |
118118 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
119+ constraints_file="constraints-${{ matrix.python-version }}.txt"
120+ regen_constraints=
121+ if [ -f "$constraints_file" ] ; then
122+ at="$(git --no-pager log -p -1 "--format=tformat:%at" --no-patch -- "$constraints_file")"
123+ dat="$(git --no-pager log -p -1 "--format=tformat:%at" --no-patch -- "requirements.txt")"
124+ if [ "$at" -lt "$dat" ] ; then
125+ regen_constraints=true
126+ fi
121127 else
128+ regen_constraints=true
129+ fi
130+ if [ -n "$regen_constraints" ] ; then
122131 pip install -r requirements.txt
123- pip freeze > constraints-${{ matrix.python-version }}.txt
132+ pip freeze > "$constraints_file"
133+ grep -vF git+ "$constraints_file" > "$constraints_file"-relaxed
134+ else
135+ grep -vF git+ "$constraints_file" > "$constraints_file"-relaxed
136+ pip install -r requirements.txt -c "$constraints_file"-relaxed
124137 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
138+ - run : |
139+ pip install -r dev-requirements.txt -r mypy-requirements.txt -c constraints-${{ matrix.python-version }}.txt-relaxed
128140 - name : MyPy cache
129141 uses : actions/cache@v4
130142 with :
131- path : .mypy_cache/${{ matrix.python-version }}
143+ path : ' .mypy_cache/[0-9]* '
132144 key : mypy-${{ matrix.python-version }}
133145 - name : ' pre-commit'
134146 uses : pre-commit/action@v3.0.1
@@ -140,18 +152,25 @@ jobs:
140152 # if: ${{ matrix.python-version == '3.6' }}
141153 # with:
142154 # extra_args: --all -c .pre-commit-config-gh-${{ matrix.python-version }}.yaml
155+ - name : Get transitive dependencies licences
156+ id : license_check_print_report
157+ # uses: pilosus/action-pip-license-checker@v1.0.0
158+ # continue-on-error: true
159+ uses : pilosus/action-pip-license-checker@v3.1.0
160+ with :
161+ requirements : constraints-${{ matrix.python-version }}.txt
143162 - name : Check transitive dependencies licences
144163 id : license_check_report
145164# uses: pilosus/action-pip-license-checker@v1.0.0
146165# continue-on-error: true
147- uses : pilosus/action-pip-license-checker@v2.0 .0
166+ uses : pilosus/action-pip-license-checker@v3.1 .0
148167 with :
149168 requirements : constraints-${{ matrix.python-version }}.txt
150169 fail : ' StrongCopyleft'
151- exclude : ' pylint.*'
170+ exclude : ' (?i)^( pylint|dulwich) .*'
152171 - name : Print licences report
153172 if : ${{ always() }}
154- run : echo "${{ steps.license_check_report .outputs.report }}"
173+ run : echo "${{ steps.license_check_print_report .outputs.report }}"
155174 - uses : actions/upload-artifact@v4
156175 with :
157176 name : constraints-artifacts-${{ matrix.python-version }}
@@ -169,8 +188,8 @@ jobs:
169188 - name : Get analysis timestamp
170189 id : timestamp
171190 run : echo "timestamp=$(date -Is)" >> "$GITHUB_OUTPUT"
172- - uses : actions/checkout@v4
173- - uses : actions/download-artifact@v4
191+ - uses : actions/checkout@v5
192+ - uses : actions/download-artifact@v5
174193 id : download
175194 with :
176195 pattern : constraints-artifacts-*
@@ -199,7 +218,7 @@ jobs:
199218 uses : peter-evans/create-pull-request@v7
200219 if : steps.move.outputs.skip == 'false'
201220 with :
202- title : Updated constraints (triggered by ${{ github.sha }})
221+ title : Updated constraints (triggered on ${{ steps.timestamp.outputs.timestamp }} by ${{ github.sha }})
203222 add-paths : constraints-*.txt
204223 delete-branch : true
205224 commit-message : " [create-pull-request] Automatically commit updated contents (constraints)"
0 commit comments