Skip to content

Commit 7db93bc

Browse files
author
Nobody
committed
adding ci files
1 parent 9492450 commit 7db93bc

15 files changed

+6565
-18
lines changed

.github/actions/vmtest/action.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: 'vmtest'
2+
description: 'Build + run vmtest'
3+
inputs:
4+
arch:
5+
description: 'what arch to test'
6+
required: true
7+
default: 'x86_64'
8+
runs:
9+
using: "composite"
10+
steps:
11+
# 1. Setup environment
12+
- name: Setup build environment
13+
uses: libbpf/ci/setup-build-env@master
14+
# 2. Build
15+
- name: Build kernel image
16+
shell: bash
17+
run: ${GITHUB_ACTION_PATH}/build.sh ${{ inputs.arch }}
18+
- name: Build selftests
19+
shell: bash
20+
run: ${GITHUB_ACTION_PATH}/build_selftests.sh
21+
env:
22+
VMLINUX_BTF: ${{ github.workspace }}/vmlinux
23+
# 3. Test
24+
- name: Prepare rootfs
25+
uses: libbpf/ci/prepare-rootfs@master
26+
with:
27+
project-name: 'libbpf'
28+
arch: ${{ inputs.arch }}
29+
kernel-root: '.'
30+
- name: Run selftests
31+
uses: libbpf/ci/run-qemu@master
32+
with:
33+
arch: ${{ inputs.arch}}
34+
img: '/tmp/root.img'
35+
vmlinuz: '${{ github.workspace }}/vmlinuz'

.github/actions/vmtest/build.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
ARCH="$1"
6+
7+
THISDIR="$(cd $(dirname $0) && pwd)"
8+
9+
source "${THISDIR}"/helpers.sh
10+
11+
travis_fold start build_kernel "Building kernel"
12+
13+
cp ${GITHUB_WORKSPACE}/travis-ci/vmtest/configs/config-latest.${ARCH} .config
14+
15+
make -j $((4*$(nproc))) olddefconfig all > /dev/null
16+
17+
travis_fold end build_kernel
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
THISDIR="$(cd $(dirname $0) && pwd)"
6+
7+
source "${THISDIR}"/helpers.sh
8+
9+
travis_fold start prepare_selftests "Building selftests"
10+
11+
LLVM_VER=15
12+
LIBBPF_PATH="${REPO_ROOT}"
13+
14+
PREPARE_SELFTESTS_SCRIPT=${THISDIR}/prepare_selftests-${KERNEL}.sh
15+
if [ -f "${PREPARE_SELFTESTS_SCRIPT}" ]; then
16+
(cd "${REPO_ROOT}/${REPO_PATH}/tools/testing/selftests/bpf" && ${PREPARE_SELFTESTS_SCRIPT})
17+
fi
18+
19+
if [[ "${KERNEL}" = 'LATEST' ]]; then
20+
VMLINUX_H=
21+
else
22+
VMLINUX_H=${THISDIR}/vmlinux.h
23+
fi
24+
25+
cd ${REPO_ROOT}/${REPO_PATH}
26+
make \
27+
CLANG=clang-${LLVM_VER} \
28+
LLC=llc-${LLVM_VER} \
29+
LLVM_STRIP=llvm-strip-${LLVM_VER} \
30+
VMLINUX_BTF="${VMLINUX_BTF}" \
31+
VMLINUX_H="${VMLINUX_H}" \
32+
-C "${REPO_ROOT}/${REPO_PATH}/tools/testing/selftests/bpf" \
33+
-j $((4*$(nproc))) > /dev/null
34+
cd -
35+
mkdir "${LIBBPF_PATH}"/selftests
36+
cp -R "${REPO_ROOT}/${REPO_PATH}/tools/testing/selftests/bpf" \
37+
"${LIBBPF_PATH}"/selftests
38+
cd "${LIBBPF_PATH}"
39+
rm selftests/bpf/.gitignore
40+
git add selftests
41+
42+
travis_fold end prepare_selftests

