Skip to content

Commit e0194e2

Browse files
adragomirccciudatu
authored andcommitted
[HSTACK] Internal Adobe build tooling
1 parent 0abac7d commit e0194e2

10 files changed

+318
-106
lines changed

.github/workflows/build.yml

+120-104
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717

1818
name: Python Release Build
1919
on:
20-
pull_request:
21-
branches: ["main"]
20+
workflow_dispatch: {}
2221
push:
23-
tags: ["*-rc*"]
24-
branches: ["branch-*"]
22+
branches: ["main*"]
2523

2624
jobs:
2725
build:
@@ -43,28 +41,27 @@ jobs:
4341
run: uv sync --dev --no-install-package datafusion
4442

4543
# Update output format to enable automatic inline annotations.
46-
- name: Run Ruff
47-
run: |
48-
uv run --no-project ruff check --output-format=github python/
49-
uv run --no-project ruff format --check python/
50-
51-
generate-license:
52-
runs-on: ubuntu-latest
53-
steps:
54-
- uses: actions/checkout@v4
55-
- uses: astral-sh/setup-uv@v5
56-
with:
57-
enable-cache: true
44+
# - name: Run Ruff
45+
# run: |
46+
# uv run --no-project ruff check --output-format=github python/
47+
# uv run --no-project ruff format --check python/
5848

59-
- name: Generate license file
60-
run: uv run --no-project python ./dev/create_license.py
61-
- uses: actions/upload-artifact@v4
62-
with:
63-
name: python-wheel-license
64-
path: LICENSE.txt
49+
# generate-license:
50+
# runs-on: ubuntu-latest
51+
# steps:
52+
# - uses: actions/checkout@v4
53+
# - uses: astral-sh/setup-uv@v5
54+
# with:
55+
# enable-cache: true
56+
#
57+
# - name: Generate license file
58+
# run: uv run --no-project python ./dev/create_license.py
59+
# - uses: actions/upload-artifact@v4
60+
# with:
61+
# name: python-wheel-license
62+
# path: LICENSE.txt
6563

6664
build-python-mac-win:
67-
needs: [generate-license]
6865
name: Mac/Win
6966
runs-on: ${{ matrix.os }}
7067
strategy:
@@ -81,13 +78,6 @@ jobs:
8178

8279
- uses: dtolnay/rust-toolchain@stable
8380

