Skip to content

Commit b04544d

Browse files
authored
Merge pull request #94 from dflook/python312
Python 3.12
2 parents eb46ee6 + 678a761 commit b04544d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+11128
-214
lines changed

.github/workflows/release.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ concurrency:
88
group: release
99
cancel-in-progress: false
1010

11+
env:
12+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
13+
1114
jobs:
1215

1316
release:
1417
runs-on: ubuntu-latest
1518
container:
16-
image: danielflook/python-minifier-build:python3.11-2022-10-25
19+
image: danielflook/python-minifier-build:python3.12-2024-01-12
1720
steps:
1821
- name: Checkout
1922
uses: actions/checkout@v3
@@ -25,8 +28,8 @@ jobs:
2528
2629
- name: Build package
2730
run: |
28-
pip3 install --upgrade setuptools wheel
29-
python3 setup.py sdist bdist_wheel --universal
31+
pip3 install --upgrade build
32+
python3 -m build
3033
3134
- uses: actions/upload-artifact@v3
3235
with:
@@ -51,7 +54,7 @@ jobs:
5154
id-token: write
5255
environment:
5356
name: pypi
54-
url: https://pypi.org/project/python-minifier/
57+
url: https://pypi.org/project/python-minifier/${{ github.event.release.tag_name }}
5558
steps:
5659
- uses: actions/download-artifact@v3
5760
with:

.github/workflows/release_test.yaml

Lines changed: 82 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,81 @@ name: Release Test
22

33
on: [push]
44

5+
env:
6+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
7+
58
jobs:
69

7-
package:
8-
name: Create Package
10+
package_python3:
11+
name: Create sdist and Python 3 Wheel
912
runs-on: ubuntu-latest
13+
outputs:
14+
sdist: ${{ steps.package.outputs.sdist }}
15+
wheel: ${{ steps.package.outputs.wheel }}
1016
container:
11-
image: danielflook/python-minifier-build:python3.11-2022-10-25
17+
image: danielflook/python-minifier-build:python3.12-2024-01-12
1218
steps:
1319
- name: Checkout
1420
uses: actions/checkout@v3
1521
with:
1622
fetch-depth: 0
23+
show-progress: false
1724

1825
- name: Set version statically
1926
run: |
20-
VERSION="$(python3 setup.py --version)"
27+
pip3 install setuptools_scm
28+
VERSION="$(python3 -m setuptools_scm)"
2129
sed -i "s/setup_requires=.*/version='$VERSION',/; s/use_scm_version=.*//" setup.py
2230
2331
- name: Create Packages
32+
id: package
2433
run: |
25-
pip3 install --upgrade setuptools wheel twine
26-
python3 setup.py sdist bdist_wheel --universal
34+
pip3 install --upgrade build
35+
python3 -m build
36+
37+
echo "sdist=$(find dist -name '*.tar.gz' -printf "%f\n")" >> "$GITHUB_OUTPUT"
38+
echo "wheel=$(find dist -name '*-py3-*.whl' -printf "%f\n")" >> "$GITHUB_OUTPUT"
2739
2840
- uses: actions/upload-artifact@v3
2941
with:
3042
name: dist
3143
path: dist/
3244
if-no-files-found: error
3345

