mirror of
https://github.com/netdata/libbpf.git
synced 2026-04-05 16:19:06 +08:00
Migrate libbpf ci to GH actions
changes to docker command require to run it in non-interactive mode
This commit is contained in:
committed by
Andrii Nakryiko
parent
899c45baa2
commit
5d5af3f07e
16
.github/actions/debian/action.yml
vendored
Normal file
16
.github/actions/debian/action.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: 'debian'
|
||||||
|
description: 'Build'
|
||||||
|
inputs:
|
||||||
|
target:
|
||||||
|
description: 'Run target'
|
||||||
|
required: true
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
source /tmp/ci_setup
|
||||||
|
bash -x $CI_ROOT/managers/debian.sh SETUP
|
||||||
|
bash -x $CI_ROOT/managers/debian.sh ${{ inputs.target }}
|
||||||
|
bash -x $CI_ROOT/managers/debian.sh CLEANUP
|
||||||
|
shell: bash
|
||||||
|
|
||||||
20
.github/actions/setup/action.yml
vendored
Normal file
20
.github/actions/setup/action.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
name: 'setup'
|
||||||
|
description: 'setup env, create /tmp/ci_setup'
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- id: variables
|
||||||
|
run: |
|
||||||
|
export REPO_ROOT=$GITHUB_WORKSPACE
|
||||||
|
export CI_ROOT=$REPO_ROOT/travis-ci
|
||||||
|
# this is somewhat ugly, but that is the easiest way to share this code with
|
||||||
|
# arch specific docker
|
||||||
|
echo export DEBIAN_FRONTEND=noninteractive > /tmp/ci_setup
|
||||||
|
echo sudo apt-get install -y aptitude qemu-kvm zstd binutils-dev elfutils libcap-dev libelf-dev libdw-dev >> /tmp/ci_setup
|
||||||
|
echo export PROJECT_NAME='libbpf' >> /tmp/ci_setup
|
||||||
|
echo export AUTHOR_EMAIL="$(git log -1 --pretty=\"%aE\")" >> /tmp/ci_setup
|
||||||
|
echo export REPO_ROOT=$GITHUB_WORKSPACE >> /tmp/ci_setup
|
||||||
|
echo export CI_ROOT=$REPO_ROOT/travis-ci >> /tmp/ci_setup
|
||||||
|
echo export VMTEST_ROOT=$CI_ROOT/vmtest >> /tmp/ci_setup
|
||||||
|
shell: bash
|
||||||
|
|
||||||
15
.github/actions/vmtest/action.yml
vendored
Normal file
15
.github/actions/vmtest/action.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
name: 'vmtest'
|
||||||
|
description: 'Build + run vmtest'
|
||||||
|
inputs:
|
||||||
|
kernel:
|
||||||
|
description: 'kernel or LATEST'
|
||||||
|
required: true
|
||||||
|
default: 'LATEST'
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
source /tmp/ci_setup
|
||||||
|
export KERNEL=${{ inputs.kernel }}
|
||||||
|
$CI_ROOT/vmtest/run_vmtest.sh
|
||||||
|
shell: bash
|
||||||
85
.github/workflows/test.yml
vendored
Normal file
85
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
name: libbpf-ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 18 * * *'
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
vmtest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Kernel ${{ matrix.kernel }} + selftests
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- kernel: 'LATEST'
|
||||||
|
- kernel: '5.5.0'
|
||||||
|
- kernel: '4.9.0'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/actions/setup
|
||||||
|
- uses: ./.github/actions/vmtest
|
||||||
|
with:
|
||||||
|
kernel: ${{ matrix.kernel }}
|
||||||
|
|
||||||
|
debian:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Debian Build (${{ matrix.name }})
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: default
|
||||||
|
target: RUN
|
||||||
|
- name: ASan+UBSan
|
||||||
|
target: RUN_ASAN
|
||||||
|
- name: clang
|
||||||
|
target: RUN_CLANG
|
||||||
|
- name: clang ASan+UBSan
|
||||||
|
target: RUN_CLANG_ASAN
|
||||||
|
- name: gcc-10
|
||||||
|
target: RUN_GCC10
|
||||||
|
- name: gcc-10 ASan+UBSan
|
||||||
|
target: RUN_GCC10_ASAN
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/actions/setup
|
||||||
|
- uses: ./.github/actions/debian
|
||||||
|
with:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
|
||||||
|
ubuntu:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Ubuntu Focal Build (${{ matrix.arch }})
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- arch: aarch64
|
||||||
|
- arch: ppc64le
|
||||||
|
- arch: s390x
|
||||||
|
- arch: x86
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/actions/setup
|
||||||
|
- run: source /tmp/ci_setup && sudo -E $CI_ROOT/managers/ubuntu.sh
|
||||||
|
if: matrix.arch == 'x86'
|
||||||
|
- uses: uraimo/run-on-arch-action@v2.0.5
|
||||||
|
name: Build in docker
|
||||||
|
if: matrix.arch != 'x86'
|
||||||
|
with:
|
||||||
|
distro:
|
||||||
|
ubuntu20.04
|
||||||
|
arch:
|
||||||
|
${{ matrix.arch }}
|
||||||
|
setup:
|
||||||
|
cp /tmp/ci_setup $GITHUB_WORKSPACE
|
||||||
|
dockerRunArgs: |
|
||||||
|
--volume "${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}"
|
||||||
|
shell: /bin/bash
|
||||||
|
install: |
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
export TZ="America/Los_Angeles"
|
||||||
|
apt-get update -y
|
||||||
|
apt-get install -y tzdata build-essential sudo
|
||||||
|
run: source ${GITHUB_WORKSPACE}/ci_setup && $CI_ROOT/managers/ubuntu.sh
|
||||||
@@ -18,7 +18,7 @@ function error() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function docker_exec() {
|
function docker_exec() {
|
||||||
docker exec $ENV_VARS -it $CONT_NAME "$@"
|
docker exec $ENV_VARS $CONT_NAME "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|||||||
@@ -2,11 +2,23 @@
|
|||||||
# $2 - fold identifier, no spaces
|
# $2 - fold identifier, no spaces
|
||||||
# $3 - fold section description
|
# $3 - fold section description
|
||||||
travis_fold() {
|
travis_fold() {
|
||||||
local YELLOW='\033[1;33m'
|
local YELLOW='\033[1;33m'
|
||||||
local NOCOLOR='\033[0m'
|
local NOCOLOR='\033[0m'
|
||||||
echo travis_fold:$1:$2
|
if [ -z ${GITHUB_WORKFLOW+x} ]; then
|
||||||
if [ ! -z "${3:-}" ]; then
|
echo travis_fold:$1:$2
|
||||||
echo -e "${YELLOW}$3${NOCOLOR}"
|
if [ ! -z "${3:-}" ]; then
|
||||||
fi
|
echo -e "${YELLOW}$3${NOCOLOR}"
|
||||||
echo
|
fi
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
if [ $1 = "start" ]; then
|
||||||
|
line="::group::$2"
|
||||||
|
if [ ! -z "${3:-}" ]; then
|
||||||
|
line="$line - ${YELLOW}$3${NOCOLOR}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
line="::endgroup"
|
||||||
|
fi
|
||||||
|
echo -e "$line"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -436,11 +436,15 @@ sudo umount "$mnt"
|
|||||||
|
|
||||||
echo "Starting VM with $(nproc) CPUs..."
|
echo "Starting VM with $(nproc) CPUs..."
|
||||||
|
|
||||||
|
if kvm-ok ; then
|
||||||
|
accel="-cpu kvm64 -enable-kvm"
|
||||||
|
else
|
||||||
|
accel="-cpu qemu64 -machine accel=tcg"
|
||||||
|
fi
|
||||||
qemu-system-x86_64 -nodefaults -display none -serial mon:stdio \
|
qemu-system-x86_64 -nodefaults -display none -serial mon:stdio \
|
||||||
-cpu kvm64 -enable-kvm -smp "$(nproc)" -m 4G \
|
${accel} -smp "$(nproc)" -m 4G \
|
||||||
-drive file="$IMG",format=raw,index=1,media=disk,if=virtio,cache=none \
|
-drive file="$IMG",format=raw,index=1,media=disk,if=virtio,cache=none \
|
||||||
-kernel "$vmlinuz" -append "root=/dev/vda rw console=ttyS0,115200$APPEND"
|
-kernel "$vmlinuz" -append "root=/dev/vda rw console=ttyS0,115200$APPEND"
|
||||||
|
|
||||||
sudo mount -o loop "$IMG" "$mnt"
|
sudo mount -o loop "$IMG" "$mnt"
|
||||||
if exitstatus="$(cat "$mnt/exitstatus" 2>/dev/null)"; then
|
if exitstatus="$(cat "$mnt/exitstatus" 2>/dev/null)"; then
|
||||||
printf '\nTests exit status: %s\n' "$exitstatus" >&2
|
printf '\nTests exit status: %s\n' "$exitstatus" >&2
|
||||||
|
|||||||
Reference in New Issue
Block a user