forked from libbpf/libbpf-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] introduce CI to build examples against LLVM 14 to 16
Simple CI workflow that will build both C and Rust examples.
- Loading branch information
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |