mirror of
https://github.com/falcosecurity/falco.git
synced 2025-10-21 19:44:57 +00:00
wip: include regression tests in master's CI
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
111
.github/workflows/ci.yml
vendored
111
.github/workflows/ci.yml
vendored
@@ -11,8 +11,31 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-minimal:
|
||||
runs-on: ubuntu-20.04
|
||||
fetch-version:
|
||||
uses: ./.github/workflows/reusable_fetch_version.yaml
|
||||
|
||||
build-dev-packages:
|
||||
needs: [fetch-version]
|
||||
uses: ./.github/workflows/reusable_build_packages.yaml
|
||||
with:
|
||||
arch: x86_64
|
||||
version: ${{ needs.fetch-version.outputs.version }}
|
||||
|
||||
test-dev-packages:
|
||||
needs: [fetch-version, build-dev-packages]
|
||||
uses: ./.github/workflows/reusable_test_packages.yaml
|
||||
with:
|
||||
arch: x86_64
|
||||
version: ${{ needs.fetch-version.outputs.version }}
|
||||
|
||||
build-dev:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
machine: ['ubuntu-20.04']
|
||||
buildmode: ['Debug', 'Release']
|
||||
minimal: ['', 'minimal']
|
||||
runs-on: ${{ matrix.machine }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
@@ -22,83 +45,25 @@ jobs:
|
||||
|
||||
- name: Update base image
|
||||
run: sudo apt update -y
|
||||
|
||||
|
||||
- name: Install build dependencies
|
||||
run: sudo DEBIAN_FRONTEND=noninteractive apt install libjq-dev libyaml-cpp-dev libelf-dev cmake build-essential git -y
|
||||
|
||||
- name: Prepare project
|
||||
run: |
|
||||
mkdir build-minimal
|
||||
pushd build-minimal
|
||||
cmake -DMINIMAL_BUILD=On -DBUILD_BPF=Off -DBUILD_DRIVER=Off -DCMAKE_BUILD_TYPE=Release -DBUILD_FALCO_UNIT_TESTS=On ..
|
||||
popd
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
pushd build-minimal
|
||||
make -j4 all
|
||||
popd
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
pushd build-minimal
|
||||
sudo ./unit_tests/falco_unit_tests
|
||||
popd
|
||||
|
||||
build-ubuntu-focal:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Update base image
|
||||
run: sudo apt update -y
|
||||
|
||||
- name: Install build dependencies
|
||||
run: sudo DEBIAN_FRONTEND=noninteractive apt install libssl-dev libyaml-dev libc-ares-dev libprotobuf-dev protobuf-compiler libjq-dev libyaml-cpp-dev libgrpc++-dev protobuf-compiler-grpc rpm libelf-dev cmake build-essential libcurl4-openssl-dev linux-headers-$(uname -r) clang llvm git -y
|
||||
run: sudo DEBIAN_FRONTEND=noninteractive apt install libjq-dev libelf-dev libyaml-cpp-dev cmake build-essential git -y
|
||||
|
||||
- name: Install build dependencies (non-minimal)
|
||||
if: matrix.minimal != 'minimal'
|
||||
run: sudo DEBIAN_FRONTEND=noninteractive apt install libssl-dev libyaml-dev libc-ares-dev libprotobuf-dev protobuf-compiler libgrpc++-dev protobuf-compiler-grpc rpm libcurl4-openssl-dev linux-headers-$(uname -r) clang llvm -y
|
||||
|
||||
- name: Prepare project
|
||||
run: |
|
||||
mkdir build
|
||||
pushd build
|
||||
cmake -DBUILD_BPF=On -DCMAKE_BUILD_TYPE=Release -DBUILD_FALCO_UNIT_TESTS=On ..
|
||||
popd
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
pushd build
|
||||
KERNELDIR=/lib/modules/$(uname -r)/build make -j4 all
|
||||
popd
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
pushd build
|
||||
sudo ./unit_tests/falco_unit_tests
|
||||
popd
|
||||
|
||||
build-ubuntu-focal-debug:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Update base image
|
||||
run: sudo apt update -y
|
||||
|
||||
- name: Install build dependencies
|
||||
run: sudo DEBIAN_FRONTEND=noninteractive apt install libssl-dev libyaml-dev libc-ares-dev libprotobuf-dev protobuf-compiler libjq-dev libyaml-cpp-dev libgrpc++-dev protobuf-compiler-grpc rpm libelf-dev cmake build-essential libcurl4-openssl-dev linux-headers-$(uname -r) clang llvm git -y
|
||||
|
||||
- name: Prepare project
|
||||
run: |
|
||||
mkdir build
|
||||
pushd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_BPF=On -DBUILD_FALCO_UNIT_TESTS=On ..
|
||||
cmake \
|
||||
-DBUILD_FALCO_UNIT_TESTS=On \
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.buildmode }} \
|
||||
-DBUILD_BPF=${{ matrix.minimal == 'minimal' && 'OFF' || 'ON' }} \
|
||||
-DBUILD_DRIVER=${{ matrix.minimal == 'minimal' && 'OFF' || 'ON' }} \
|
||||
-DMINIMAL_BUILD=${{ matrix.minimal == 'minimal' && 'ON' || 'OFF' }} \
|
||||
..
|
||||
popd
|
||||
|
||||
- name: Build
|
||||
|
49
.github/workflows/master.yaml
vendored
49
.github/workflows/master.yaml
vendored
@@ -9,37 +9,8 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# We need to use an ubuntu-latest to fetch Falco version because
|
||||
# Falco version is computed by some cmake scripts that do git sorceries
|
||||
# to get the current version.
|
||||
# But centos7 jobs have a git version too old and actions/checkout does not
|
||||
# fully clone the repo, but uses http rest api instead.
|
||||
fetch-version:
|
||||
runs-on: ubuntu-latest
|
||||
# Map the job outputs to step outputs
|
||||
outputs:
|
||||
version: ${{ steps.store_version.outputs.version }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y cmake build-essential
|
||||
|
||||
- name: Configure project
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -DUSE_BUNDLED_DEPS=On ..
|
||||
|
||||
- name: Load and store Falco version output
|
||||
id: store_version
|
||||
run: |
|
||||
FALCO_VERSION=$(cat build/userspace/falco/config_falco.h | grep 'FALCO_VERSION ' | cut -d' ' -f3 | sed -e 's/^"//' -e 's/"$//')
|
||||
echo "version=${FALCO_VERSION}" >> $GITHUB_OUTPUT
|
||||
uses: ./.github/workflows/reusable_fetch_version.yaml
|
||||
|
||||
build-dev-packages:
|
||||
needs: [fetch-version]
|
||||
@@ -56,9 +27,23 @@ jobs:
|
||||
arch: aarch64
|
||||
version: ${{ needs.fetch-version.outputs.version }}
|
||||
secrets: inherit
|
||||
|
||||
|
||||
test-dev-packages:
|
||||
needs: [fetch-version, build-dev-packages]
|
||||
uses: ./.github/workflows/reusable_test_packages.yaml
|
||||
with:
|
||||
arch: x86_64
|
||||
version: ${{ needs.fetch-version.outputs.version }}
|
||||
|
||||
test-dev-packages-arm64:
|
||||
needs: [fetch-version, build-dev-packages-arm64]
|
||||
uses: ./.github/workflows/reusable_test_packages.yaml
|
||||
with:
|
||||
arch: aarch64
|
||||
version: ${{ needs.fetch-version.outputs.version }}
|
||||
|
||||
publish-dev-packages:
|
||||
needs: [fetch-version, build-dev-packages, build-dev-packages-arm64]
|
||||
needs: [fetch-version, test-dev-packages, test-dev-packages-arm64]
|
||||
uses: ./.github/workflows/reusable_publish_packages.yaml
|
||||
with:
|
||||
bucket_suffix: '-dev'
|
||||
|
40
.github/workflows/reusable_fetch_version.yaml
vendored
Normal file
40
.github/workflows/reusable_fetch_version.yaml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# This is a reusable workflow used by master and release CI
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
version:
|
||||
description: "Falco version"
|
||||
value: ${{ jobs.fetch-version.outputs.version }}
|
||||
|
||||
jobs:
|
||||
# We need to use an ubuntu-latest to fetch Falco version because
|
||||
# Falco version is computed by some cmake scripts that do git sorceries
|
||||
# to get the current version.
|
||||
# But centos7 jobs have a git version too old and actions/checkout does not
|
||||
# fully clone the repo, but uses http rest api instead.
|
||||
fetch-version:
|
||||
runs-on: ubuntu-latest
|
||||
# Map the job outputs to step outputs
|
||||
outputs:
|
||||
version: ${{ steps.store_version.outputs.version }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y cmake build-essential
|
||||
|
||||
- name: Configure project
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -DUSE_BUNDLED_DEPS=On ..
|
||||
|
||||
- name: Load and store Falco version output
|
||||
id: store_version
|
||||
run: |
|
||||
FALCO_VERSION=$(cat build/userspace/falco/config_falco.h | grep 'FALCO_VERSION ' | cut -d' ' -f3 | sed -e 's/^"//' -e 's/"$//')
|
||||
echo "version=${FALCO_VERSION}" >> $GITHUB_OUTPUT
|
67
.github/workflows/reusable_test_packages.yaml
vendored
Normal file
67
.github/workflows/reusable_test_packages.yaml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# This is a reusable workflow used by master and release CI
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
arch:
|
||||
description: x86_64 or aarch64
|
||||
required: true
|
||||
type: string
|
||||
version:
|
||||
description: The Falco version to use when testing packages
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
test-packages:
|
||||
# See https://github.com/actions/runner/issues/409#issuecomment-1158849936
|
||||
runs-on: ${{ (inputs.arch == 'aarch64' && fromJSON('[ "self-hosted", "linux", "ARM64" ]')) || 'ubuntu-latest' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: 'true'
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: '>=1.17.0'
|
||||
|
||||
- name: Download binary
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: falco-${{ inputs.version }}-${{ inputs.arch }}.tar.gz
|
||||
|
||||
- name: Install Falco package
|
||||
run: |
|
||||
tar -xvf $(ls falco-*.tar.gz)
|
||||
cd $(ls falco-*.tar.gz | sed -e 's/\.tar\.gz$//')
|
||||
sudo cp -r * /
|
||||
|
||||
- name: Install go-junit-report
|
||||
run: |
|
||||
pushd submodules/falcosecurity-testing
|
||||
go install github.com/jstemmer/go-junit-report/v2@latest
|
||||
popd
|
||||
|
||||
- name: Generate regression test files
|
||||
run: |
|
||||
pushd submodules/falcosecurity-testing
|
||||
go generate ./...
|
||||
popd
|
||||
|
||||
- name: Run regression tests
|
||||
run: |
|
||||
pushd submodules/falcosecurity-testing
|
||||
./build/falco.test -test.timeout=90s -test.v >> ./report.txt 2>&1 || true
|
||||
./build/falcoctl.test -test.timeout=90s -test.v >> ./report.txt 2>&1 || true
|
||||
./build/k8saudit.test -test.timeout=90s -test.v >> ./report.txt 2>&1 || true
|
||||
cat ./report.txt | go-junit-report -set-exit-code > report.xml
|
||||
popd
|
||||
|
||||
- name: Test Summary
|
||||
if: always() # run this even if previous step fails
|
||||
uses: test-summary/action@v2
|
||||
with:
|
||||
paths: "submodules/falcosecurity-testing/report.xml"
|
||||
show: "fail"
|
Reference in New Issue
Block a user