-
Notifications
You must be signed in to change notification settings - Fork 1.6k
132 lines (122 loc) · 4.2 KB
/
call-build-macos.yaml
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
---
name: Reusable workflow to build MacOS packages optionally into S3 bucket
on:
workflow_call:
inputs:
version:
description: The version of Fluent Bit to create.
type: string
required: true
ref:
description: The commit, tag or branch of Fluent Bit to checkout for building that creates the version above.
type: string
required: true
environment:
description: The Github environment to run this workflow on.
type: string
required: false
unstable:
description: Optionally add metadata to build to indicate an unstable build, set to the contents you want to add.
type: string
required: false
default: ''
secrets:
token:
description: The Github token or similar to authenticate with.
required: true
bucket:
description: The name of the S3 (US-East) bucket to push packages into.
required: false
access_key_id:
description: The S3 access key id for the bucket.
required: false
secret_access_key:
description: The S3 secret access key for the bucket.
required: false
jobs:
call-build-macos-legacy-check:
# Requires https://github.com/fluent/fluent-bit/pull/5247 so will not build for previous branches
name: Extract any supporting metadata
outputs:
build-type: ${{ steps.determine-build-type.outputs.BUILD_TYPE }}
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Determine build type
id: determine-build-type
run: |
BUILD_TYPE="legacy"
if [[ -f "conf/fluent-bit-macos.conf" ]]; then
BUILD_TYPE="modern"
fi
echo "Detected type: $BUILD_TYPE"
echo "BUILD_TYPE=$BUILD_TYPE" >> $GITHUB_OUTPUT
shell: bash
call-build-macos-package:
if: needs.call-build-macos-legacy-check.outputs.build-type == 'modern'
runs-on: macos-latest
environment: ${{ inputs.environment }}
needs:
- call-build-macos-legacy-check
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Install dependencies
run: |
brew update
brew install bison flex libyaml openssl pkgconfig || true
- name: Build Fluent Bit packages
run: |
export LIBRARY_PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib:$LIBRARY_PATH
cmake -DCPACK_GENERATOR=productbuild -DFLB_NIGHTLY_BUILD=${{ inputs.unstable }} ../ -DOPENSSL_ROOT_DIR=$(brew --prefix openssl)
cmake --build .
cpack -G productbuild
working-directory: build
- name: Upload build packages
uses: actions/upload-artifact@v3
with:
name: macos-packages
path: |
build/fluent-bit-*-apple*
build/fluent-bit-*-intel*
if-no-files-found: error
call-build-macos-s3-upload:
name: Handle upload to S3
# The environment must be used that has access to any secrets required, even if passed in.
# If passed in but not in the environment here you end up with an empty secret.
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
needs:
- call-build-macos-package
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Download all artefacts
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: macos-packages
path: artifacts/
- name: Push MacOS packages to S3
if: inputs.environment == 'staging'
uses: ./.github/actions/sync-to-bucket
with:
bucket: ${{ secrets.bucket }}
access_key_id: ${{ secrets.access_key_id }}
secret_access_key: ${{ secrets.secret_access_key }}
bucket-directory: "${{ inputs.version }}/macos/"
source-directory: "artifacts/"