Skip to content

Commit 0b1eabd

Browse files
authored
Build release artifacts (#15)
1 parent 9eb9011 commit 0b1eabd

12 files changed

Lines changed: 280 additions & 22 deletions
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
name: CI - Build binary artifacts
21+
on:
22+
push:
23+
branches:
24+
- '*'
25+
tags:
26+
- '*'
27+
28+
concurrency:
29+
group: ${{ github.workflow }}-${{ github.ref }}
30+
cancel-in-progress: true
31+
32+
jobs:
33+
34+
deb-packaging-x86_64:
35+
name: Build Debian Package - x86_64
36+
runs-on: ubuntu-20.04
37+
timeout-minutes: 120
38+
39+
steps:
40+
- name: checkout
41+
uses: actions/checkout@v2
42+
43+
- name: Package Pulsar source
44+
run: build-support/generate-source-archive.sh
45+
46+
- name: Build Debian packages
47+
run: pkg/deb/docker-build-deb-x86_64.sh
48+
49+
- name: Upload artifacts
50+
uses: actions/upload-artifact@v3
51+
with:
52+
name: deb-x86_64
53+
path: pkg/deb/BUILD/DEB
54+
55+
deb-packaging-arm64:
56+
name: Build Debian Package - Arm64
57+
runs-on: ubuntu-20.04
58+
timeout-minutes: 120
59+
60+
steps:
61+
- name: checkout
62+
uses: actions/checkout@v2
63+
64+
- name: Set up QEMU
65+
uses: docker/setup-qemu-action@v1
66+
67+
- name: Package Pulsar source
68+
run: build-support/generate-source-archive.sh
69+
70+
- name: Build Debian packages
71+
run: pkg/deb/docker-build-deb-arm64.sh
72+
73+
- name: Upload artifacts
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: deb-arm64
77+
path: pkg/deb/BUILD/DEB
78+
79+
rpm-packaging-x86_64:
80+
name: Build RPM Package - x86_64
81+
runs-on: ubuntu-20.04
82+
timeout-minutes: 120
83+
84+
steps:
85+
- name: checkout
86+
uses: actions/checkout@v2
87+
88+
- name: Package Pulsar source
89+
run: build-support/generate-source-archive.sh
90+
91+
- name: Build RPM packages
92+
run: pkg/rpm/docker-build-rpm-x86_64.sh
93+
94+
- name: Upload artifacts
95+
uses: actions/upload-artifact@v3
96+
with:
97+
name: rpm-x86_64
98+
path: pkg/rpm/RPMS
99+
100+
rpm-packaging-arm64:
101+
name: Build RPM Package - arm64
102+
runs-on: ubuntu-20.04
103+
timeout-minutes: 120
104+
105+
steps:
106+
- name: checkout
107+
uses: actions/checkout@v2
108+
109+
- name: Set up QEMU
110+
uses: docker/setup-qemu-action@v1
111+
112+
- name: Package Pulsar source
113+
run: build-support/generate-source-archive.sh
114+
115+
- name: Build RPM packages
116+
run: pkg/rpm/docker-build-rpm-arm64.sh
117+
118+
- name: Upload artifacts
119+
uses: actions/upload-artifact@v3
120+
with:
121+
name: rpm-arm64
122+
path: pkg/rpm/RPMS

.github/workflows/ci-pr-validation.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ jobs:
164164
- name: Build Debian packages
165165
run: |
166166
echo "Build Debian packages"
167-
BUILD_IMAGE=1 pkg/deb/docker-build-deb.sh
167+
BUILD_IMAGE=1 pkg/deb/docker-build-deb-x86_64.sh
168168
169169
rpm-packaging:
170170
name: Build RPM Package
@@ -181,7 +181,7 @@ jobs:
181181
- name: Build RPM packages
182182
run: |
183183
echo "Build RPM packages"
184-
BUILD_IMAGE=1 pkg/rpm/docker-build-rpm.sh
184+
BUILD_IMAGE=1 pkg/rpm/docker-build-rpm-x86_64.sh
185185
186186
# apk-packaging:
187187
# name: Build Alpine Linux APK Package

pkg/deb/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
# Build pulsar client library in Centos with tools to
2121

22-
FROM --platform=linux/amd64 debian:9
22+
FROM debian:9
23+
24+
ARG PLATFORM
2325

2426
# perl is required to install OpenSSL
2527
RUN apt-get update -y && \
@@ -33,11 +35,11 @@ RUN curl -O -L https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/
3335
./b2 address-model=64 cxxflags=-fPIC link=static threading=multi variant=release install && \
3436
rm -rf /boost_1_79_0.tar.gz /boost_1_79_0
3537

36-
RUN curl -O -L https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-x86_64.tar.gz && \
37-
tar xfz cmake-3.24.0-linux-x86_64.tar.gz && \
38-
cp cmake-3.24.0-linux-x86_64/bin/* /usr/bin/ && \
39-
cp -r cmake-3.24.0-linux-x86_64/share/cmake-3.24 /usr/share/ && \
40-
rm -rf cmake-3.24.0-linux-x86_64 cmake-3.24.0-linux-x86_64.tar.gz
38+
RUN curl -O -L https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-${PLATFORM}.tar.gz && \
39+
tar xfz cmake-3.24.0-linux-${PLATFORM}.tar.gz && \
40+
cp cmake-3.24.0-linux-${PLATFORM}/bin/* /usr/bin/ && \
41+
cp -r cmake-3.24.0-linux-${PLATFORM}/share/cmake-3.24 /usr/share/ && \
42+
rm -rf cmake-3.24.0-linux-${PLATFORM} cmake-3.24.0-linux-${PLATFORM}.tar.gz
4143

4244
# Download and copile protoubf
4345
RUN curl -O -L https://github.com/google/protobuf/releases/download/v3.20.0/protobuf-cpp-3.20.0.tar.gz && \
@@ -74,7 +76,7 @@ RUN curl -O -L https://github.com/google/snappy/releases/download/1.1.3/snappy-1
7476
RUN curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1n.tar.gz && \
7577
tar xfz OpenSSL_1_1_1n.tar.gz && \
7678
cd openssl-OpenSSL_1_1_1n/ && \
77-
./Configure -fPIC --prefix=/usr/local/ssl/ linux-x86_64 && \
79+
./Configure -fPIC --prefix=/usr/local/ssl/ linux-${PLATFORM} && \
7880
make -j8 && make install && \
7981
rm -rf /OpenSSL_1_1_1n.tar.gz /openssl-OpenSSL_1_1_1n
8082

pkg/deb/build-deb.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ cat <<EOF > $DEST_DIR/DEBIAN/control
5151
Package: apache-pulsar-client
5252
Version: ${VERSION}
5353
Maintainer: Apache Pulsar <dev@pulsar.apache.org>
54-
Architecture: amd64
54+
Architecture: ${PLATFORM}
5555
Description: The Apache Pulsar client contains a C++ and C APIs to interact with Apache Pulsar brokers.
5656
EOF
5757

@@ -61,7 +61,7 @@ cat <<EOF > $DEVEL_DEST_DIR/DEBIAN/control
6161
Package: apache-pulsar-client-dev
6262
Version: ${VERSION}
6363
Maintainer: Apache Pulsar <dev@pulsar.apache.org>
64-
Architecture: amd64
64+
Architecture: ${PLATFORM}
6565
Depends: apache-pulsar-client
6666
Description: The Apache Pulsar client contains a C++ and C APIs to interact with Apache Pulsar brokers.
6767
EOF

pkg/deb/create-images.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
set -e -x
22+
23+
ROOT_DIR=$(git rev-parse --show-toplevel)
24+
cd $ROOT_DIR/pkg/deb
25+
26+
# ARM
27+
IMAGE=apachepulsar/pulsar-build:debian-9-2.11-arm64
28+
docker build --platform arm64 -t $IMAGE . --build-arg PLATFORM=aarch64
29+
30+
# X86_64
31+
IMAGE=apachepulsar/pulsar-build:debian-9-2.11-x86_64
32+
docker build --platform x86_64 -t $IMAGE . --build-arg PLATFORM=x86_64

pkg/deb/docker-build-deb-arm64.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
set -ex
22+
23+
ROOT_DIR=$(git rev-parse --show-toplevel)
24+
25+
IMAGE_NAME=apachepulsar/pulsar-build:debian-9-2.11-arm64
26+
27+
docker pull $IMAGE_NAME
28+
docker run -v $ROOT_DIR:/pulsar-client-cpp \
29+
--env PLATFORM=arm64 \
30+
$IMAGE_NAME \
31+
/pulsar-client-cpp/pkg/deb/build-deb.sh
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ ROOT_DIR=$(git rev-parse --show-toplevel)
2525
IMAGE_NAME=apachepulsar/pulsar-build:debian-9-2.11-x86_64
2626

2727
docker pull $IMAGE_NAME
28-
docker run -v $ROOT_DIR:/pulsar-client-cpp $IMAGE_NAME \
28+
docker run -v $ROOT_DIR:/pulsar-client-cpp \
29+
--env PLATFORM=amd64 \
30+
$IMAGE_NAME \
2931
/pulsar-client-cpp/pkg/deb/build-deb.sh

pkg/rpm/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121

2222
FROM centos:7
2323

24+
ARG PLATFORM
25+
2426
RUN yum update -y && \
2527
yum install -y gcc-c++ make rpm-build which \
26-
createrepo libstdc++-static.x86_64 python3
28+
createrepo libstdc++-static python3
2729

2830
# Download and compile boost
2931
# GCC 4.8.2 implementation of std::regex is buggy, so we install boost::regex here
@@ -34,11 +36,11 @@ RUN curl -O -L https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/
3436
./b2 address-model=64 cxxflags=-fPIC link=static threading=multi variant=release install && \
3537
rm -rf /boost_1_79_0.tar.gz /boost_1_79_0
3638

37-
RUN curl -O -L https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-x86_64.tar.gz && \
38-
tar xfz cmake-3.24.0-linux-x86_64.tar.gz && \
39-
cp cmake-3.24.0-linux-x86_64/bin/* /usr/bin/ && \
40-
cp -r cmake-3.24.0-linux-x86_64/share/cmake-3.24 /usr/share/ && \
41-
rm -rf cmake-3.24.0-linux-x86_64 cmake-3.24.0-linux-x86_64.tar.gz
39+
RUN curl -O -L https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-${PLATFORM}.tar.gz && \
40+
tar xfz cmake-3.24.0-linux-${PLATFORM}.tar.gz && \
41+
cp cmake-3.24.0-linux-${PLATFORM}/bin/* /usr/bin/ && \
42+
cp -r cmake-3.24.0-linux-${PLATFORM}/share/cmake-3.24 /usr/share/ && \
43+
rm -rf cmake-3.24.0-linux-${PLATFORM} cmake-3.24.0-linux-${PLATFORM}.tar.gz
4244

4345
# Download and copile protoubf
4446
RUN curl -O -L https://github.com/google/protobuf/releases/download/v3.20.0/protobuf-cpp-3.20.0.tar.gz && \
@@ -75,7 +77,7 @@ RUN curl -O -L https://github.com/google/snappy/releases/download/1.1.3/snappy-1
7577
RUN curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1n.tar.gz && \
7678
tar xfz OpenSSL_1_1_1n.tar.gz && \
7779
cd openssl-OpenSSL_1_1_1n/ && \
78-
./Configure -fPIC --prefix=/usr/local/ssl/ linux-x86_64 && \
80+
./Configure -fPIC --prefix=/usr/local/ssl/ linux-${PLATFORM} && \
7981
make -j8 && make install && \
8082
rm -rf /OpenSSL_1_1_1n.tar.gz /openssl-OpenSSL_1_1_1n
8183

pkg/rpm/build-rpm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ rpmbuild -v -bb --clean \
3939
--define "_topdir $PWD" \
4040
SPECS/pulsar-client.spec
4141

42-
cd RPMS/x86_64
42+
cd RPMS/${PLATFORM}
4343
createrepo .

pkg/rpm/create-images.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
21+
set -e -x
22+
23+
ROOT_DIR=$(git rev-parse --show-toplevel)
24+
cd $ROOT_DIR/pkg/rpm
25+
26+
# ARM
27+
IMAGE=apachepulsar/pulsar-build:centos-7-2.11-arm64
28+
docker build --platform arm64 -t $IMAGE . --build-arg PLATFORM=aarch64
29+
30+
# X86_64
31+
IMAGE=apachepulsar/pulsar-build:centos-7-2.11-x86_64
32+
docker build --platform x86_64 -t $IMAGE . --build-arg PLATFORM=x86_64

0 commit comments

Comments
 (0)