-
Notifications
You must be signed in to change notification settings - Fork 20
238 lines (237 loc) · 9.22 KB
/
mac-artifact.yml
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
228
229
230
231
232
233
234
235
236
237
238
name: Mac Artifact
on:
push:
branches: [ master, test-ready, "bugfix-*", actionsHub ]
pull_request:
branches: [ master, test-ready ]
workflow_call:
inputs:
submodule:
description: The directory of the submodule, if this workflow is being called on a submodule
required: false
type: string
jobs:
build:
runs-on: macos-11
env:
AWS_SDK_CPP_VERSION: 1.10.55
LIBCURL_VERSION: curl-7_83_1
LIBSSH2_VERSION: libssh2-1.10.0
ZSTD_VERSION: 1.4.9
LD_LIBRARY_PATH: /usr/local/lib
EVENT_LIB: libuv
steps:
- name: Get checkout directory
uses: haya14busa/action-cond@v1
id: checkout-dir
with:
cond: ${{ inputs.submodule != '' }}
if_true: aerospike-tools # In this case we are expecting to checkout the tools package.
if_false: asbackup
- name: Get asbackup working directory
uses: haya14busa/action-cond@v1
id: working-dir
with:
cond: ${{ inputs.submodule != '' }}
if_true: aerospike-tools/${{ inputs.submodule }} # In this case we are expecting to checkout the tools package.
if_false: asbackup
- uses: kenchan0130/actions-system-info@master
id: system-info
- name: install libuv
id: install-libuv
run: |
brew install libuv
- name: install openssl
id: install-openssl
run: |
brew install [email protected]
- name: install libssh2
id: install-libssh2
run: |
brew install libssh2
- name: install AWS requirements
id: install-aws-requirements
run: |
brew install openssl@3 readline cmake
CMAKE_VERSION=$(brew info cmake | grep -m 1 -Eo '[0-9]+\.[0-9]+\.[0-9]+')
echo "CMAKE_VERSION=$CMAKE_VERSION" >> $GITHUB_ENV
- name: Cache AWS C++ sdk
id: cache-aws-sdk-cpp
uses: actions/cache@v3
env:
cache-name: aws-sdk-cpp
cache-index: "1"
with:
path: aws-sdk-cpp-${{ env.AWS_SDK_CPP_VERSION }}
key: aws-sdk-cpp-${{ env.cache-index }}-mac-artifact-${{ env.AWS_SDK_CPP_VERSION }}-${{ runner.os }}-cmake-${{ env.CMAKE_VERSION }}
- name: Download AWS C++ sdk
uses: actions/checkout@v3
if: steps.cache-aws-sdk-cpp.outputs.cache-hit != 'true'
with:
repository: aws/aws-sdk-cpp
submodules: recursive
ref: ${{ env.AWS_SDK_CPP_VERSION }}
path: aws-sdk-cpp-${{ env.AWS_SDK_CPP_VERSION }}
- name: Build AWS C++ sdk static library
if: steps.cache-aws-sdk-cpp.outputs.cache-hit != 'true'
run: |
mkdir build_static
cmake -S . -B build_static -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3" -DBUILD_SHARED_LIBS=OFF -DENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_INSTALL_LIBDIR=lib
make -C build_static
working-directory: aws-sdk-cpp-${{ env.AWS_SDK_CPP_VERSION }}
- name: Cache libssh2
id: cache-libssh2
uses: actions/cache@v3
env:
cache-name: libssh2
cache-index: "1"
with:
path: libssh2-${{ env.LIBSSH2_VERSION }}
key: libssh2-v2-${{ env.LIBSSH2_VERSION }}-${{ env.cache-index }}-${{ runner.os }}-cmake-${{ env.CMAKE_VERSION }}
- name: Download libssh2
uses: actions/checkout@v3
if: steps.cache-libssh2.outputs.cache-hit != 'true'
with:
repository: libssh2/libssh2
submodules: recursive
ref: ${{ env.LIBSSH2_VERSION }}
path: libssh2-${{ env.LIBSSH2_VERSION }}
- name: Build libssh2
if: steps.cache-libssh2.outputs.cache-hit != 'true'
run: |
mkdir build_static
pushd build_static
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
working-directory: libssh2-${{ env.LIBSSH2_VERSION }}
- name: Install libssh2
run: |
sudo make install
working-directory: libssh2-${{ env.LIBSSH2_VERSION }}/build_static
- name: Cache libcurl
id: cache-libcurl
uses: actions/cache@v3
env:
cache-name: libcurl
cache-index: "1"
with:
path: curl-${{ env.LIBCURL_VERSION }}
key: curl-v2-${{ env.LIBCURL_VERSION }}-${{ env.cache-index }}-${{ runner.os }}-cmake-${{ env.CMAKE_VERSION }}
- name: Download libcurl
uses: actions/checkout@v3
if: steps.cache-libcurl.outputs.cache-hit != 'true'
with:
repository: curl/curl
submodules: recursive
ref: ${{ env.LIBCURL_VERSION }}
path: curl-${{ env.LIBCURL_VERSION }}
- name: Build libcurl
if: steps.cache-libcurl.outputs.cache-hit != 'true'
run: |
mkdir build
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_INSTALL_LIBDIR=lib -DBUILD_SHARED_LIBS=OFF -DBUILD_CURL_EXE=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl OPENSSL_USE_STATIC_LIBS=TRUE -DHTTP_ONLY=ON
make -C build
working-directory: curl-${{ env.LIBCURL_VERSION }}
- name: Install libcurl
run: |
sudo make install
working-directory: curl-${{ env.LIBCURL_VERSION }}/build
- name: Download zstd
uses: actions/checkout@v3
with:
repository: facebook/zstd
submodules: recursive
ref: v${{ env.ZSTD_VERSION }}
path: zstd-${{ env.ZSTD_VERSION }}
- name: Cache zstd
id: cache-zstd
uses: actions/cache@v3
env:
cache-name: zstd
with:
path: zstd-${{ env.ZSTD_VERSION }}
key: zstd-${{ env.ZSTD_VERSION }}-${{ runner.os }}
- name: Build zstd
id: build-zstd
if: steps.cache-zstd.outputs.cache-hit != 'true'
run: |
make
working-directory: zstd-${{ env.ZSTD_VERSION }}
- name: install zstd
run: |
sudo make install
working-directory: zstd-${{ env.ZSTD_VERSION }}
# this will checkout the whole tools repo when run from aerospike-tools, but we will
# just cd into the correct directory calculated from working-dir
- uses: actions/checkout@v2
if: steps.cache-asbackup.outputs.cache-hit != 'true'
with:
path: ${{ steps.checkout-dir.outputs.value }}
fetch-depth: 0 # fetch the entire commit history for all branches
- name: Checkout asbackup
run: |
git config --global url."https://github.com/".insteadOf "[email protected]:"
git submodule update --init --recursive -- ${{ inputs.submodule || '.' }}
working-directory: ${{ steps.checkout-dir.outputs.value }}
- name: Print and get version
working-directory: ${{ steps.working-dir.outputs.value }}
id: tag
run: |
git describe --tags --always
echo "tag=$(git describe --tags --always)" >> $GITHUB_OUTPUT
- name: Cache asbackup build
id: cache-asbackup
uses: actions/cache@v3
env:
cache-name: cache-asbackup
cache-index: "1"
with:
path: |
${{ steps.working-dir.outputs.value }}/binaries
key: ${{ env.cache-name }}-${{ env.cache-index }}-${{ runner.os }}-${{ runner.arch }}-${{ steps.system-info.outputs.release }}-${{ env.AWS_SDK_CPP_VERSION }}-${{ env.ZSTD_VERSION }}-${{ steps.tag.outputs.tag }}
- name: Install AWS C++ sdk static library
if: steps.cache-asbackup.outputs.cache-hit != 'true'
run: |
sudo make install
working-directory: aws-sdk-cpp-${{ env.AWS_SDK_CPP_VERSION }}/build_static
- name: Build asbackup with static link to zstd and aws-sdk-cpp
if: steps.cache-asbackup.outputs.cache-hit != 'true'
run: |
make ZSTD_STATIC_PATH=/usr/local/lib AWS_SDK_STATIC_PATH=/usr/local/lib CURL_STATIC_PATH=/usr/local/lib OPENSSL_STATIC_PATH=/usr/local/opt/openssl/lib LIBSSH2_STATIC_PATH=/usr/local/lib LIBUV_STATIC_PATH=/usr/local/lib
mkdir -p binaries
cp -r bin binaries/static_bin
make clean
working-directory: ${{ steps.working-dir.outputs.value }}
- name: Sanity test static lib backup artifacts
run: |
./asbackup -n test -d backupdir 2>&1 | grep "Failed to connect"
./asrestore -n test -d backupdir 2>&1 | grep "Failed to connect"
working-directory: ${{ steps.working-dir.outputs.value }}/binaries/static_bin
- name: Upload static asbackup artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.system-info.outputs.platform }}-${{ runner.arch }}-${{ runner.os }}-${{ steps.system-info.outputs.release }}-asbackup-static
path: ${{ steps.working-dir.outputs.value }}/binaries/static_bin/asbackup
if-no-files-found: error
- name: Upload static asrestore artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.system-info.outputs.platform }}-${{ runner.arch }}-${{ runner.os }}-${{ steps.system-info.outputs.release }}-asrestore-static
path: ${{ steps.working-dir.outputs.value }}/binaries/static_bin/asrestore
if-no-files-found: error
bundle-binaries:
needs: build
runs-on: macos-11
if: "${{ inputs.submodule == '' }}"
steps:
- uses: kenchan0130/actions-system-info@master
id: system-info
- name: Get artifacts
uses: actions/download-artifact@v2
with:
path: binaries
- uses: actions/upload-artifact@v3
with:
name: binaries
path: binaries
if-no-files-found: error