34-
test_docs:
46+
package_python2:
47+
name: Create Python 2 Wheel
48+
runs-on: ubuntu-latest
49+
needs: [package_python3]
50+
outputs:
51+
wheel: ${{ steps.package.outputs.wheel }}
52+
container:
53+
image: danielflook/python-minifier-build:python2.7-2024-01-12
54+
steps:
55+
- uses: actions/download-artifact@v3
56+
with:
57+
name: dist
58+
path: dist/
59+
60+
- name: Build wheel
61+
id: package
62+
run: |
63+
dnf install -y findutils
64+
pip install --upgrade wheel
65+
pip wheel dist/${{ needs.package_python3.outputs.sdist }} -w dist
66+
echo "wheel=$(find dist -name '*-py2-*.whl' -printf "%f\n")" >> "$GITHUB_OUTPUT"
67+
68+
- uses: actions/upload-artifact@v3
69+
with:
70+
name: dist
71+
path: dist/
72+
if-no-files-found: error
73+
74+
documentation:
3575
name: Test Documentation
3676
runs-on: ubuntu-latest
37-
needs: [package]
77+
needs: [package_python3]
3878
container:
39-
image: danielflook/python-minifier-build:python3.11-2022-10-25
79+
image: danielflook/python-minifier-build:python3.12-2024-01-12
4080
steps:
4181
- uses: actions/download-artifact@v3
4282
with:
@@ -45,11 +85,14 @@ jobs:
4585

