From 690d6aa6d84e1ccab16ddeb0185f01309a93d9b5 Mon Sep 17 00:00:00 2001 From: Andrin Bertschi Date: Fri, 19 Apr 2024 17:25:41 +0200 Subject: [PATCH] build: add ci --- .github/workflows/ci.yaml | 22 +++++++++++++ misc/ci.sh | 67 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/workflows/ci.yaml create mode 100755 misc/ci.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..bd289e8 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,22 @@ +on: + push: + branches: + - master + + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +name: build-heckler-userspace +jobs: + run-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + run: | + sudo apt install -y python3 python3-pip python3-venv + ./misc/ci.sh + + \ No newline at end of file diff --git a/misc/ci.sh b/misc/ci.sh new file mode 100755 index 0000000..034f6ba --- /dev/null +++ b/misc/ci.sh @@ -0,0 +1,67 @@ +#!/bin/bash +set -euo pipefail + +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +root_dir=$script_dir/../ + +# +# simple ci for some basic tests +# + +function check_pgm() { + local pgm=$1 + + if ! command -v $pgm &> /dev/null + then + echo "$pgm could not be found" + exit 1 + fi +} + + +function ssh() { + cd $root_dir/userspace/ssh + make +} + +function sudo() { + cd $root_dir/userspace/sudo + make + +} + +function kernel() { + set -x + source $root_dir/stable-commits + + mkdir -p $root_dir/linux/host + git clone --depth 1 -b $KERNEL_HOST_BRANCH $KERNEL_GIT_URL $root_dir/linux/host || true + cd $root_dir/linux/host + make headers +} + +function attack() { + set -x + cd $root_dir/userspace/sev-step + make + + cd $root_dir/userspace/heckler_bindings + make + + cd $root_dir/userspace/attack + make + + make test +} + +check_pgm python +check_pgm make +check_pgm gcc + + +ssh +sudo +kernel +attack + +