forked from iovisor/ubpf
212 lines (176 loc) · 5.65 KB
/
posix.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#
# Copyright (c) 2022-present, IO Visor Project
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
#
name: Posix
on:
workflow_call:
inputs:
platform:
required: true
type: string
build_type:
required: true
type: string
enable_sanitizers:
required: true
type: boolean
enable_coverage:
required: true
type: boolean
scan_build:
required: true
type: boolean
upload_packages:
required: true
type: boolean
jobs:
build:
runs-on: ${{ inputs.platform }}
steps:
- uses: actions/checkout@v3
- name: Generate the cache key
id: cache_key
run: echo ::set-output name=VALUE::platform-${{ inputs.platform }}_type-${{ inputs.build_type }}_sanitizers-${{ inputs.enable_sanitizers }}_coverage-${{ inputs.enable_coverage }}_scan_build-${{ inputs.scan_build }}
- name: Update the cache (ccache)
uses: actions/cache@v1.0.3
with:
path: ccache
key: ${{ steps.cache_key.outputs.VALUE }}_ccache
- name: Create the build folders
run: |
mkdir -p \
ccache
- name: Install system dependencies (Linux)
if: inputs.platform == 'ubuntu-20.04'
run: |
sudo apt-get install -y \
ccache \
ninja-build \
cmake
if [[ "${{ inputs.scan_build }}" == "true" ]] ; then
sudo apt-get install -y \
clang-tools
fi
- name: Install system dependencies (macOS)
if: inputs.platform == 'macos-11'
run: |
brew install \
cmake \
ninja \
ccache
- name: Configure the project
run: |
export CCACHE_DIR="$(pwd)/ccache"
if [[ "${{ inputs.scan_build }}" == "true" ]] ; then
mkdir scan_build_report
command_prefix="scan-build -o scan_build_report"
fi
${command_prefix} cmake \
-G Ninja \
-S . \
-B build \
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \
-DUBPF_ENABLE_COVERAGE=${{ inputs.enable_sanitizers }} \
-DUBPF_ENABLE_SANITIZERS=${{ inputs.enable_coverage }} \
-DUBPF_ENABLE_TESTS=true \
-DUBPF_ENABLE_INSTALL=true
- name: Build the project
run: |
export CCACHE_DIR="$(pwd)/ccache"
if [[ "${{ inputs.scan_build }}" == "true" ]] ; then
command_prefix="scan-build -o scan_build_report"
fi
${command_prefix} cmake \
--build build \
-- -v
- name: Upload scan-build report
if: inputs.scan_build == true
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with:
name: scan-build_report
path: ${{github.workspace}}/scan_build_report
retention-days: 5
- name: Run the tests
run: |
cmake \
--build build \
--target test \
-- -v
- name: Run the install target
run: |
mkdir install
export DESTDIR=$(pwd)/install
cmake \
--build build \
--target install
- name: Generate the DEB package
if: inputs.platform == 'ubuntu-20.04'
run: |
cmake \
-S . \
-B build \
-DUBPF_ENABLE_PACKAGE=true \
-DCPACK_GENERATOR=DEB
cmake \
--build build \
--target package
- name: Generate the RPM package
if: inputs.platform == 'ubuntu-20.04'
run: |
cmake \
-S . \
-B build \
-DUBPF_ENABLE_PACKAGE=true \
-DCPACK_GENERATOR=RPM
cmake \
--build build \
--target package
- name: Generate the TGZ package
run: |
cmake \
-S . \
-B build \
-DUBPF_ENABLE_PACKAGE=true \
-DCPACK_GENERATOR=TGZ
cmake \
--build build \
--target package
- name: Locate the packages
id: package_locations
if: inputs.upload_packages == true
run: |
echo ::set-output name=REL_DEB_PACKAGE_PATH::$(ls build/*.deb)
echo ::set-output name=REL_RPM_PACKAGE_PATH::$(ls build/*.rpm)
echo ::set-output name=REL_TGZ_PACKAGE_PATH::$(ls build/*.tar.gz)
- name: Upload the DEB package
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-20.04'
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with:
name: linux_deb_package
path: ${{ steps.package_locations.outputs.REL_DEB_PACKAGE_PATH }}
retention-days: 5
- name: Upload the RPM package
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-20.04'
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with:
name: linux_rpm_package
path: ${{ steps.package_locations.outputs.REL_RPM_PACKAGE_PATH }}
retention-days: 5
- name: Upload the Linux TGZ package
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-20.04'
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with:
name: linux_tgz_package
path: ${{ steps.package_locations.outputs.REL_TGZ_PACKAGE_PATH }}
retention-days: 5
- name: Upload the macOS TGZ package
if: inputs.upload_packages == true && inputs.platform == 'macos-11'
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with:
name: macos_tgz_package
path: ${{ steps.package_locations.outputs.REL_TGZ_PACKAGE_PATH }}
retention-days: 5