sigh #442
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Test | |
on: [push] | |
jobs: | |
package_python3: | |
name: Create sdist and Python 3 Wheel | |
runs-on: ubuntu-latest | |
outputs: | |
sdist: ${{ steps.package.outputs.sdist }} | |
wheel: ${{ steps.package.outputs.wheel }} | |
container: | |
image: danielflook/python-minifier-build:python3.13-2024-09-15 | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 1 | |
show-progress: false | |
- name: Fetch tags | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
git fetch --tags --force | |
- name: Set version statically | |
run: | | |
pip3 install setuptools_scm | |
VERSION="$(python3 -m setuptools_scm)" | |
sed -i "s/setup_requires=.*/version='$VERSION',/; s/use_scm_version=.*//" setup.py | |
echo "Version: $VERSION" | |
- name: Build distribution packages | |
id: package | |
run: | | |
pip3 install --upgrade build | |
python3 -m build | |
echo "sdist=$(find dist -name '*.tar.gz' -printf "%f\n")" >> "$GITHUB_OUTPUT" | |
echo "wheel=$(find dist -name '*-py3-*.whl' -printf "%f\n")" >> "$GITHUB_OUTPUT" | |
- name: Upload sdist artifact | |
uses: actions/[email protected] | |
with: | |
name: dist-sdist | |
path: dist/${{ steps.package.outputs.sdist }} | |
if-no-files-found: error | |
- name: Upload Python 3 wheel artifact | |
uses: actions/[email protected] | |
with: | |
name: dist-py3-wheel | |
path: dist/${{ steps.package.outputs.wheel }} | |
if-no-files-found: error | |
package_python2: | |
name: Create Python 2 Wheel | |
runs-on: ubuntu-latest | |
needs: [package_python3] | |
outputs: | |
wheel: ${{ steps.package.outputs.wheel }} | |
container: | |
image: danielflook/python-minifier-build:python2.7-2024-09-15 | |
steps: | |
- name: Download source distribution artifact | |
uses: actions/[email protected] | |
with: | |
name: dist-sdist | |
path: dist/ | |
- name: Build Python 2 wheel | |
id: package | |
env: | |
PYTHON3_SDIST: ${{ needs.package_python3.outputs.sdist }} | |
run: | | |
dnf install -y findutils | |
pip install --upgrade wheel | |
pip wheel "dist/$PYTHON3_SDIST" -w dist | |
echo "wheel=$(find dist -name '*-py2-*.whl' -printf "%f\n")" >> "$GITHUB_OUTPUT" | |
- name: Upload Python 2 wheel artifact | |
uses: actions/[email protected] | |
with: | |
name: dist-py2-wheel | |
path: dist/${{ steps.package.outputs.wheel }} | |
if-no-files-found: error | |
documentation: | |
name: Test Documentation | |
runs-on: ubuntu-latest | |
needs: [package_python3] | |
container: | |
image: danielflook/python-minifier-build:python3.13-2024-09-15 | |
steps: | |
- uses: actions/[email protected] | |
with: | |
name: dist-sdist | |
path: dist/ | |
- name: Install package | |
env: | |
PYTHON3_SDIST: ${{ needs.package_python3.outputs.sdist }} | |
run: | | |
pip3 install "dist/$PYTHON3_SDIST" | |
pyminify --version | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 1 | |
fetch-tags: true | |
show-progress: false | |
persist-credentials: false | |
- name: Build documentation | |
run: | | |
pip3 install sphinx sphinxcontrib-programoutput sphinx_rtd_theme | |
sphinx-build docs/source /tmp/build | |
test_package: | |
name: Test Package | |
runs-on: ubuntu-latest | |
needs: [package_python3, package_python2] | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
package_type: [sdist, wheel] | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 1 | |
fetch-tags: true | |
show-progress: false | |
persist-credentials: false | |
- name: Download distribution artifacts | |
uses: actions/[email protected] | |
with: | |
pattern: dist-* | |
path: dist/ | |
merge-multiple: true | |
- name: Test | |
uses: ./.github/actions/run-in-container | |
with: | |
image: danielflook/python-minifier-build:python${{ matrix.python }}-2024-09-15 | |
run: | | |
if [[ "${{ matrix.package_type }}" == "sdist" ]]; then | |
pip${{ matrix.python }} install dist/${{needs.package_python3.outputs.sdist}} | |
elif [[ "${{ matrix.python }}" == "2.7" ]]; then | |
pip${{ matrix.python }} install dist/${{needs.package_python2.outputs.wheel}} | |
else | |
pip${{ matrix.python }} install dist/${{needs.package_python3.outputs.wheel}} | |
fi | |
pyminify --version | |
set -x | |
cat setup.py | pyminify - | |
pyminify setup.py > /tmp/out.min.py | |
pyminify setup.py --output /tmp/out.min.py2 | |
pyminify setup.py src test --in-place | |
test_typing: | |
name: Test Typing | |
runs-on: ubuntu-latest | |
needs: [package_python3] | |
strategy: | |
matrix: | |
package_type: [sdist, wheel] | |
container: | |
image: danielflook/python-minifier-build:python3.13-2024-09-15 | |
steps: | |
- name: Download distribution artifacts | |
uses: actions/[email protected] | |
with: | |
pattern: dist-* | |
path: dist/ | |
merge-multiple: true | |
- name: Install package | |
env: | |
PYTHON3_SDIST: ${{ needs.package_python3.outputs.sdist }} | |
PYTHON3_WHEEL: ${{ needs.package_python3.outputs.wheel }} | |
run: | | |
if [[ "${{ matrix.package_type }}" == "sdist" ]]; then | |
pip3.13 install "dist/$PYTHON3_SDIST" | |
else | |
pip3.13 install "dist/$PYTHON3_WHEEL" | |
fi | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 1 | |
fetch-tags: true | |
show-progress: false | |
persist-credentials: false | |
- name: Test typing | |
run: | | |
pip3.13 install 'mypy<1.12.0' types-setuptools | |
mypy --strict typing_test/test_typing.py | |
if mypy --strict typing_test/test_badtyping.py; then | |
echo "Bad types weren't detected" | |
exit 1 | |
fi | |
stubtest python_minifier --allowlist typing_test/stubtest-allowlist.txt |