forked from SumoLogic/sumologic-otel-collector-packaging
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (129 loc) · 4.19 KB
/
_reusable_build_package.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
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
133
134
135
136
137
138
139
140
141
142
143
144
name: '_reusable_build_package'
on:
workflow_call:
inputs:
otc_version:
required: true
type: string
otc_sumo_version:
required: true
type: string
otc_build_number:
required: false
type: string
cmake_target:
required: true
type: string
workflow_id:
required: false
type: string
runs_on:
required: true
type: string
secrets:
gh_artifacts_token:
required: true
jobs:
build_package:
runs-on: ${{ inputs.runs_on }}
name: Build
outputs:
package_path: ${{ steps.package.outputs.path }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Workflow URL for sumologic-otel-collector
if: inputs.workflow_id != ''
run: |
org="SumoLogic"
repo="sumologic-otel-collector"
workflow_id="${{ inputs.workflow_id }}"
echo "https://github.com/${org}/${repo}/actions/runs/${workflow_id}"
- name: Make build directory
if: runner.os != 'Linux'
run: mkdir build
- name: Build Makefile
id: cmake-linux
if: runner.os == 'Linux'
uses: ./ci/github-actions/cmake
with:
otc_version: ${{ inputs.otc_version }}
otc_sumo_version: ${{ inputs.otc_sumo_version }}
otc_build_number: ${{ inputs.otc_build_number }}
target: ${{ inputs.cmake_target }}
workflow_id: ${{ inputs.workflow_id }}
- name: Build Makefile
id: cmake-other
if: runner.os != 'Linux'
env:
OTC_VERSION: ${{ inputs.otc_version }}
OTC_SUMO_VERSION: ${{ inputs.otc_sumo_version }}
OTC_BUILD_NUMBER: ${{ inputs.otc_build_number }}
TARGET: ${{ inputs.cmake_target }}
working-directory: build
run: cmake ../
- name: Set simple package outputs
id: package
env:
PACKAGE_NAME: >-
${{
steps.cmake-linux.outputs.package_name ||
steps.cmake-other.outputs.package_name
}}
run: >
echo path="$PACKAGE_NAME" >> $GITHUB_OUTPUT
- name: Set simple otc-bin outputs
id: otc-bin
if: inputs.workflow_id != ''
env:
OTC_BIN: >-
${{
steps.cmake-linux.outputs.otc-bin ||
steps.cmake-other.outputs.otc-bin
}}
run: >
echo path="$OTC_BIN" >> $GITHUB_OUTPUT
# Download the artifacts required to build the package target. If
# use_github_artifacts is false then this will be skipped and CMake will
# attempt to fetch the artifacts from a GitHub Release matching
# otc_version and otc_sumo_version.
- name: Download artifacts from sumologic-otel-collector
uses: dawidd6/[email protected]
if: inputs.workflow_id != ''
with:
github_token: ${{ secrets.gh_artifacts_token }}
repo: SumoLogic/sumologic-otel-collector
run_id: ${{ inputs.workflow_id }}
name: ${{ steps.otc-bin.outputs.path }}
path: ./build/gh-artifacts
if_no_artifact_found: fail
- name: Build package
if: runner.os == 'Linux'
uses: ./ci/github-actions/make
with:
target: package
- name: Build package
if: runner.os != 'Linux'
working-directory: build
run: make package
- name: Store package as action artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.package.outputs.path }}
path: ./build/${{ steps.package.outputs.path }}
if-no-files-found: error
test_package:
runs-on: ${{ inputs.runs_on }}
name: Test
needs: build_package
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download macOS package
uses: actions/download-artifact@v3
with:
name: ${{ needs.build_package.outputs.package_path }}
path: artifacts/
- name: Verify installer
if: inputs.cmake_target == 'otc_darwin_amd64_productbuild'
run: sudo ./ci/verify_installer.sh "artifacts/${{ needs.build_package.outputs.package_path }}"