Skip to content

build: use https url in the c-client submodule (#70) #259

build: use https url in the c-client submodule (#70)

build: use https url in the c-client submodule (#70) #259

Workflow file for this run

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