-
Notifications
You must be signed in to change notification settings - Fork 7
119 lines (100 loc) · 3.46 KB
/
linux.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
#
# Copyright (c) 2019-present, Trail of Bits, Inc.
# 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: Linux
on:
workflow_call:
inputs:
platform:
required: true
type: string
build_type:
required: true
type: string
osquery_toolchain_version:
required: true
type: string
jobs:
build:
runs-on: ${{ inputs.platform }}
env:
CACHE_KEY: platform-${{ inputs.platform }}_type-${{ inputs.build_type }}
steps:
- name: Update the environment variables
run: |
echo "CCACHE_DIR=${{ github.workspace }}/ccache" >> $GITHUB_ENV
echo "DOWNLOADS_PATH=${{ github.workspace }}/downloads" >> $GITHUB_ENV
echo "TOOLCHAIN_PATH=${{ github.workspace }}/osquery-toolchain-${{ inputs.osquery_toolchain_version }}" >> $GITHUB_ENV
- name: Update the ccache cache
uses: actions/cache@v3
with:
path: ${{ env.CCACHE_DIR }}
key: ccache_${{ env.CACHE_KEY }}-${{ github.sha }}
restore-keys: ccache_${{ env.CACHE_KEY }}
- name: Update the downloads cache
uses: actions/cache@v3
with:
path: ${{ env.DOWNLOADS_PATH }}
key: downloads_${{ env.CACHE_KEY }}-${{ github.sha }}
restore-keys: downloads_${{ env.CACHE_KEY }}
- name: Create the build folders
run: |
mkdir -p \
${{ env.CCACHE_DIR }} \
${{ env.DOWNLOADS_PATH }}
- name: Install system dependencies
run: |
sudo apt-get install -y \
ccache \
ninja-build \
cmake
- name: Install the osquery-toolchain
id: osquery_toolchain_installer
run: |
if [ ! -f "${{ env.DOWNLOADS_PATH }}/osquery-toolchain-${{ inputs.osquery_toolchain_version }}.tar.xz" ] ; then
curl \
-L \
"https://github.com/osquery/osquery-toolchain/releases/download/${{ inputs.osquery_toolchain_version }}/osquery-toolchain-${{ inputs.osquery_toolchain_version }}-x86_64.tar.xz" \
-o \
"${{ env.DOWNLOADS_PATH }}/osquery-toolchain-${{ inputs.osquery_toolchain_version }}.tar.xz"
fi
tar \
xf \
"${{ env.DOWNLOADS_PATH }}/osquery-toolchain-${{ inputs.osquery_toolchain_version }}.tar.xz"
mv \
osquery-toolchain \
${{ env.TOOLCHAIN_PATH }}
- name: Clone the ebpf-common source code
uses: actions/checkout@v3
with:
repository: trailofbits/ebpf-common
path: ebpf-common
fetch-depth: 0
- name: Initialize the submodules
working-directory: ${{ github.workspace }}/ebpf-common
run: |
git submodule update --init --recursive
- name: Configure the project
run: |
cmake \
-G Ninja \
-S ebpf-common \
-B build-ebpf-common \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain.cmake \
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \
-DEBPF_COMMON_ENABLE_TESTS=true
- name: Build the project
run: |
cmake \
--build build-ebpf-common \
-v
- name: Run the tests
run: |
sudo cmake \
--build build-ebpf-common \
--target run-ebpf-common-tests \
-v