Skip to content

Merge pull request #52 from aerospike/TOOLS-2979 #267

Merge pull request #52 from aerospike/TOOLS-2979

Merge pull request #52 from aerospike/TOOLS-2979 #267

Workflow file for this run

name: Mac Artifact
on:
push:
branches: [main, actionsHub]
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]
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: asconfig
- name: Get asconfig 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: asconfig
- uses: actions/checkout@v3
with:
path: ${{ steps.checkout-dir.outputs.value }}
fetch-depth: 0
- name: Checkout asconfig
run: |
# Workaround to replace ssh with http in .gitmodules and add auth
# If the .gitmodules was http then we would just need to add the "token:"
# param to the above actions/checkout@v3 step since the token is persisted.
git config --file .gitmodules --get-regexp url | while read url; do
git config --file=.gitmodules $(echo "$url" | sed -E "s/[email protected]:|https:\/\/github.com\//https:\/\/${{ secrets.TOOLS_BUILD_PAT }}:${{ secrets.TOOLS_BUILD_PAT }}@github.com\//")
done
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: Get go version from go.mod
working-directory: ${{ steps.working-dir.outputs.value }}
run: |
echo "GO_VERSION=$(grep '^go ' go.mod | cut -d " " -f 2)" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
cache-dependency-path: ${{ steps.working-dir.outputs.value }}/go.sum
- uses: kenchan0130/[email protected]
id: system-info
- name: Cache asconfig
uses: actions/cache@v3
id: cache-asconfig
env:
cache-name: cache-asconfig
cache-index: "1"
with:
path: |
${{ steps.working-dir.outputs.value }}/bin/asconfig
key: ${{ env.cache-name }}-${{ env.cache-index }}-${{ runner.os }}-${{ runner.arch }}-${{ steps.system-info.outputs.release }}-${{ steps.tag.outputs.tag }}
- name: Build mac asconfig
if: steps.cache-asconfig.outputs.cache-hit != 'true'
working-directory: ${{ steps.working-dir.outputs.value }}
run: |
make
- name: Sanity Test asconfig
working-directory: ${{ steps.working-dir.outputs.value }}
run: |
sudo make install
asconfig --version 2>&1 | grep "Aerospike Config"
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.system-info.outputs.platform }}-${{ runner.arch }}-${{ runner.os }}-${{ steps.system-info.outputs.release }}-asconfig
path: ${{ steps.working-dir.outputs.value }}/bin/asconfig
if-no-files-found: error