|
| 1 | +name: Build wheels for CPython3.9 x86 |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +concurrency: |
| 6 | + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || '' }} |
| 7 | + cancel-in-progress: true |
| 8 | + |
| 9 | +jobs: |
| 10 | + build_wheels: |
| 11 | + name: Build wheel - ${{ matrix.os.name }} |
| 12 | + runs-on: ${{ matrix.os.runs-on }} |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + os: |
| 17 | + - name: Ubuntu 24+16 i386 CPython 3.9 |
| 18 | + runs-on: ubuntu-latest |
| 19 | + matrix: linux |
| 20 | + arch: i386 |
| 21 | + tag_arch: i686 |
| 22 | + release: xenial |
| 23 | + mirror: http://azure.archive.ubuntu.com/ubuntu |
| 24 | + version: 1.5.6.3 |
| 25 | + pyver: "3.9" |
| 26 | + getpipurl: https://bootstrap.pypa.io/pip/get-pip.py |
| 27 | + pypkg: python3.9 |
| 28 | + pypkgadd: python3.9-distutils |
| 29 | + pyengine_tag: cp39-cp39 |
| 30 | + libc_tag: manylinux_2_17 |
| 31 | + steps: |
| 32 | + - name: Checkout code |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + submodules: 'recursive' |
| 36 | + |
| 37 | + - name: Update and upgrade Ubuntu 24 |
| 38 | + if: matrix.os.matrix == 'linux' |
| 39 | + run: | |
| 40 | + sudo which apt |
| 41 | + sudo apt update; |
| 42 | + sudo apt purge -y firefox lxd snapd; |
| 43 | + sudo apt install -y zram-config; |
| 44 | + sudo apt list --upgradable; |
| 45 | + sudo apt upgrade -y; |
| 46 | + sudo apt install -f |
| 47 | +
|
| 48 | + - name: Build source distribution with Ubuntu |
| 49 | + if: matrix.os.matrix == 'linux' |
| 50 | + run: | |
| 51 | + sudo apt install -y devscripts debootstrap qemu-user; |
| 52 | + pip install build; |
| 53 | + python -m build --sdist --outdir dist . |
| 54 | + |
| 55 | + - name: Debootstrap Ubuntu ${{matrix.os.release}} ${{matrix.os.arch}} |
| 56 | + if: matrix.os.matrix == 'linux' |
| 57 | + run: | |
| 58 | + sudo debootstrap --no-merged-usr --verbose --include=sudo,wget,curl,ca-certificates --arch=${{matrix.os.arch}} ${{matrix.os.release}} ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} ${{matrix.os.mirror}} || tail ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/debootstrap/debootstrap.log |
| 59 | + |
| 60 | + - name: Update and Upgrade Ubuntu ${{matrix.os.release}} |
| 61 | + if: matrix.os.matrix == 'linux' |
| 62 | + run: | |
| 63 | + sudo mkdir -p ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel |
| 64 | + sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/proc -t proc |
| 65 | + sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/dev/pts -t devpts |
| 66 | + sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/sys -t sysfs |
| 67 | + echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/python ubuntu-${{matrix.os.release}} main" > rusoft-python.list |
| 68 | + echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/backports ubuntu-${{matrix.os.release}} main" > rusoft-backports.list |
| 69 | + echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/packages ubuntu-${{matrix.os.release}} main" > rusoft-packages.list |
| 70 | + echo " deb [trusted=yes] http://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu ${{matrix.os.release}} main" > deadsnakes.list |
| 71 | + sudo find ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} -iname apt |
| 72 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt update |
| 73 | + sudo cp -v ./*.list ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/etc/apt/sources.list.d |
| 74 | + false && sudo rm -fv ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/etc/apt/trusted.gpg.d/* && sudo rm -fv ./ubuntu-xenial-x86/etc/apt/trusted.gpg |
| 75 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c 'cd /etc/apt/trusted.gpg.d && wget http://packages.rusoft.ru/apt/public.gpg -Orusoft.gpg' |
| 76 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c 'cd /etc/apt/trusted.gpg.d && wget http://packages.rusoft.ru/apt/public-old.gpg -Orusoft-old.gpg' |
| 77 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c 'apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys A2CE4BCCC50209DD || true' |
| 78 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt update |
| 79 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt upgrade -y |
| 80 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt -fy install |
| 81 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt upgrade -y |
| 82 | + |
| 83 | + |
| 84 | + - name: Pepare dev files |
| 85 | + if: matrix.os.matrix == 'linux' |
| 86 | + run: | |
| 87 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt install -y libzstd-dev |
| 88 | +
|
| 89 | + - name: Pepare for ${{matrix.os.pypkg}} ${{matrix.os.arch}} |
| 90 | + if: matrix.os.matrix == 'linux' |
| 91 | + run: | |
| 92 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt install -y ${{matrix.os.pypkg}}-dev gcc pkg-config ${{matrix.os.pypkgadd}} |
| 93 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "wget ${{matrix.os.getpipurl}} -O get-pip.py && ${{matrix.os.pypkg}} get-pip.py || true" |
| 94 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "${{matrix.os.pypkg}} -m pip install -U 'setuptools<72.0'" |
| 95 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "${{matrix.os.pypkg}} -m pip install -U pkginfo" |
| 96 | + |
| 97 | + |
| 98 | + - name: Pepare source and build wheel for ${{matrix.os.pypkg}} ${{matrix.os.arch}} |
| 99 | + if: matrix.os.matrix == 'linux' |
| 100 | + run: | |
| 101 | + sudo mkdir -p ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/ |
| 102 | + sudo tar -xvf dist/zstd-${{matrix.os.version}}.tar.gz -C ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/ |
| 103 | + false && sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} env |
| 104 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} pkg-config libzstd --modversion |
| 105 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "cd /build_wheel/zstd-${{matrix.os.version}} && ZSTD_ASM=1 _ZSTD_ASM_BMI2=1 ZSTD_THREADS=1 _ZSTD_EXTERNAL=0 python${{matrix.os.pyver}} setup.py bdist_wheel clean" |
| 106 | +
|
| 107 | + - name: Test wheel for ${{matrix.os.pypkg}} ${{matrix.os.arch}} |
| 108 | + if: matrix.os.matrix == 'linux' |
| 109 | + run: | |
| 110 | + sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "cd /build_wheel/zstd-${{matrix.os.version}} && python${{matrix.os.pyver}} setup.py test" |
| 111 | +
|
| 112 | + - name: Pepare wheel for upload |
| 113 | + if: matrix.os.matrix == 'linux' |
| 114 | + run: | |
| 115 | + sudo cp -v ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/zstd-${{matrix.os.version}}/dist/* ./dist |
| 116 | + sudo ls -lh ./dist/* |
| 117 | + sudo mv -v ./dist/"zstd-${{matrix.os.version}}-${{matrix.os.pyengine_tag}}-linux_${{matrix.os.tag_arch}}.whl" ./dist/"zstd-${{matrix.os.version}}-${{matrix.os.pyengine_tag}}-${{matrix.os.libc_tag}}_${{matrix.os.tag_arch}}.whl" |
| 118 | + sudo rm -vf ./dist/*.tar.gz |
| 119 | + |
| 120 | + |
| 121 | +# - name: Upload artifacts |
| 122 | +# uses: actions/upload-artifact@v4 |
| 123 | +# with: |
| 124 | +# name: wheels |
| 125 | +#. path: ./dist |
| 126 | +# compression-level: 0 |
| 127 | + |
| 128 | + - name: Test for secrets access |
| 129 | + id: check_secrets |
| 130 | + # If a third party makes a pull request |
| 131 | + # this allows automated steps below to be skipped |
| 132 | + # and leave a clean PR CI run |
| 133 | + shell: bash |
| 134 | + run: | |
| 135 | + unset HAS_SECRET |
| 136 | + unset HAS_SECRET_TEST |
| 137 | + if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi |
| 138 | + if [ -n "$SECRET_TEST" ]; then HAS_SECRET_TEST='true' ; fi |
| 139 | + echo ::set-output name=HAS_SECRET::${HAS_SECRET} |
| 140 | + echo ::set-output name=HAS_SECRET_TEST::${HAS_SECRET_TEST} |
| 141 | + env: |
| 142 | + SECRET: "${{ secrets.pypi_password }}" |
| 143 | + SECRET_TEST: "${{ secrets.test_pypi_password }}" |
| 144 | + |
| 145 | + - name: Install twine |
| 146 | + run: pip install 'twine<=6.0.1' |
| 147 | + |
| 148 | + - name: Publish distribution to PyPI |
| 149 | + if: > |
| 150 | + startsWith(github.event.ref, 'refs/tags') && |
| 151 | + steps.check_secrets.outputs.HAS_SECRET |
| 152 | + env: |
| 153 | + # If the PR/Push has secret access |
| 154 | + # and PYPI_PASSWORD is in GH Secrets for this repo |
| 155 | + # and this is a tag, publish to PyPI |
| 156 | + TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/ |
| 157 | + TWINE_USERNAME: "${{ secrets.pypi_username }}" |
| 158 | + TWINE_NON_INTERACTIVE: 1 |
| 159 | + TWINE_PASSWORD: "${{ secrets.pypi_password }}" |
| 160 | + run: twine upload --non-interactive --skip-existing --verbose 'dist/*' |
| 161 | + |
| 162 | + - name: Publish distribution to Test PyPI |
| 163 | + if: steps.check_secrets.outputs.HAS_SECRET |
| 164 | + env: |
| 165 | + # If the PR/Push has secret access |
| 166 | + # and TEST_PYPI_PASSWORD is in GH Secrets for this repo |
| 167 | + # then publish each build to test PyPI |
| 168 | + TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ |
| 169 | + TWINE_USERNAME: "${{ secrets.test_pypi_username }}" |
| 170 | + TWINE_NON_INTERACTIVE: 1 |
| 171 | + TWINE_PASSWORD: "${{ secrets.test_pypi_password }}" |
| 172 | + run: twine upload --non-interactive --skip-existing --verbose 'dist/*' |
| 173 | + |
0 commit comments