4686
- name: Install package
4787
run: |
48-
pip3 install dist/*.tar.gz
88+
pip3 install dist/${{needs.package_python3.outputs.sdist}}
4989
pyminify --version
5090
5191
- name: Checkout
5292
uses: actions/checkout@v3
93+
with:
94+
fetch-depth: 0
95+
show-progress: false
5396

5497
- name: Build documentation
5598
run: |
@@ -59,13 +102,14 @@ jobs:
59102
test_package:
60103
name: Test Package
61104
runs-on: ubuntu-latest
62-
needs: [package]
105+
needs: [package_python3, package_python2]
63106
strategy:
107+
fail-fast: false
64108
matrix:
65-
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
66-
package_type: [.tar.gz, .whl]
109+
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
110+
package_type: [sdist, wheel]
67111
container:
68-
image: danielflook/python-minifier-build:python${{ matrix.python }}-2022-10-25
112+
image: danielflook/python-minifier-build:python${{ matrix.python }}-2024-01-12
69113
steps:
70114
- uses: actions/download-artifact@v3
71115
with:
@@ -74,11 +118,21 @@ jobs:
74118

75119
- name: Install package
76120
run: |
77-
pip${{ matrix.python }} install dist/*${{ matrix.package_type }}
121+
if [[ "${{ matrix.package_type }}" == "sdist" ]]; then
122+
pip${{ matrix.python }} install dist/${{needs.package_python3.outputs.sdist}}
123+
elif [[ "${{ matrix.python }}" == "2.7" ]]; then
124+
pip${{ matrix.python }} install dist/${{needs.package_python2.outputs.wheel}}
125+
else
126+
pip${{ matrix.python }} install dist/${{needs.package_python3.outputs.wheel}}
127+
fi
128+
78129
pyminify --version
79130
80131
- name: Checkout
81132
uses: actions/checkout@v3
133+
with:
134+
fetch-depth: 0
135+
show-progress: false
82136

83137
- name: Test pyminify
84138
run: |
@@ -90,12 +144,12 @@ jobs:
90144
91145
test_typing:
92146
runs-on: ubuntu-latest
93-
needs: [package]
147+
needs: [package_python3]
94148
strategy:
95149
matrix:
96-
package_type: [.tar.gz, .whl]
150+
package_type: [sdist, wheel]
97151
container:
98-
image: danielflook/python-minifier-build:python3.11-2022-10-25
152+
image: danielflook/python-minifier-build:python3.12-2024-01-12
99153
steps:
100154
- uses: actions/download-artifact@v3
101155
with:
@@ -104,19 +158,26 @@ jobs:
104158

105159
- name: Install package
106160
run: |
107-
pip3.11 install dist/*${{ matrix.package_type }}
161+
if [[ "${{ matrix.package_type }}" == "sdist" ]]; then
162+
pip3.12 install dist/${{needs.package_python3.outputs.sdist}}
163+
else
164+
pip3.12 install dist/${{needs.package_python3.outputs.wheel}}
165+
fi
108166
109167
- name: Checkout
110168
uses: actions/checkout@v3
169+
with:
170+
fetch-depth: 0
171+
show-progress: false
111172

112173
- name: Test typing
113174
run: |
114-
pip3.11 install mypy types-setuptools
175+
pip3.12 install mypy types-setuptools
115176
mypy --strict typing_test/test_typing.py
116177
117178
if mypy --strict typing_test/test_badtyping.py; then
118179
echo "Bad types weren't detected"
119180
exit 1
120181
fi
121182
122-
stubtest python_minifier
183+
stubtest python_minifier --allowlist typing_test/stubtest-allowlist.txt

.github/workflows/test.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Unit Test
22

33
on: [push]
44

5+
env:
6+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
7+
58
jobs:
69

710
test:
@@ -10,9 +13,9 @@ jobs:
1013
strategy:
1114
fail-fast: false
1215
matrix:
13-
python: ["python2.7", "python3.3", "python3.4", "python3.5", "python3.6", "python3.7", "python3.8", "python3.9", "python3.10", "python3.11", "pypy", "pypy3"]
16+
python: ["python2.7", "python3.3", "python3.4", "python3.5", "python3.6", "python3.7", "python3.8", "python3.9", "python3.10", "python3.11", "python3.12", "pypy", "pypy3"]
1417
container:
15-
image: danielflook/python-minifier-build:${{ matrix.python }}-2022-10-25
18+
image: danielflook/python-minifier-build:${{ matrix.python }}-2024-01-12
1619
steps:
1720
- name: Checkout
1821
uses: actions/checkout@v3

.github/workflows/test_corpus.yaml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,20 @@ on:
3434
required: false
3535
default: false
3636

37+
env:
38+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
39+
3740
jobs:
3841
generate_results:
3942
name: Minify Corpus
4043
runs-on: self-hosted
4144
strategy:
4245
fail-fast: false
4346
matrix:
44-
python: ["python2.7", "python3.3", "python3.4", "python3.5", "python3.6", "python3.7", "python3.8", "python3.9", "python3.10", "python3.11"]
47+
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
4548
ref: ["${{ inputs.ref }}", "${{ inputs.base-ref }}"]
4649
container:
47-
image: danielflook/python-minifier-build:${{ matrix.python }}-2022-10-25
50+
image: danielflook/python-minifier-build:python${{ matrix.python }}-2024-01-12
4851
volumes:
4952
- /corpus:/corpus
5053
- /corpus-results:/corpus-results
@@ -64,31 +67,43 @@ jobs:
6467
path: python-minifier
6568

6669
- name: Install ref
70+
id: install
6771
run: |
6872
set -ex
6973
(cd python-minifier && git log --pretty=format:'%H' -n 1) > sha.txt
7074
cat sha.txt
7175
VERSION=0.0.0
7276
sed -i "s/setup_requires=.*/version='$VERSION',/; s/use_scm_version=.*//" python-minifier/setup.py
73-
(cd python-minifier && ${{matrix.python}} setup.py install)
77+
78+
if ! pip${{ matrix.python }} install python-minifier/ 2>stderr.log; then
79+
echo stderr.log
80+
81+
if grep -q -E 'require a different python version|requires a different Python' stderr.log; then
82+
echo "${{ matrix.ref }} doesn't support Python ${{ matrix.python }}. Skipping."
83+
echo "skip=true" >> "$GITHUB_OUTPUT"
84+
else
85+
exit 1
86+
fi
87+
fi
7488
7589
- name: Run tests
90+
if: steps.install.outputs.skip != 'true'
7691
run: |
77-
if [[ "${{ matrix.python }}" == "python3.3" || "${{ matrix.python }}" == "python3.4" || "${{ matrix.python }}" == "python3.5" ]]; then
92+
if [[ "${{ matrix.python }}" == "3.3" || "${{ matrix.python }}" == "3.4" || "${{ matrix.python }}" == "3.5" ]]; then
7893
# These versions randomise the hash seed, but don't preserve dict order
7994
# This affects how names are assigned. Disable the hash randomisation for
8095
# deterministic results.
8196
export PYTHONHASHSEED=0
8297
fi
8398
84-
${{matrix.python}} workflow/corpus_test/generate_results.py /corpus /corpus-results $(<sha.txt) ${{ inputs.regenerate-results }}
99+
python${{matrix.python}} workflow/corpus_test/generate_results.py /corpus /corpus-results $(<sha.txt) ${{ inputs.regenerate-results }}
85100
86101
generate_report:
87102
name: Generate Report
88103
needs: generate_results
89104
runs-on: self-hosted
90105
container:
91-
image: danielflook/python-minifier-build:python3.11-2022-10-25
106+
image: danielflook/python-minifier-build:python3.12-2024-01-12
92107
volumes:
93108
- /corpus-results:/corpus-results
94109
if: ${{ always() }}
@@ -125,4 +140,4 @@ jobs:
125140
126141
- name: Generate Report
127142
run: |
128-
python3.11 workflow/corpus_test/generate_report.py /corpus-results ${{ inputs.ref }} $(<sha.txt) ${{ inputs.base-ref }} $(<base-sha.txt) >> $GITHUB_STEP_SUMMARY
143+
python3.12 workflow/corpus_test/generate_report.py /corpus-results ${{ inputs.ref }} $(<sha.txt) ${{ inputs.base-ref }} $(<base-sha.txt) >> $GITHUB_STEP_SUMMARY

