Skip to content

Commit

Permalink
ci: add a simple testing workflow
Browse files Browse the repository at this point in the history
.github/scripts/setup.sh installs dependencies necessary to build and
run the tests, assuming Ubuntu-like environment.

libfuse2t64 is a runtime dependency for appimages [1], and bpftrace
binary is distributed as an appimage.

[1] https://github.com/appimage/appimagekit/wiki/fuse

Signed-off-by: Ihor Solodrai <[email protected]>
  • Loading branch information
theihor authored and anakryiko committed Jan 23, 2025
1 parent 0e39201 commit 7c158fe
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -euo pipefail

BPFTRACE_VERSION=${BPFTRACE_VERSION:-0.22.1}

# Assume sudo in this script

# Install dependencies
apt update && apt install -y make file gawk libfuse2t64

# Download bpftrace release
BIN_DIR=/usr/local/bin
mkdir -p $BIN_DIR
curl -L -o bpftrace https://github.com/bpftrace/bpftrace/releases/download/v${BPFTRACE_VERSION}/bpftrace
chmod +x bpftrace
mv bpftrace $BIN_DIR
bpftrace --version

# mount tracefs to avoid warnings from bpftrace
grep -q tracefs /proc/mounts || mount -t tracefs tracefs /sys/kernel/tracing
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: USDT CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install prerequisites
run: sudo .github/scripts/setup.sh

- name: Build (static)
run: make SHARED=0 -C tests -j$(nproc) build

- name: Build (shared)
run: make SHARED=1 -C tests -j$(nproc) build

- name: Test (static)
run: make SHARED=0 -C tests test

- name: Test (shared)
run: make SHARED=1 -C tests test

0 comments on commit 7c158fe

Please sign in to comment.