84-
- run: rm LICENSE.txt
85-
- name: Download LICENSE.txt
86-
uses: actions/download-artifact@v4
87-
with:
88-
name: python-wheel-license
89-
path: .
90-
9181
- name: Install Protoc
9282
uses: arduino/setup-protoc@v3
9383
with:
@@ -121,7 +111,6 @@ jobs:
121111
path: target/wheels/*
122112

123113
build-macos-x86_64:
124-
needs: [generate-license]
125114
name: Mac x86_64
126115
runs-on: macos-13
127116
strategy:
@@ -137,13 +126,6 @@ jobs:
137126

138127
- uses: dtolnay/rust-toolchain@stable
139128

140-
- run: rm LICENSE.txt
141-
- name: Download LICENSE.txt
142-
uses: actions/download-artifact@v4
143-
with:
144-
name: python-wheel-license
145-
path: .
146-
147129
- name: Install Protoc
148130
uses: arduino/setup-protoc@v3
149131
with:
@@ -169,17 +151,14 @@ jobs:
169151
path: target/wheels/*
170152

171153
build-manylinux-x86_64:
172-
needs: [generate-license]
173154
name: Manylinux x86_64
174155
runs-on: ubuntu-latest
175156
steps:
176157
- uses: actions/checkout@v4
177-
- run: rm LICENSE.txt
178-
- name: Download LICENSE.txt
179-
uses: actions/download-artifact@v4
158+
- uses: awalsh128/cache-apt-pkgs-action@latest
180159
with:
181-
name: python-wheel-license
182-
path: .
160+
packages: libssl3 openssl
161+
version: 1.0
183162
- run: cat LICENSE.txt
184163
- name: Build wheels
185164
uses: PyO3/maturin-action@v1
@@ -189,6 +168,20 @@ jobs:
189168
rust-toolchain: nightly
190169
target: x86_64
191170
manylinux: auto
171+
before-script-linux: |
172+
# If we're running on rhel centos, install needed packages.
173+
if command -v yum &> /dev/null; then
174+
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic
175+
176+
# If we're running on i686 we need to symlink libatomic
177+
# in order to build openssl with -latomic flag.
178+
if [[ ! -d "/usr/lib64" ]]; then
179+
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so
180+
fi
181+
else
182+
# If we're running on debian-based system.
183+
apt update -y && apt-get install -y libssl-dev openssl pkg-config
184+
fi
192185
rustup-components: rust-std rustfmt # Keep them in one line due to https://github.com/PyO3/maturin-action/issues/153
193186
args: --release --manylinux 2014 --features protoc,substrait
194187
- name: Archive wheels
@@ -197,74 +190,97 @@ jobs:
197190
name: dist-manylinux-x86_64
198191
path: target/wheels/*
199192

200-
build-manylinux-aarch64:
201-
needs: [generate-license]
202-
name: Manylinux arm64
203-
runs-on: ubuntu-latest
204-
steps:
205-
- uses: actions/checkout@v4
206-
- run: rm LICENSE.txt
207-
- name: Download LICENSE.txt
208-
uses: actions/download-artifact@v4
209-
with:
210-
name: python-wheel-license
211-
path: .
212-
- run: cat LICENSE.txt
213-
- name: Build wheels
214-
uses: PyO3/maturin-action@v1
215-
env:
216-
RUST_BACKTRACE: 1
217-
with:
218-
rust-toolchain: nightly
219-
target: aarch64
220-
# Use manylinux_2_28-cross because the manylinux2014-cross has GCC 4.8.5, which causes the build to fail
221-
manylinux: 2_28
222-
rustup-components: rust-std rustfmt # Keep them in one line due to https://github.com/PyO3/maturin-action/issues/153
223-
args: --release --features protoc,substrait
224-
- name: Archive wheels
225-
uses: actions/upload-artifact@v4
226-
with:
227-
name: dist-manylinux-aarch64
228-
path: target/wheels/*
193+
# build-manylinux-aarch64:
194+
# name: Manylinux arm64
195+
# runs-on: ubuntu-latest-arm
196+
# steps:
197+
# - uses: actions/checkout@v4
198+
# - uses: awalsh128/cache-apt-pkgs-action@latest
199+
# with:
200+
# packages: libssl3 openssl
201+
# version: 1.0
202+
# - run: cat LICENSE.txt
203+
# - name: Build wheels
204+
# uses: PyO3/maturin-action@v1
205+
# env:
206+
# RUST_BACKTRACE: full
207+
# with:
208+
# rust-toolchain: nightly
209+
# target: aarch64
210+
# # Use manylinux_2_28-cross because the manylinux2014-cross has GCC 4.8.5, which causes the build to fail
211+
# manylinux: 2_28
212+
# before-script-linux: |
213+
# # If we're running on rhel centos, install needed packages.
214+
# if command -v yum &> /dev/null; then
215+
# yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic
216+
#
217+
# # If we're running on i686 we need to symlink libatomic
218+
# # in order to build openssl with -latomic flag.
219+
# if [[ ! -d "/usr/lib64" ]]; then
220+
# ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so
221+
# fi
222+
# else
223+
# # If we're running on debian-based system.
224+
# apt update -y && apt-get install -y libssl-dev openssl pkg-config librust-openssl-sys-dev
225+
# fi
226+
# ls -lA /usr/include/openssl/
227+
# rustup-components: rust-std rustfmt # Keep them in one line due to https://github.com/PyO3/maturin-action/issues/153
228+
# args: --release --features protoc,substrait
229+
# - name: Archive wheels
230+
# uses: actions/upload-artifact@v4
231+
# with:
232+
# name: dist-manylinux-aarch64
233+
# path: target/wheels/*
229234

230-
build-sdist:
231-
needs: [generate-license]
232-
name: Source distribution
233-
runs-on: ubuntu-latest
234-
steps:
235-
- uses: actions/checkout@v4
236-
- run: rm LICENSE.txt
237-
- name: Download LICENSE.txt
238-
uses: actions/download-artifact@v4
239-
with:
240-
name: python-wheel-license
241-
path: .
242-
- run: cat LICENSE.txt
243-
- name: Build sdist
244-
uses: PyO3/maturin-action@v1
245-
with:
246-
rust-toolchain: stable
247-
manylinux: auto
248-
rustup-components: rust-std rustfmt
249-
args: --release --sdist --out dist --features protoc,substrait
250-
- name: Assert sdist build does not generate wheels
251-
run: |
252-
if [ "$(ls -A target/wheels)" ]; then
253-
echo "Error: Sdist build generated wheels"
254-
exit 1
255-
else
256-
echo "Directory is clean"
257-
fi
258-
shell: bash
235+
# build-sdist:
236+
# name: Source distribution
237+
# runs-on: ubuntu-latest
238+
# steps:
239+
# - uses: actions/checkout@v4
240+
# - uses: awalsh128/cache-apt-pkgs-action@latest
241+
# with:
242+
# packages: libssl3 openssl
243+
# version: 1.0
244+
# - run: cat LICENSE.txt
245+
# - name: Build sdist
246+
# uses: PyO3/maturin-action@v1
247+
# with:
248+
# rust-toolchain: stable
249+
# manylinux: auto
250+
# before-script-linux: |
251+
# # If we're running on rhel centos, install needed packages.
252+
# if command -v yum &> /dev/null; then
253+
# yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic
254+
#
255+
# # If we're running on i686 we need to symlink libatomic
256+
# # in order to build openssl with -latomic flag.
257+
# if [[ ! -d "/usr/lib64" ]]; then
258+
# ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so
259+
# fi
260+
# else
261+
# # If we're running on debian-based system.
262+
# apt update -y && apt-get install -y libssl-dev openssl pkg-config
263+
# fi
264+
# rustup-components: rust-std rustfmt
265+
# args: --release --sdist --out dist --features protoc,substrait
266+
# - name: Assert sdist build does not generate wheels
267+
# run: |
268+
# if [ "$(ls -A target/wheels)" ]; then
269+
# echo "Error: Sdist build generated wheels"
270+
# exit 1
271+
# else
272+
# echo "Directory is clean"
273+
# fi
274+
# shell: bash
259275

260276
merge-build-artifacts:
261277
runs-on: ubuntu-latest
262278
needs:
263279
- build-python-mac-win
264280
- build-macos-x86_64
265281
- build-manylinux-x86_64
266-
- build-manylinux-aarch64
267-
- build-sdist
282+
# - build-manylinux-aarch64
283+
# - build-sdist
268284
steps:
269285
- name: Merge Build Artifacts
270286
uses: actions/upload-artifact/merge@v4

ARTIFACTORY.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Publish to artifactory
2+
3+
## MacOS binary
4+
```shell
5+
maturin publish --repository-url https://artifactory-uw2.adobeitc.com/artifactory/api/pypi/pypi-arrow-release/ --password $ARTIFACTORY_UW2_TOKEN --username $ARTIFACTORY_USER
6+
```
7+
8+
## Linux ARM64
9+
```shell
10+
./build-linux-arm64.sh
11+
```
12+
13+
## Linux X86_64
14+
```shell
15+
./build-linux-x86_64.sh
16+
```

Dockerfile-build-wheel.arm64

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM quay.io/pypa/manylinux_2_28_aarch64 AS base
4+
5+
WORKDIR /root
6+
7+
RUN <<EOF
8+
dnf install -y epel-release
9+
dnf install -y curl pkg-config openssl ca-certificates openssl-devel patchelf autoconf automake make libtool unzip clang libatomic openssh-clients wget
10+
EOF
11+
12+
RUN <<EOF
13+
# echo 1
14+
wget https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.21.12.zip
15+
unzip v3.21.12.zip
16+
cd protobuf-3.21.12
17+
autoupdate
18+
./autogen.sh
19+
./configure --prefix=/usr --disable-dependency-tracking
20+
make -j8
21+
make install
22+
EOF
23+
24+
RUN <<EOF
25+
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
26+
EOF
27+
28+
RUN --mount=type=ssh,mode=0666 \
29+
<<EOF
30+
mkdir -p -m 0700 ~/.ssh
31+
ssh-keyscan git.corp.adobe.com >> ~/.ssh/known_hosts
32+
ssh-keyscan github.com >> ~/.ssh/known_hosts
33+
EOF
34+
35+
RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \
36+
--mount=type=bind,source=src,target=src,readwrite \
37+
--mount=type=bind,source=python,target=python,readwrite \
38+
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
39+
--mount=type=bind,source=build.rs,target=build.rs \
40+
--mount=type=bind,source=Cargo.toml,target=Cargo.toml \
41+
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
42+
--mount=type=bind,source=README.md,target=README.md \
43+
--mount=type=bind,source=LICENSE.txt,target=LICENSE.txt \
44+
--mount=type=cache,mode=0777,target=/root/target \
45+
--mount=type=cache,mode=0777,target=/usr/local/cargo/registry/ \
46+
--mount=type=ssh,mode=0666 \
47+
<<EOF
48+
export PATH="/root/.cargo/bin:/opt/python/cp312-cp312/bin:$PATH"
49+
python3 -m venv venv
50+
source venv/bin/activate
51+
source /root/.cargo/env
52+
pip3 install maturin==1.8.1
53+
pip3 install -r requirements.txt
54+
maturin build --release --manylinux 2_28 --features protoc,substrait
55+
cp ./target/wheels/*.whl /
56+
EOF

0 commit comments

Comments
 (0)