-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (87 loc) · 3.58 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
name: Mac Artifact
on:
push:
branches: [main]
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:
runs-on: macos-11
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/actions-system-info@master
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 "asconfig version"
- uses: actions/upload-artifact@v3
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