-
Notifications
You must be signed in to change notification settings - Fork 67
227 lines (196 loc) · 6.97 KB
/
ci-build-binary-artifacts.yaml
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name: CI - Build binary artifacts
on:
push:
tags:
- '*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
package-linux:
name: Build ${{matrix.pkg.name}} ${{matrix.cpu.platform}}
runs-on: ubuntu-22.04
timeout-minutes: 500
strategy:
fail-fast: false
matrix:
pkg:
- { name: 'RPM', type: 'rpm', path: 'pkg/rpm/RPMS' }
- { name: 'Deb', type: 'deb', path: 'pkg/deb/BUILD/DEB' }
- { name: 'Alpine', type: 'apk', path: 'pkg/apk/build' }
cpu:
- { arch: 'x86_64', platform: 'x86_64' }
- { arch: 'aarch64', platform: 'arm64' }
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Package Pulsar source
run: build-support/generate-source-archive.sh
- uses: docker/setup-buildx-action@v2
- run: build-support/copy-deps-versionfile.sh
- name: Build dependencies Docker image
uses: docker/build-push-action@v3
with:
context: ./pkg/${{matrix.pkg.type}}
load: true
tags: build:latest
platforms: linux/${{matrix.cpu.platform}}
build-args: PLATFORM=${{matrix.cpu.arch}}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build packages
run: pkg/${{matrix.pkg.type}}/docker-build-${{matrix.pkg.type}}-${{matrix.cpu.platform}}.sh build:latest
- name: Zip artifact
run: zip -r ${{matrix.pkg.type}}-${{matrix.cpu.platform}}.zip ${{matrix.pkg.path}}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{matrix.pkg.type}}-${{matrix.cpu.platform}}
path: ${{matrix.pkg.path}}
package-windows:
timeout-minutes: 120
name: Build CPP Client on ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
VCPKG_ROOT: '${{ github.workspace }}/vcpkg'
INSTALL_DIR: 'C:\\pulsar-cpp'
strategy:
fail-fast: false
matrix:
include:
- name: 'Windows x64'
os: windows-2019
triplet: x64-windows-static
suffix: 'windows-win64'
generator: 'Visual Studio 16 2019'
arch: '-A x64'
- name: 'Windows x86'
os: windows-2019
triplet: x86-windows-static
suffix: 'windows-win32'
generator: 'Visual Studio 16 2019'
arch: '-A Win32'
steps:
- name: checkout
uses: actions/checkout@v3
- name: Restore vcpkg and its artifacts.
uses: actions/cache@v3
id: vcpkg-cache
with:
path: |
${{ env.VCPKG_ROOT }}
vcpkg_installed
!${{ env.VCPKG_ROOT }}/.git
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
key: |
${{ runner.os }}-${{ matrix.triplet }}-${{ hashFiles( 'vcpkg.json' ) }}
- name: Get vcpkg(windows)
if: ${{ runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
run: |
cd ${{ github.workspace }}
mkdir build -force
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
- name: remove system vcpkg(windows)
if: runner.os == 'Windows'
run: rm -rf "$VCPKG_INSTALLATION_ROOT"
shell: bash
- name: Install vcpkg packages
run: |
${{ env.VCPKG_ROOT }}\vcpkg.exe install --triplet ${{ matrix.triplet }} > dependencies.txt
- name: Build and package
shell: bash
run: |
BUILD_DIR=./build
mkdir -p $BUILD_DIR
cmake -B $BUILD_DIR \
-G "${{ matrix.generator }}" ${{ matrix.arch }} \
-DUSE_ASIO=ON \
-DBUILD_TESTS=OFF \
-DVCPKG_TRIPLET=${{ matrix.triplet }} \
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} \
-S .
cmake --build $BUILD_DIR --parallel --config Release
cmake --install $BUILD_DIR
cp dependencies.txt ${{ env.INSTALL_DIR }}
- name: Zip artifact
shell: bash
run: 7z a -tzip pulsar-client-cpp-${{ matrix.triplet }}.zip ${{ env.INSTALL_DIR }}/*
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.triplet }}
path: ${{ env.INSTALL_DIR }}
- name: Build and package (Debug)
shell: bash
run: |
BUILD_DIR=./build-debug
INSTALL_DIR_DEBUG=${{ env.INSTALL_DIR }}-Debug
mkdir -p $BUILD_DIR
cmake -B $BUILD_DIR \
-G "${{ matrix.generator }}" ${{ matrix.arch }} \
-DUSE_ASIO=ON \
-DBUILD_TESTS=OFF \
-DVCPKG_TRIPLET=${{ matrix.triplet }} \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR_DEBUG \
-DCMAKE_BUILD_TYPE=Debug \
-S .
cmake --build $BUILD_DIR --parallel --config Debug
cmake --install $BUILD_DIR --config Debug
cp dependencies.txt $INSTALL_DIR_DEBUG
- name: Zip artifact (Debug)
shell: bash
run: 7z a -tzip pulsar-client-cpp-${{ matrix.triplet }}-Debug.zip ${{ env.INSTALL_DIR }}-Debug/*
- name: Upload artifacts (Debug)
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.triplet }}-Debug
path: ${{ env.INSTALL_DIR }}-Debug
package-macos:
name: Build macOS libraries
runs-on: macos-latest
timeout-minutes: 500
strategy:
fail-fast: false
matrix:
arch: [x86_64, arm64]
steps:
- name: checkout
uses: actions/checkout@v3
- name: Install dependencies
run: |
export ARCH=${{ matrix.arch }}
./pkg/mac/build-static-library.sh
- name: Zip artifact
run: |
cd ./pkg/mac/.install
zip -r macos-${{ matrix.arch }}.zip ./include/pulsar/* ./lib/*
cp macos-${{ matrix.arch }}.zip ../../../
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: macos-${{ matrix.arch }}.zip
path: macos-${{ matrix.arch }}.zip