Merge pull request #33 from aerospike/tools-2962 #89
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Mac Artifact | |
on: | |
repository_dispatch: | |
types: mac-build | |
push: | |
branches: [actionsHub, main, "*-bugfix"] | |
pull_request: | |
branches: [main] | |
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: | |
strategy: | |
matrix: | |
os: [macos-12, macos-14] | |
include: | |
- os: macos-12 | |
openssl-path: /usr/local/opt/openssl | |
target-dir: target/Darwin-x86_64/bin | |
- os: macos-14 | |
openssl-path: /opt/homebrew/opt/openssl | |
target-dir: target/Darwin-arm64/bin | |
runs-on: ${{ matrix.os }} | |
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: aql | |
- name: Get aql 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: aql | |
- uses: actions/checkout@v3 | |
with: | |
path: ${{ steps.checkout-dir.outputs.value }} | |
fetch-depth: 0 | |
- name: Checkout ${{ steps.working-dir.outputs.value }} | |
working-directory: ${{ steps.checkout-dir.outputs.value }} | |
run: | | |
git config --global url."https://github.com/".insteadOf "[email protected]:" | |
git submodule update --init --recursive -- ${{ inputs.submodule || '.' }} | |
- 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 | |
- uses: kenchan0130/[email protected] | |
id: system-info | |
- name: Cache Aql | |
uses: actions/cache@v3 | |
id: cache-aql | |
env: | |
cache-name: cache-aql | |
cache-index: "9" # To clear the cache if needed. | |
with: | |
path: | | |
${{ steps.working-dir.outputs.value }}/target | |
key: ${{ runner.os }}-${{ runner.arch }}-${{ steps.system-info.outputs.release }}-build-${{ env.cache-name }}-${{ env.cache-index }}-${{ steps.tag.outputs.tag }} | |
- name: Download C Client Deps | |
run: | | |
brew install automake libtool | |
- name: Cache C Client | |
uses: actions/cache@v3 | |
if: steps.cache-aql.outputs.cache-hit != 'true' | |
env: | |
cache-name: cache-c-client | |
with: | |
path: | | |
${{ steps.working-dir.outputs.value }}/modules/c-client/target | |
key: ${{ runner.os }}-${{ runner.arch }}-build-${{ env.cache-name }}-${{ hashFiles(format('{0}/modules/c-client/**/*', steps.working-dir.outputs.value)) }} | |
- name: Cache Jansson | |
uses: actions/cache@v3 | |
if: steps.cache-aql.outputs.cache-hit != 'true' | |
env: | |
cache-name: cache-jansson | |
with: | |
path: | | |
${{ steps.working-dir.outputs.value }}/modules/jansson/src | |
key: ${{ runner.os }}-${{ runner.arch }}-build-${{ env.cache-name }}-${{ hashFiles(format('{0}/modules/jansson/**/*', steps.working-dir.outputs.value)) }} | |
- name: Build aql | |
if: steps.cache-aql.outputs.cache-hit != 'true' | |
working-directory: ${{ steps.working-dir.outputs.value }} | |
run: | | |
make OPENSSL_STATIC_PATH=${{ matrix.openssl-path }}/lib | |
- name: Sanity Test tools | |
working-directory: ${{ steps.working-dir.outputs.value }} | |
run: | | |
ls target | |
cd ${{ matrix.target-dir }} | |
./aql -e "info" 2>&1 | grep "Failed to connect" | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.system-info.outputs.platform }}-${{ runner.arch }}-${{ runner.os }}-${{ steps.system-info.outputs.release }}-aql | |
path: ${{ steps.working-dir.outputs.value }}/${{ matrix.target-dir }}/aql | |
if-no-files-found: error | |