Skip to content

local: workflow: exercise nft #489

local: workflow: exercise nft

local: workflow: exercise nft #489

name: Build and Test
on: [push, pull_request]
env:
python_default: 3.12
jobs:
build-dpdk:
env:
dependencies: gcc libbpf-dev libnuma-dev libpcap-dev ninja-build pkgconf
CC: gcc
DPDK_GIT: https://dpdk.org/git/dpdk-stable
DPDK_VER: 23.11.1
name: dpdk gcc
outputs:
dpdk_key: ${{ steps.gen_dpdk_key.outputs.key }}
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- name: checkout
uses: actions/checkout@v4
- name: update PATH
run: |
echo "$HOME/bin" >> $GITHUB_PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: create ci signature file for the dpdk cache key
# This will collect most of DPDK related lines, so hash will be different
# if something changed in a way we're building DPDK including DPDK_VER.
# This also allows us to use cache from any branch as long as version
# and a way we're building DPDK stays the same.
run: |
cat .ci/dpdk-* > dpdk-ci-signature
grep -rwE 'DPDK_GIT|DPDK_VER' .github/ >> dpdk-ci-signature
if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then
git ls-remote --heads $DPDK_GIT $DPDK_VER >> dpdk-ci-signature
fi
cat dpdk-ci-signature
- name: generate ci DPDK key
id: gen_dpdk_key
env:
ci_key: ${{ hashFiles('dpdk-ci-signature') }}
run: echo 'key=dpdk-${{ env.ci_key }}' >> $GITHUB_OUTPUT
- name: cache
id: dpdk_cache
uses: actions/cache@v4
with:
path: dpdk-dir
key: ${{ steps.gen_dpdk_key.outputs.key }}
- name: set up python
if: steps.dpdk_cache.outputs.cache-hit != 'true'
uses: actions/setup-python@v5
with:
python-version: ${{ env.python_default }}
- name: update APT cache
if: steps.dpdk_cache.outputs.cache-hit != 'true'
run: sudo apt update || true
- name: install common dependencies
if: steps.dpdk_cache.outputs.cache-hit != 'true'
run: sudo apt install -y ${{ env.dependencies }}
- name: prepare
if: steps.dpdk_cache.outputs.cache-hit != 'true'
run: ./.ci/dpdk-prepare.sh
- name: build
if: steps.dpdk_cache.outputs.cache-hit != 'true'
run: ./.ci/dpdk-build.sh
build-linux:
needs: build-dpdk
env:
dependencies: |
automake libtool gcc bc libjemalloc2 libjemalloc-dev libssl-dev \
llvm-dev libnuma-dev libpcap-dev selinux-policy-dev libbpf-dev \
lftp libreswan
CC: ${{ matrix.compiler }}
DPDK: ${{ matrix.dpdk }}
DPDK_SHARED: ${{ matrix.dpdk_shared }}
LIBS: ${{ matrix.libs }}
M32: ${{ matrix.m32 }}
OPTS: ${{ matrix.opts }}
SANITIZERS: ${{ matrix.sanitizers }}
STD: ${{ matrix.std }}
TESTSUITE: ${{ matrix.testsuite }}
TEST_RANGE: ${{ matrix.test_range }}
name: linux ${{ join(matrix.*, ' ') }}
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- compiler: gcc
testsuite: check-offloads
test_range: "-100"
steps:
- name: checkout
uses: actions/checkout@v4
- name: update PATH
run: |
echo "$HOME/bin" >> $GITHUB_PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: set up python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python_default }}
- name: cache
if: matrix.dpdk != '' || matrix.dpdk_shared != ''
uses: actions/cache@v4
with:
path: dpdk-dir
key: ${{ needs.build-dpdk.outputs.dpdk_key }}
- name: update APT cache
run: sudo apt update || true
- name: install common dependencies
run: sudo apt install -y ${{ env.dependencies }}
- name: install libunbound libunwind python3-unbound
# GitHub Actions doesn't have 32-bit versions of these libraries.
if: matrix.m32 == ''
run: sudo apt install -y libunbound-dev libunwind-dev python3-unbound
- name: install 32-bit libraries
if: matrix.m32 != ''
run: sudo apt install -y gcc-multilib
- name: Reduce ASLR entropy
if: matrix.sanitizers != ''
# Asan in llvm 14 provided in ubuntu-22.04 is incompatible with
# high-entropy ASLR configured in much newer kernels that GitHub
# runners are using leading to random crashes:
# https://github.com/actions/runner-images/issues/9491
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: check tools
run: |
which iptables
which jq
which nft
- name: prepare
run: ./.ci/linux-prepare.sh
- name: build
run: ./.ci/linux-build.sh
- name: copy logs
run: |
# upload-artifact throws exceptions if it tries to upload socket
# files and we could have some socket files in testsuite.dir.
# Also, upload-artifact doesn't work well enough with wildcards.
# So, we're just archiving everything here to avoid any issues.
mkdir logs
cp config.log ./logs/
cp -r ./*/_build/sub/tests/testsuite.* ./logs/ || true
sudo cp -r ./tests/*testsuite.* ./logs/ || true
sudo tar -czvf logs.tgz logs/
- name: upload
uses: actions/upload-artifact@v4
with:
name: logs-linux-${{ join(matrix.*, '-') }}
path: logs.tgz