forked from rlane/ubpf
-
Notifications
You must be signed in to change notification settings - Fork 145
127 lines (106 loc) · 3.49 KB
/
windows.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
#
# 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: Windows
on:
workflow_call:
inputs:
platform:
required: true
type: string
build_type:
required: true
type: string
upload_packages:
required: false
type: boolean
default: false
build_codeql:
required: false
type: boolean
default: false
disable_retpolines:
required: false
type: boolean
default: false
permissions:
contents: read
jobs:
build:
permissions:
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/analyze to upload SARIF results
runs-on: ${{ inputs.platform }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: 'recursive'
- name: Initialize CodeQL
if: inputs.build_codeql == true
uses: github/codeql-action/init@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d
with:
languages: 'cpp'
- name: Cache the build folder
uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f
env:
cache-name: cache-nuget-modules
with:
path: build
key: ${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('.github/workflows/windows.yml') }}
- name: Configure uBPF
run: |
cmake `
-S . `
-B build `
-DUBPF_ENABLE_TESTS=true `
-DUBPF_DISABLE_RETPOLINES=${{ inputs.disable_retpolines }} `
-DUBPF_ENABLE_INSTALL=true
- name: Build uBPF
run: |
cmake `
--build build `
--config ${{ inputs.build_type }}
- name: Run the CTest suite
run: |
cd build
ctest --output-on-failure --build-config ${{ inputs.build_type }}
- name: Rerun failed tests with more verbose output
if: inputs.platform == 'ubuntu-latest' && failure()
working-directory: ${{github.workspace}}/build
run: |
ctest --rerun-failed --output-on-failure
- 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
shell: bash
run: |
echo "REL_TGZ_PACKAGE_PATH=$(ls build/*.tar.gz)" >> $GITHUB_OUTPUT
- name: Upload the Windows TGZ package
if: inputs.upload_packages == true
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
with:
name: windows_tgz_package
path: ${{ steps.package_locations.outputs.REL_TGZ_PACKAGE_PATH }}
retention-days: 5
- name: Perform CodeQL Analysis
if: inputs.build_codeql == true
uses: github/codeql-action/analyze@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d