Skip to content

Commit 6b73033

Browse files
committed
pub-python-wheels: split workflow into pub/emu files
1 parent 132e78c commit 6b73033

2 files changed

Lines changed: 90 additions & 21 deletions

File tree

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# ┌─────────────────────────────────────────────────────────────────┐
2+
# │ IMPORTANT: This file MUST stay in sync with │
3+
# │ pub-python-wheels.yml. The only difference between the two │
4+
# │ files should be the cisco-actions/* mirror references. │
5+
# │ Do NOT accept PRs where these files diverge in any other way. │
6+
# └─────────────────────────────────────────────────────────────────┘
7+
name: "[EMU] Python Wheels"
8+
9+
on:
10+
workflow_dispatch:
11+
push:
12+
branches:
13+
- main
14+
15+
jobs:
16+
build-mercury-wheels:
17+
name: Build wheels on ${{ matrix.os }}
18+
runs-on: ${{ matrix.os }}
19+
environment:
20+
name: pypi
21+
url: https://pypi.org/p/mercury-python
22+
permissions:
23+
contents: read
24+
strategy:
25+
matrix:
26+
os: [ubuntu-latest, macos-latest]
27+
28+
steps:
29+
- uses: actions/checkout@v6
30+
with:
31+
fetch-depth: 1
32+
submodules: recursive
33+
34+
- name: Install packages (Linux)
35+
if: runner.os == 'Linux'
36+
run: sudo apt-get update && sudo apt-get install -y zlib1g-dev libssl-dev make libxsimd-dev
37+
38+
- name: Install packages (macOS)
39+
if: runner.os == 'macOS'
40+
run: brew install openssl zlib xsimd
41+
42+
- name: Set up Python
43+
uses: actions/setup-python@v6
44+
with:
45+
python-version: '3.x'
46+
47+
- name: Set up QEMU
48+
if: runner.os == 'Linux'
49+
uses: cisco-actions/docker-setup-qemu-action@v4.0.0
50+
with:
51+
platforms: all
52+
53+
- name: Install pip packages
54+
run: python -m pip install cython
55+
56+
- name: Build Mercury
57+
run: ./configure && make && cp -r src/cython/* ./
58+
59+
- name: Build wheels
60+
uses: cisco-actions/pypa-cibuildwheel@v3.4.0
61+
env:
62+
CIBW_ARCHS_LINUX: aarch64 x86_64
63+
CIBW_ARCHS_MACOS: arm64
64+
CIBW_SKIP: "*-musllinux_* pp* cp38* cp37* cp36*"
65+
CIBW_BEFORE_ALL_LINUX: (yum install -y epel-release && yum install -y openssl-devel make zlib-devel xsimd-devel) || apt-get install -y zlib1g-dev libssl-dev make libxsimd-dev || apk add --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community zlib-dev openssl-dev make xsimd-dev
66+
CIBW_BEFORE_ALL_MACOS: brew install openssl zlib xsimd
67+
CIBW_TEST_COMMAND: cd {project} && python mercury_python_test.py
68+
69+
- name: Upload to S3
70+
if: vars.UPLOAD_PYTHON_WHEELS_TO_S3 == 'true'
71+
env:
72+
AWS_ACCESS_KEY_ID: ${{secrets.ACCESS_KEY_ID}}
73+
AWS_SECRET_ACCESS_KEY: ${{secrets.ACCESS_KEY_SECRET}}
74+
AWS_DEFAULT_REGION: us-east-1
75+
S3_BUCKET: ${{secrets.S3_BUCKET}}
76+
run: VERSION=$(cat src/cython/_version.py | tr -d '\n' | cut -d \' -f2) && aws s3 cp wheelhouse/ "s3://$S3_BUCKET/version=$VERSION" --recursive

.github/workflows/pub-python-wheels.yml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# ┌─────────────────────────────────────────────────────────────────┐
2+
# │ IMPORTANT: This file MUST stay in sync with │
3+
# │ emu-python-wheels.yml. The only difference between the two │
4+
# │ files should be the cisco-actions/* mirror references. │
5+
# │ Do NOT accept PRs where these files diverge in any other way. │
6+
# └─────────────────────────────────────────────────────────────────┘
17
name: "[PUB] Python Wheels"
28

39
on:
@@ -18,13 +24,6 @@ jobs:
1824
strategy:
1925
matrix:
2026
os: [ubuntu-latest, macos-latest]
21-
env:
22-
CIBW_ARCHS_LINUX: aarch64 x86_64
23-
CIBW_ARCHS_MACOS: arm64
24-
CIBW_SKIP: "*-musllinux_* pp* cp38* cp37* cp36*"
25-
CIBW_BEFORE_ALL_LINUX: (yum install -y epel-release && yum install -y openssl-devel make zlib-devel xsimd-devel) || apt-get install -y zlib1g-dev libssl-dev make libxsimd-dev || apk add --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community zlib-dev openssl-dev make xsimd-dev
26-
CIBW_BEFORE_ALL_MACOS: brew install openssl zlib xsimd
27-
CIBW_TEST_COMMAND: cd {project} && python mercury_python_test.py
2827

2928
steps:
3029
- uses: actions/checkout@v6
@@ -46,32 +45,26 @@ jobs:
4645
python-version: '3.x'
4746

4847
- name: Set up QEMU
49-
if: runner.os == 'Linux' && vars.USE_INTERNAL_ACTIONS != 'true'
48+
if: runner.os == 'Linux'
5049
uses: docker/setup-qemu-action@v4.0.0
5150
with:
5251
platforms: all
5352

54-
- name: Set up QEMU (GitHub EMU)
55-
if: runner.os == 'Linux' && vars.USE_INTERNAL_ACTIONS == 'true'
56-
uses: cisco-actions/docker-setup-qemu-action@v4.0.0
57-
with:
58-
platforms: all
59-
6053
- name: Install pip packages
6154
run: python -m pip install cython
6255

6356
- name: Build Mercury
6457
run: ./configure && make && cp -r src/cython/* ./
6558

6659
- name: Build wheels
67-
if: vars.USE_INTERNAL_ACTIONS != 'true'
6860
uses: pypa/cibuildwheel@v3.4.0
69-
# CIBW_* configuration is in the job-level env block above
70-
71-
- name: Build wheels (GitHub EMU)
72-
if: vars.USE_INTERNAL_ACTIONS == 'true'
73-
uses: cisco-actions/pypa-cibuildwheel@v3.4.0
74-
# CIBW_* configuration is in the job-level env block above
61+
env:
62+
CIBW_ARCHS_LINUX: aarch64 x86_64
63+
CIBW_ARCHS_MACOS: arm64
64+
CIBW_SKIP: "*-musllinux_* pp* cp38* cp37* cp36*"
65+
CIBW_BEFORE_ALL_LINUX: (yum install -y epel-release && yum install -y openssl-devel make zlib-devel xsimd-devel) || apt-get install -y zlib1g-dev libssl-dev make libxsimd-dev || apk add --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community zlib-dev openssl-dev make xsimd-dev
66+
CIBW_BEFORE_ALL_MACOS: brew install openssl zlib xsimd
67+
CIBW_TEST_COMMAND: cd {project} && python mercury_python_test.py
7568

7669
- name: Upload to S3
7770
if: vars.UPLOAD_PYTHON_WHEELS_TO_S3 == 'true'

0 commit comments

Comments
 (0)