Skip to content

Commit

Permalink
[ci] introduce CI to build examples against LLVM 14 to 16
Browse files Browse the repository at this point in the history
Simple CI workflow that will build both C and Rust examples.
  • Loading branch information
chantra authored and anakryiko committed Sep 20, 2022
1 parent 938651f commit e6e46a5
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/docker/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
ARG VERSION="22.04"
FROM ubuntu:${VERSION}

ARG LLVM_VERSION="14"
ENV LLVM_VERSION=$LLVM_VERSION

ARG SHORTNAME="jammy"

RUN apt-get update && apt-get install -y curl gnupg
RUN if [ "${LLVM_VERSION}" = "16" ]; \
then \
echo "\n\
deb http://apt.llvm.org/${SHORTNAME}/ llvm-toolchain-${SHORTNAME} main\n\
deb-src http://apt.llvm.org/${SHORTNAME}/ llvm-toolchain-${SHORTNAME} main\n\
" >> /etc/apt/sources.list;\
else \
echo "\n\
deb http://apt.llvm.org/${SHORTNAME}/ llvm-toolchain-${SHORTNAME}-${LLVM_VERSION} main\n\
deb-src http://apt.llvm.org/${SHORTNAME}/ llvm-toolchain-${SHORTNAME}-${LLVM_VERSION} main\n\
" >> /etc/apt/sources.list; \
fi
RUN curl -L https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -

ARG DEBIAN_FRONTEND="noninteractive"
ENV TZ="Etc/UTC"

RUN apt-get update && apt-get install -y \
libelf-dev \
zlib1g-dev \
libbfd-dev \
clang-${LLVM_VERSION} \
libclang-${LLVM_VERSION}-dev \
libclang-common-${LLVM_VERSION}-dev \
libclang1-${LLVM_VERSION} \
llvm-${LLVM_VERSION} \
llvm-${LLVM_VERSION}-dev \
llvm-${LLVM_VERSION}-runtime \
libllvm${LLVM_VERSION} \
make pkg-config \
rustc cargo rustfmt \
sudo \
&& apt-get -y clean

RUN ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang && ln -s /usr/bin/llvm-strip-${LLVM_VERSION} /usr/bin/llvm-strip
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: libbpf-bootstrap build

on:
push:
branches:
- master
pull_request:

jobs:
build_libbpf_bootstrap:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
llvm: [14, 15, 16]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Build container
uses: docker/build-push-action@v3
with:
push: false
build-args: LLVM_VERSION=${{ matrix.llvm }}
file: ./.github/docker/Dockerfile.ubuntu
tags: build_container
- name: Build examples/c
run: |
docker run \
-v $(pwd):/libbpf-bootstrap \
build_container \
/bin/bash -c \
'cd /libbpf-bootstrap/examples/c && make'
- name: Build examples/rust
run: |
docker run \
-v $(pwd):/libbpf-bootstrap \
build_container \
/bin/bash -c \
'cd /libbpf-bootstrap/examples/rust && cargo build'

0 comments on commit e6e46a5

Please sign in to comment.