-
Notifications
You must be signed in to change notification settings - Fork 8
155 lines (135 loc) · 5.08 KB
/
build-deb.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
name: Build
on:
pull_request:
branches:
- '*'
workflow_dispatch:
inputs:
branch:
description: 'branch name to build'
required: true
default: 'kvm-nyx-5.10.73'
publish:
description: 'publish a Github release'
required: true
default: 'false'
jobs:
debian_package:
runs-on: intellabs-01
steps:
- run: |
BRANCH=kvm-nyx-6.0
# remove / (forbidden character in upload-artifact name)
BRANCH=${BRANCH///}
# env.ref = kafl/sdv-6.1
echo "ref=kvm-nyx-6.0" >> $GITHUB_ENV
# env.ref_art = kaflsdv-6.1 (for artifact name)
echo "ref_art=${BRANCH///}" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: ${{ env.ref }}
path: sources
# https://github.com/apache/flink/blob/02d30ace69dc18555a5085eccf70ee884e73a16e/tools/azure-pipelines/free_disk_space.sh
- name: Free some disk space
run: |
echo "=============================================================================="
echo "Freeing up disk space on CI system"
echo "=============================================================================="
echo "Listing 100 largest packages"
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
df -h
echo "Removing large packages"
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y azure-cli google-cloud-sdk google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
df -h
echo "Removing large directories"
# deleting 15GB
sudo rm -rf /usr/share/dotnet/
df -h
- name: Install ccache
run: sudo apt-get install -y ccache
- name: Install build deps
run: sudo apt-get install -y libelf-dev dwarves debhelper-compat
- name: Get ubuntu's 22.04 5.15.0-25-generic kernel config
run: |
sudo apt install -y zstd
apt download linux-modules-5.15.0-25-generic
ar x linux-modules-5.15.0-25-generic_5.15.0-25.25_amd64.deb data.tar.zst
tar -xvf data.tar.zst './boot/config-5.15.0-25-generic'
mv boot/config-5.15.0-25-generic sources/.config
rm -r boot/ data.tar.zst linux-modules-5.15.0-25-generic_5.15.0-25.25_amd64.deb
- name: Configure kernel and enable Nyx
run: |
# disable kernel signature
./scripts/config --disable SYSTEM_TRUSTED_KEYS
./scripts/config --disable SYSTEM_REVOCATION_KEYS
# enable KVM
./scripts/config --module KVM
# disable KVM_WERROR (otherwise compilation issues in modified KVM)
./scripts/config --disable KVM_WERROR
# enable Nyx
./scripts/config --enable KVM_NYX
# disable KVM_HYPERV due to compilation issue
./scripts/config --disable KVM_HYPERV
# tweak locaversion
./scripts/config --set-str LOCALVERSION -nyx
# save space
./scripts/config --disable DEBUG_INFO
./scripts/config --enable MODULE_COMPRESS
./scripts/config --enable MODULE_COMPRESS_ZSTD
working-directory: sources
- name: Configure SDV kernel
if: "contains(env.ref, 'sdv')"
run: |
./scripts/config --enable INTEL_TDX_HOST
# tweak locaversion
./scripts/config --set-str LOCALVERSION -sdv
working-directory: sources
- name: make olddefconfig
run: make olddefconfig
working-directory: sources
- uses: actions/cache@v3
with:
path: ~/.cache/ccache
key: "${{ runner.os }}-${{ env.ref }}-${{ hashFiles('.config') }}"
restore-keys: |
"${{ runner.os }}-${{ env.ref }}"
"${{ runner.os }}"
- name: Build kernel
run: |
export PATH="/usr/lib/ccache:$PATH"
make -j$(nproc) bindeb-pkg
working-directory: sources
- uses: actions/upload-artifact@v3
with:
name: linux-${{ env.ref_art }}
path: '*.deb'
- run: rm -rf *.deb
release:
# this job makes an official Github release
if: ${{ inputs.publish }}
needs: [debian_package]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
BRANCH=${{ inputs.branch }}
# remove / (forbidden character in upload-artifact name)
BRANCH=${BRANCH///}
# env.ref_art = kaflsdv-6.1 (for artifact name)
echo "ref_art=${BRANCH///}" >> $GITHUB_ENV
# download all artifacts to the current dir
- uses: actions/download-artifact@v3
with:
name: linux-${{ env.ref_art }}
- name: Create a Release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: 'Prebuild host kernel package for ${{ inputs.branch }}'
tag_name: ${{ inputs.branch }}
files: '*.deb'