Skip to content

Commit df32749

Browse files
Create Build_wheels_for_cpython27_x86_64.yml
1 parent 6756b0c commit df32749

File tree

1 file changed

+246
-0
lines changed

1 file changed

+246
-0
lines changed
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
name: Build wheels w/o cibw for CPython2.7 x86_64
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 2.7
18+
runs-on: ubuntu-latest
19+
matrix: linux
20+
arch: amd64
21+
tag_arch: x86_64
22+
release: xenial
23+
mirror: http://azure.archive.ubuntu.com/ubuntu
24+
version: 1.5.6.3
25+
pyver: "2.7"
26+
getpipurl: https://bootstrap.pypa.io/pip/2.7/get-pip.py
27+
pypkg: python2.7
28+
pyengine_tag: cp27-cp27mu
29+
libc_tag: manylinux_2_17
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
with:
34+
submodules: 'recursive'
35+
36+
- uses: actions/setup-python@v5
37+
name: Install Python
38+
with:
39+
python-version: '3.12'
40+
41+
- name: Prepare python
42+
run: |
43+
python -m pip install --upgrade pip
44+
45+
- name: Set up QEMU
46+
if: matrix.os.matrix == 'linux'
47+
uses: docker/setup-qemu-action@v1
48+
with:
49+
platforms: 'arm64'
50+
51+
- name: Update and upgrade Ubuntu 24
52+
if: matrix.os.matrix == 'linux'
53+
run: |
54+
sudo which apt
55+
sudo apt update;
56+
sudo apt purge -y firefox lxd snapd;
57+
sudo apt install -y zram-config;
58+
sudo apt list --upgradable;
59+
sudo apt upgrade -y;
60+
sudo apt install -f
61+
62+
- name: Build source distribution with Ubuntu
63+
if: matrix.os.matrix == 'linux'
64+
run: |
65+
sudo apt install -y devscripts debootstrap qemu-user;
66+
pip install build;
67+
python -m build --sdist --outdir dist .
68+
69+
- name: Debootstrap Ubuntu ${{matrix.os.release}} ${{matrix.os.arch}}
70+
if: matrix.os.matrix == 'linux'
71+
run: |
72+
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
73+
74+
- name: Update and Upgrade Ubuntu ${{matrix.os.release}}
75+
if: matrix.os.matrix == 'linux'
76+
run: |
77+
sudo mkdir -p ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel
78+
sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/proc -t proc
79+
sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/dev/pts -t devpts
80+
sudo mount none ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/sys -t sysfs
81+
echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/python ubuntu-${{matrix.os.release}} main" > rusoft-python.list
82+
echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/backports ubuntu-${{matrix.os.release}} main" > rusoft-backports.list
83+
echo " deb [trusted=yes] http://packages.rusoft.ru/ppa/rusoft/packages ubuntu-${{matrix.os.release}} main" > rusoft-packages.list
84+
echo " deb [trusted=yes] http://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu ${{matrix.os.release}} main" > deadsnakes.list
85+
sudo find ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} -iname apt
86+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt update
87+
sudo cp -v ./*.list ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/etc/apt/sources.list.d
88+
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
89+
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'
90+
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'
91+
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'
92+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt update
93+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt upgrade -y
94+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt -fy install
95+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt upgrade -y
96+
97+
98+
- name: Pepare dev files
99+
if: matrix.os.matrix == 'linux'
100+
run: |
101+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt install -y libzstd-dev
102+
103+
- name: Pepare for ${{matrix.os.pypkg}} ${{matrix.os.arch}}
104+
if: matrix.os.matrix == 'linux'
105+
run: |
106+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /usr/bin/apt install -y ${{matrix.os.pypkg}}-dev gcc pkg-config ${{matrix.os.pypkgadd}}
107+
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"
108+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} /bin/bash -c "${{matrix.os.pypkg}} -m pip install -U 'setuptools<72.0'"
109+
110+
- name: Pepare source and build wheel for ${{matrix.os.pypkg}} ${{matrix.os.arch}}
111+
if: matrix.os.matrix == 'linux'
112+
run: |
113+
sudo mkdir -p ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/
114+
sudo tar -xvf dist/zstd-${{matrix.os.version}}.tar.gz -C ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/
115+
false && sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} env
116+
sudo chroot ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}} pkg-config libzstd --modversion
117+
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"
118+
119+
- name: Test wheel for ${{matrix.os.pypkg}} ${{matrix.os.arch}}
120+
if: matrix.os.matrix == 'linux'
121+
run: |
122+
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"
123+
124+
- name: Pepare wheel for upload
125+
if: matrix.os.matrix == 'linux'
126+
run: |
127+
sudo cp -v ./ubuntu-${{matrix.os.release}}-${{matrix.os.arch}}/build_wheel/zstd-${{matrix.os.version}}/dist/* ./dist
128+
sudo ls -lh ./dist/*
129+
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"
130+
sudo rm -vf ./dist/*.tar.gz
131+
132+
- name: Build ${{ matrix.os.name }} wheels and test (old)
133+
uses: pypa/cibuildwheel@v1.12.0
134+
if: matrix.cibw.group == 'old'
135+
with:
136+
output-dir: dist
137+
env:
138+
CIBW_BUILD: ${{ matrix.cibw.build }}
139+
# Skip 32-bit builds // NO
140+
# CIBW_SKIP: '*-win32 *_i686'
141+
CIBW_MANYLINUX_I686_IMAGE: manylinux1
142+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
143+
CIBW_MUSLLINUX_I686_IMAGE: musllinux_1_2
144+
CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2
145+
# Only build on x86 and arm64 for linux
146+
CIBW_ARCHS_LINUX: i686 x86_64
147+
CIBW_BEFORE_ALL_LINUX: >
148+
python -m pip install --upgrade pip
149+
# CIBW_ARCHS_MACOS: x86_64 arm64 universal2
150+
# Building two wheels for MacOS and skipping Universal
151+
CIBW_ARCHS_MACOS: x86_64
152+
# Skip testing Apple Silicon until there are GH runners
153+
CIBW_TEST_SKIP: '*_arm64 *_universal2:arm64'
154+
CIBW_BEFORE_ALL_MACOS: >
155+
python -m pip install --upgrade pip
156+
# CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.7
157+
CIBW_BUILD_VERBOSITY_MACOS: 0
158+
CIBW_BEFORE_ALL_WINDOWS: >
159+
python -m pip install --upgrade pip
160+
CIBW_TEST_COMMAND: >
161+
python -m unittest discover -v -s {package}
162+
163+
- name: Build ${{ matrix.os.name }} wheels and test (new)
164+
uses: joerick/cibuildwheel@v2.22.0
165+
if: matrix.cibw.group == 'new'
166+
with:
167+
output-dir: dist
168+
env:
169+
CIBW_BUILD: ${{ matrix.cibw.build }}
170+
# Skip 32-bit builds // NO
171+
# CIBW_SKIP: '*-win32 *_i686'
172+
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
173+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
174+
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
175+
CIBW_MUSLLINUX_I686_IMAGE: musllinux_1_1
176+
CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_1
177+
# Only build on x86 and arm64 for linux
178+
CIBW_ARCHS_LINUX: auto aarch64
179+
CIBW_BEFORE_ALL_LINUX: >
180+
python -m pip install --upgrade pip
181+
# CIBW_ARCHS_MACOS: x86_64 arm64 universal2
182+
# Building two wheels for MacOS and skipping Universal
183+
CIBW_ARCHS_MACOS: x86_64 arm64
184+
# Skip testing Apple Silicon until there are GH runners
185+
CIBW_TEST_SKIP: '*_arm64 *_universal2:arm64'
186+
CIBW_BEFORE_ALL_MACOS: >
187+
python -m pip install --upgrade pip
188+
# CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.7
189+
CIBW_BUILD_VERBOSITY_MACOS: 0
190+
CIBW_BEFORE_ALL_WINDOWS: >
191+
python -m pip install --upgrade pip
192+
CIBW_TEST_COMMAND: >
193+
python -m unittest discover -v -s {package}
194+
195+
# - name: Upload artifacts
196+
# uses: actions/upload-artifact@v4
197+
# with:
198+
# name: wheels
199+
#. path: ./dist
200+
# compression-level: 0
201+
202+
- name: Test for secrets access
203+
id: check_secrets
204+
# If a third party makes a pull request
205+
# this allows automated steps below to be skipped
206+
# and leave a clean PR CI run
207+
shell: bash
208+
run: |
209+
unset HAS_SECRET
210+
unset HAS_SECRET_TEST
211+
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
212+
if [ -n "$SECRET_TEST" ]; then HAS_SECRET_TEST='true' ; fi
213+
echo ::set-output name=HAS_SECRET::${HAS_SECRET}
214+
echo ::set-output name=HAS_SECRET_TEST::${HAS_SECRET_TEST}
215+
env:
216+
SECRET: "${{ secrets.pypi_password }}"
217+
SECRET_TEST: "${{ secrets.test_pypi_password }}"
218+
219+
- name: Install twine
220+
run: pip install twine
221+
222+
- name: Publish distribution to PyPI
223+
if: >
224+
startsWith(github.event.ref, 'refs/tags') &&
225+
steps.check_secrets.outputs.HAS_SECRET
226+
env:
227+
# If the PR/Push has secret access
228+
# and PYPI_PASSWORD is in GH Secrets for this repo
229+
# and this is a tag, publish to PyPI
230+
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
231+
TWINE_USERNAME: "${{ secrets.pypi_username }}"
232+
TWINE_NON_INTERACTIVE: 1
233+
TWINE_PASSWORD: "${{ secrets.pypi_password }}"
234+
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'
235+
236+
- name: Publish distribution to Test PyPI
237+
if: steps.check_secrets.outputs.HAS_SECRET
238+
env:
239+
# If the PR/Push has secret access
240+
# and TEST_PYPI_PASSWORD is in GH Secrets for this repo
241+
# then publish each build to test PyPI
242+
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
243+
TWINE_USERNAME: "${{ secrets.test_pypi_username }}"
244+
TWINE_NON_INTERACTIVE: 1
245+
TWINE_PASSWORD: "${{ secrets.test_pypi_password }}"
246+
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'

0 commit comments

Comments
 (0)