.github/workflows/verify_release.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ on:
88
required: true
99
type: string
1010

11+
env:
12+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
13+
1114
jobs:
1215
test_package:
1316
runs-on: ubuntu-latest
1417
strategy:
1518
matrix:
16-
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
19+
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
1720
container:
18-
image: danielflook/python-minifier-build:python${{ matrix.python }}-2022-10-25
21+
image: danielflook/python-minifier-build:python${{ matrix.python }}-2024-01-12
1922
steps:
2023
- name: Test
2124
run: |

.github/workflows/xtest.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Regression Test
22

33
on: [pull_request]
44

5+
env:
6+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
7+
58
jobs:
69

710
test:
@@ -10,10 +13,15 @@ jobs:
1013
strategy:
1114
fail-fast: false
1215
matrix:
13-
python: ["python2.7", "python3.3", "python3.4", "python3.5", "python3.6", "python3.7", "python3.8", "python3.9", "python3.10", "python3.11", "pypy3"]
16+
python: ["python2.7", "python3.3", "python3.4", "python3.5", "python3.6", "python3.7", "python3.8", "python3.9", "python3.10", "python3.11", "python3.12", "pypy3"]
1417
container:
15-
image: danielflook/python-minifier-build:${{ matrix.python }}-2022-10-25
18+
image: danielflook/python-minifier-build:${{ matrix.python }}-2024-01-12
1619
steps:
20+
- name: Cleanup
21+
run: |
22+
echo rm -vrf "$HOME/.*" "$HOME/*" "$GITHUB_WORKSPACE/.*" "$GITHUB_WORKSPACE/*"
23+
rm -vrf "$HOME/.*" "$HOME/*" "$GITHUB_WORKSPACE/.*" "$GITHUB_WORKSPACE/*"
24+
1725
- name: Checkout
1826
uses: actions/checkout@v3
1927
with:
@@ -35,7 +43,7 @@ jobs:
3543
(cd /usr/lib64/pypy3-7.0/lib-python/3/test && pypy3 make_ssl_certs.py)
3644
fi
3745
38-
tox -r -e $(echo "${{ matrix.python }}" | tr -d .) xtest
46+
tox -r -e $(echo "${{ matrix.python }}" | tr -d .) -- xtest
3947
4048
test-corpus:
4149
needs: test

0 commit comments

Comments
 (0)