Browse Source

CI: add build-test github action

Alessandro Decina 3 years ago
parent
commit
d085bdb89f
1 changed files with 37 additions and 0 deletions
  1. 37 0
      .github/workflows/build-test.yml

+ 37 - 0
.github/workflows/build-test.yml

@@ -0,0 +1,37 @@
+name: Build
+
+on:
+  push:
+    branches:
+      - main
+      - ci
+
+  pull_request:
+    branches:
+      - main
+
+env:
+  CARGO_TERM_COLOR: always
+
+jobs:
+  build:
+    runs-on: ubuntu-20.04
+
+    steps:
+      - uses: actions/checkout@v2
+      - uses: Swatinem/rust-cache@v1
+      - name: Install LLVM
+        run: |
+          wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
+          echo -e "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main\n" | sudo tee /etc/apt/sources.list.d/llvm.list
+          sudo apt-get update
+          sudo apt-get install llvm-11-dev libclang-11-dev
+
+      - name: Install bpf-linker
+        run: cargo install bpf-linker
+
+      - name: Build
+        run: cargo build --verbose
+
+      - name: Run tests
+        run: RUST_BACKTRACE=full cargo test --verbose --tests