Skip to content

Commit

Permalink
add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwei37 committed Aug 10, 2024
1 parent f93c625 commit f42fa1a
Show file tree
Hide file tree
Showing 181 changed files with 69,541 additions and 191 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/test-aot-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and test AOT cli

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
container:
- ubuntu-2204
- fedora-39
runs-on: ubuntu-latest
container:
image: "manjusakalza/bpftime-base-image:${{matrix.container}}"
options: --privileged
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Build and install everything
run: |
make release-with-llvm-jit -j
- name: Do compilation & run
run: |
export PATH=$PATH:~/.bpftime
cd .github/assets
bpftime-vm build sum.bpf.o
echo "AwAAAAEAAAACAAAAAwAAAA==" | base64 -d > test.bin
program_output=$(bpftime-vm run test.o test.bin)
echo $program_output
if echo $program_output | grep "Output: 6"; then
echo "Successful!"
exit 0
else
echo "Not found!"
exit 1
fi
41 changes: 41 additions & 0 deletions .github/workflows/test-llvm-jit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Run unit tests of llvm-jit

on:
push:
branches: "master"
pull_request:
branches: "master"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
container:
- ubuntu-2204
- fedora-39
runs-on: ubuntu-22.04
container:
image: "manjusakalza/bpftime-base-image:${{matrix.container}}"
options: --privileged
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Build and install everything
run: |
make build-llvm -j
- name: Run tests
run: |
./build/vm/llvm-jit/unit-test/llvm_jit_tests
- name: build llvm JIT/AOT as a standalone library
run: |
cd vm/llvm-jit &&\
cmake -B build -DCMAKE_BUILD_TYPE=Release &&\
cmake --build build --target all -j
- name: build vm as a standalone library
run: |
cd vm && make build-llvm -j
46 changes: 46 additions & 0 deletions .github/workflows/test-vm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Test VM

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
container:
- ubuntu-2204
- fedora-39
container:
image: "manjusakalza/bpftime-base-image:${{matrix.container}}"
options: --privileged
steps:

- name: cache dependencies
uses: actions/cache@v2
id: cache
with:
path: ${{ github.workspace }}/${{ env.INSTALL_LOCATION }}
key: ${{ runner.os }}-dependencies
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: actions/setup-python@v4
if: startsWith(matrix.container,'ubuntu')
with:
python-version: '3.8'
- name: build
run: make build-vm
- name: run tests x86
shell: bash
run: |
python3.8 -m venv vm/test
source vm/test/bin/activate
pip install -r vm/test/requirements.txt
# make build # or build-arm32 build-arm64
make -C vm test-vm -j
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
build
/.vscode
/.cache
test*
libvm-bpf.a
CMakeCache.txt
CMakeFiles
_deps
cmake_install.cmake
compile_commands.json
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ bpftime_add_library(bpftime_llvm_jit_vm
src/llvm/llvm_jit_context.cpp
src/llvm/compiler.cpp
src/llvm/compiler_utils.cpp
src/compat/compat_llvm.cpp
)

set_target_properties(bpftime_llvm_jit_vm PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../")
Expand All @@ -58,10 +57,18 @@ else()
endif()

if(NOT DEFINED SPDLOG_INCLUDE)
message(INFO "Adding spdlog seperately..")
message(INFO " Adding spdlog seperately..")
# spdlog
add_subdirectory(../../third_party/spdlog ${CMAKE_CURRENT_BINARY_DIR}/spdlog)
set(SPDLOG_INCLUDE ../../third_party/spdlog/include)
include(FetchContent)

# Fetch spdlog
FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG v1.14.1 # Specify the version you want to use
)
# Make the spdlog target available
FetchContent_MakeAvailable(spdlog)
endif()

# if BPFTIME_LLVM_JIT is set, then it's built in the bpftime project.
Expand Down
2 changes: 1 addition & 1 deletion example/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "compat_llvm.hpp"
#include "llvm_jit_context.hpp"
#include <cstdint>
#include <iostream>
#include <ostream>
Expand Down
60 changes: 0 additions & 60 deletions include/compat_llvm.hpp

This file was deleted.

File renamed without changes.
125 changes: 0 additions & 125 deletions src/compat/compat_llvm.cpp

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
myenv
bin
lib
lib64
pyvenv.cfg
/man
Loading

0 comments on commit f42fa1a

Please sign in to comment.