.github/actions/vmtest/helpers.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# $1 - start or end
2+
# $2 - fold identifier, no spaces
3+
# $3 - fold section description
4+
travis_fold() {
5+
local YELLOW='\033[1;33m'
6+
local NOCOLOR='\033[0m'
7+
if [ -z ${GITHUB_WORKFLOW+x} ]; then
8+
echo travis_fold:$1:$2
9+
if [ ! -z "${3:-}" ]; then
10+
echo -e "${YELLOW}$3${NOCOLOR}"
11+
fi
12+
echo
13+
else
14+
if [ $1 = "start" ]; then
15+
line="::group::$2"
16+
if [ ! -z "${3:-}" ]; then
17+
line="$line - ${YELLOW}$3${NOCOLOR}"
18+
fi
19+
else
20+
line="::endgroup::"
21+
fi
22+
echo -e "$line"
23+
fi
24+
}
25+
26+
__print() {
27+
local TITLE=""
28+
if [[ -n $2 ]]; then
29+
TITLE=" title=$2"
30+
fi
31+
echo "::$1${TITLE}::$3"
32+
}
33+
34+
# $1 - title
35+
# $2 - message
36+
print_error() {
37+
__print error $1 $2
38+
}
39+
40+
# $1 - title
41+
# $2 - message
42+
print_notice() {
43+
__print notice $1 $2
44+
}

.github/workflows/test.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: bpf-ci
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ci-test-${{ github.head_ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
VM_Test:
12+
runs-on: ${{ matrix.runs_on }}
13+
name: Kernel ${{ matrix.kernel }} on ${{ matrix.runs_on }} + selftests
14+
timeout-minutes: 100
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- kernel: 'LATEST'
20+
runs_on: ubuntu-latest
21+
arch: 'x86_64'
22+
- kernel: 'LATEST'
23+
runs_on: z15
24+
arch: 's390x'
25+
env:
26+
AUTHOR_EMAIL: "$(git log -1 --pretty=\"%aE\")"
27+
KERNEL: LATEST
28+
REPO_ROOT: ${{ github.workspace }}
29+
REPO_PATH: ""
30+
steps:
31+
- uses: actions/checkout@v2
32+
- if: ${{ github.repository != 'kernel-patches/bpf' && github.repository != 'kernel-patches/bpf-rc' }}
33+
name: Download bpf-next tree
34+
uses: libbpf/ci/get-linux-source@master
35+
with:
36+
dest: '.kernel'
37+
- if: ${{ github.repository != 'kernel-patches/bpf' && github.repository != 'kernel-patches/bpf-rc' }}
38+
name: Move linux source in place
39+
shell: bash
40+
run: |
41+
rm -rf .kernel/.git
42+
cp -rf .kernel/. .
43+
rm -rf .kernel
44+
- uses: libbpf/ci/patch-kernel@master
45+
with:
46+
patches-root: '${{ github.workspace }}/travis-ci/diffs'
47+
repo-root: '${{ github.workspace }}'
48+
- uses: ./.github/actions/vmtest
49+
with:
50+
arch: ${{ matrix.arch }}

README

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +0,0 @@
1-
Linux kernel
2-
============
3-
4-
There are several guides for kernel developers and users. These guides can
5-
be rendered in a number of formats, like HTML and PDF. Please read
6-
Documentation/admin-guide/README.rst first.
7-
8-
In order to build the documentation, use ``make htmldocs`` or
9-
``make pdfdocs``. The formatted documentation can also be read online at:
10-
11-
https://www.kernel.org/doc/html/latest/
12-
13-
There are various text files in the Documentation/ subdirectory,
14-
several of them using the Restructured Text markup notation.
15-
16-
Please read the Documentation/process/changes.rst file, as it contains the
17-
requirements for building and running the kernel, and information about
18-
the problems which may result by upgrading your kernel.

0 commit comments

Comments
 (0)