-
Notifications
You must be signed in to change notification settings - Fork 86
107 lines (96 loc) · 4.24 KB
/
Copy pathemu-python-wheels.yml
File metadata and controls
107 lines (96 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#############################################################################
# EMU variant of the Python Wheels workflow.
#
# emu-python-wheels.yml — active on GitHub EMU (triggers on dev)
# pub-python-wheels.yml — active on Public GitHub (triggers on main)
#
# These two files MUST stay in sync. Expected differences include the
# cisco-actions/* mirror references, workflow name, trigger branches,
# and file naming. A quick sanity self-check is included in the workflow.
# Do NOT accept PRs where these files diverge in any other way.
#############################################################################
name: "[EMU] Python Wheels"
on:
workflow_dispatch:
push:
branches:
- dev # GitHub EMU (post PR-merge builds)
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sync-self-check:
name: Sync self-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check diff between emu and pub workflow files
run: |
MAX_DIFF_LINES=4
COUNT=$(diff -y --suppress-common-lines .github/workflows/emu-python-wheels.yml .github/workflows/pub-python-wheels.yml | wc -l)
echo "Differing lines: $COUNT (max allowed: $MAX_DIFF_LINES)"
if [ "$COUNT" -gt "$MAX_DIFF_LINES" ]; then
echo "::error::emu-python-wheels.yml and pub-python-wheels.yml have diverged ($COUNT differing lines, max $MAX_DIFF_LINES)"
diff .github/workflows/emu-python-wheels.yml .github/workflows/pub-python-wheels.yml || true
exit 1
fi
build-mercury-wheels:
needs: sync-self-check
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
environment:
name: pypi
url: https://pypi.org/p/mercury-python
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest # native x86_64
cibw_archs_linux: x86_64
cibw_archs_macos: ""
- os: ubuntu-24.04-arm # native aarch64
cibw_archs_linux: aarch64
cibw_archs_macos: ""
- os: macos-latest # native arm64
cibw_archs_linux: ""
cibw_archs_macos: arm64
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Stage cython sources at repo root for cibuildwheel
# Copy cython sources to repo root so cibuildwheel uses it as the package dir.
# Intentionally overwrites README/LICENSE with cython package metadata.
run: cp -r src/cython/* ./
- name: Build wheels
uses: cisco-actions/pypa-cibuildwheel@v3.4.0
env:
CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw_archs_macos }}
MACOSX_DEPLOYMENT_TARGET: "15.0"
CIBW_SKIP: "*-musllinux_* cp38*"
# Build libmerc.a per-arch inside each sandbox so it matches the wheel target.
CIBW_BEFORE_ALL_LINUX: >-
( (yum install -y epel-release && yum install -y openssl-devel make zlib-devel xsimd-devel autoconf gcc-c++)
|| (apt-get update && apt-get install -y zlib1g-dev libssl-dev make libxsimd-dev autoconf g++)
|| (apk add --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community zlib-dev openssl-dev make xsimd-dev autoconf g++) )
&& cd {package} && ./configure --enable-xsimd && make -j libmerc
CIBW_BEFORE_ALL_MACOS: >-
brew install openssl zlib xsimd autoconf
&& cd {package} && ./configure --enable-xsimd && make -j libmerc
CIBW_TEST_COMMAND: cd {project} && python mercury_python_test.py
- name: Upload to S3
if: vars.UPLOAD_PYTHON_WHEELS_TO_S3 == 'true'
env:
AWS_ACCESS_KEY_ID: ${{secrets.ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.ACCESS_KEY_SECRET}}
AWS_DEFAULT_REGION: us-east-1
S3_BUCKET: ${{secrets.S3_BUCKET}}
run: VERSION=$(cat src/cython/_version.py | tr -d '\n' | cut -d \' -f2) && aws s3 cp wheelhouse/ "s3://$S3_BUCKET/version=$VERSION" --recursive