Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 173 additions & 0 deletions Build_wheels_for_cpython39_x86.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
name: Build wheels for CPython3.9 x86

on: [push, pull_request]

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || '' }}
cancel-in-progress: true

jobs:
build_wheels:
name: Build wheel - ${{ matrix.os.name }}
runs-on: ${{ matrix.os.runs-on }}
strategy:
fail-fast: false
matrix:
os:
- name: Ubuntu 24+16 i386 CPython 3.9
runs-on: ubuntu-latest
matrix: linux
arch: i386
tag_arch: i686
release: xenial
mirror: http://azure.archive.ubuntu.com/ubuntu
version: 1.5.6.3
pyver: "3.9"
getpipurl: https://bootstrap.pypa.io/pip/get-pip.py
pypkg: python3.9
pypkgadd: python3.9-distutils
pyengine_tag: cp39-cp39
libc_tag: manylinux_2_17
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Update and upgrade Ubuntu 24
if: matrix.os.matrix == 'linux'
run: |
sudo which apt
sudo apt update;
sudo apt purge -y firefox lxd snapd;
sudo apt install -y zram-config;
sudo apt list --upgradable;
sudo apt upgrade -y;
sudo apt install -f

- name: Build source distribution with Ubuntu
if: matrix.os.matrix == 'linux'
run: |
sudo apt install -y devscripts debootstrap qemu-user;
pip install build;
python -m build --sdist --outdir dist .

- name: Debootstrap Ubuntu ${{matrix.os.release}} ${{matrix.os.arch}}
if: matrix.os.matrix == 'linux'
run: |
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

- name: Update and Upgrade Ubuntu ${{matrix.os.release}}
if: matrix.os.matrix == 'linux'
run: |
sudo mkdir -p ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel
sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/proc -t proc
sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/dev/pts -t devpts
sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/sys -t sysfs
echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/python ubuntu-${{matrix.os.release}} main" > rusoft-python.list
echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/backports ubuntu-${{matrix.os.release}} main" > rusoft-backports.list
echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/packages ubuntu-${{matrix.os.release}} main" > rusoft-packages.list
echo " deb [trusted=yes] http://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu ${{matrix.os.release}} main" > deadsnakes.list
sudo find ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} -iname apt
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt update
sudo cp -v ./*.list ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/etc/apt/sources.list.d
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
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'
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'
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'
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt update
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt upgrade -y
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt -fy install
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt upgrade -y


- name: Pepare dev files
if: matrix.os.matrix == 'linux'
run: |
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt install -y libzstd-dev

- name: Pepare for ${{matrix.os.pypkg}} ${{matrix.os.arch}}
if: matrix.os.matrix == 'linux'
run: |
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt install -y ${{matrix.os.pypkg}}-dev gcc pkg-config ${{matrix.os.pypkgadd}}
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"
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "${{matrix.os.pypkg}} -m pip install -U 'setuptools<72.0'"
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "${{matrix.os.pypkg}} -m pip install -U pkginfo"


- name: Pepare source and build wheel for ${{matrix.os.pypkg}} ${{matrix.os.arch}}
if: matrix.os.matrix == 'linux'
run: |
sudo mkdir -p ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/
sudo tar -xvf dist/zstd-${{matrix.os.version}}.tar.gz -C ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/
false && sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} env
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} pkg-config libzstd --modversion
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"

- name: Test wheel for ${{matrix.os.pypkg}} ${{matrix.os.arch}}
if: matrix.os.matrix == 'linux'
run: |
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"

- name: Pepare wheel for upload
if: matrix.os.matrix == 'linux'
run: |
sudo cp -v ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/zstd-${{matrix.os.version}}/dist/* ./dist
sudo ls -lh ./dist/*
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"
sudo rm -vf ./dist/*.tar.gz


# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: wheels
#. path: ./dist
# compression-level: 0

- name: Test for secrets access
id: check_secrets
# If a third party makes a pull request
# this allows automated steps below to be skipped
# and leave a clean PR CI run
shell: bash
run: |
unset HAS_SECRET
unset HAS_SECRET_TEST
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
if [ -n "$SECRET_TEST" ]; then HAS_SECRET_TEST='true' ; fi
echo ::set-output name=HAS_SECRET::${HAS_SECRET}
echo ::set-output name=HAS_SECRET_TEST::${HAS_SECRET_TEST}
env:
SECRET: "${{ secrets.pypi_password }}"
SECRET_TEST: "${{ secrets.test_pypi_password }}"

- name: Install twine
run: pip install 'twine<=6.0.1'

- name: Publish distribution to PyPI
if: >
startsWith(github.event.ref, 'refs/tags') &&
steps.check_secrets.outputs.HAS_SECRET
env:
# If the PR/Push has secret access
# and PYPI_PASSWORD is in GH Secrets for this repo
# and this is a tag, publish to PyPI
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
TWINE_USERNAME: "${{ secrets.pypi_username }}"
TWINE_NON_INTERACTIVE: 1
TWINE_PASSWORD: "${{ secrets.pypi_password }}"
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'

- name: Publish distribution to Test PyPI
if: steps.check_secrets.outputs.HAS_SECRET
env:
# If the PR/Push has secret access
# and TEST_PYPI_PASSWORD is in GH Secrets for this repo
# then publish each build to test PyPI
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
TWINE_USERNAME: "${{ secrets.test_pypi_username }}"
TWINE_NON_INTERACTIVE: 1
TWINE_PASSWORD: "${{ secrets.test_pypi_password }}"
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'

65 changes: 65 additions & 0 deletions glibc-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

# This scripts lets you check which minimum GLIBC version an executable requires.
# Simply run './glibc-check.sh path/to/your/binary'
#
# You can set `MAX_VER` however low you want, although I (fasterthanlime)
# feel like `2.13` is a good target (For reference, Ubuntu 12.04 has GLIBC 2.15)
MAX_VER=2.13

SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
BINARY=$1

# Version comparison function in bash
vercomp () {
if [[ $1 == $2 ]]
then
return 0
fi
local IFS=.
local i ver1=($1) ver2=($2)
# fill empty fields in ver1 with zeros
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
do
ver1[i]=0
done
for ((i=0; i<${#ver1[@]}; i++))
do
if [[ -z ${ver2[i]} ]]
then
# fill empty fields in ver2 with zeros
ver2[i]=0
fi
if ((10#${ver1[i]} > 10#${ver2[i]}))
then
return 1
fi
if ((10#${ver1[i]} < 10#${ver2[i]}))
then
return 2
fi
done
return 0
}

IFS="
"
VERS=$(objdump -T $BINARY | grep GLIBC | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -u)

for VER in $VERS; do
vercomp $VER $MAX_VER
COMP=$?
if [[ $COMP -eq 1 ]]; then
echo "Error! ${BINARY} requests GLIBC ${VER}, which is higher than target ${MAX_VER}"
echo "Affected symbols:"
objdump -T $BINARY | grep GLIBC_${VER}
echo "Looking for symbols in libraries..."
for LIBRARY in $(ldd $BINARY | cut -d ' ' -f 3); do
echo $LIBRARY
objdump -T $LIBRARY | fgrep GLIBC_${VER}
done
exit 27
else
echo "Found version ${VER}"
fi
done
Loading