From 38e3b82a09cf42210c976da6889841ae5dca0943 Mon Sep 17 00:00:00 2001 From: Nardi Ivan Date: Fri, 17 May 2024 11:18:49 +0200 Subject: [PATCH] CI: WIP --- .github/workflows/build_non_x86_64_arch.yml | 95 +++++++++++++++++++++ tests/do.sh.in | 4 +- 2 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build_non_x86_64_arch.yml diff --git a/.github/workflows/build_non_x86_64_arch.yml b/.github/workflows/build_non_x86_64_arch.yml new file mode 100644 index 00000000000..bd970da1532 --- /dev/null +++ b/.github/workflows/build_non_x86_64_arch.yml @@ -0,0 +1,95 @@ +name: Build on non-x86_64 archs +on: [push, pull_request] + +jobs: + build_job: + # The host should always be linux + runs-on: ubuntu-22.04 + name: Build on ${{ matrix.distro }} ${{ matrix.arch }} + + # Run steps on a matrix of 4 arch/distro combinations + strategy: + matrix: + include: + - arch: aarch64 + distro: ubuntu22.04 + - arch: armv7 + distro: ubuntu22.04 + - arch: s390x + distro: ubuntu22.04 + steps: + - uses: actions/checkout@v4 + - uses: uraimo/run-on-arch-action@v2 + name: Build artifact + id: build + with: + arch: ${{ matrix.arch }} + distro: ${{ matrix.distro }} + + # Not required, but speeds up builds + githubToken: ${{ github.token }} + + # Create an artifacts directory + setup: | + mkdir -p "${PWD}/artifacts" + + # Mount the artifacts directory as /artifacts in the container + dockerRunArgs: | + --volume "${PWD}/artifacts:/artifacts" + + # Pass some environment variables to the container + env: | # YAML, but pipe character is necessary + artifact_name: git-${{ matrix.distro }}_${{ matrix.arch }} + + # The shell to run commands with in the container + shell: /bin/bash + + # Install some dependencies in the container. This speeds up builds if + # you are also using githubToken. Any dependencies installed here will + # be part of the container image that gets cached, so subsequent + # builds don't have to re-install them. The image layer is cached + # publicly in your project's package repository, so it is vital that + # no secrets are present in the container state or logs. + install: | + case "${{ matrix.distro }}" in + ubuntu*|jessie|stretch|buster|bullseye) + apt-get update -q -y + apt-get install -q -y make git wdiff colordiff autoconf automake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev rrdtool librrd-dev parallel + env_parallel --install + ;; + fedora*) + dnf -y update + #TODO + ;; + alpine*) + apk update + #TODO + ;; + esac + + # Produce a binary artifact and place it in the mounted volume + run: | + lscpu | grep Endian + lscpu | grep Architecture + echo $SHELL + ls -al /bin/bash + parallel --version + env_parallel + env_parallel --install + /bin/bash env_parallel + bash --version + cat /root/.bashrc + #git config --global --add safe.directory $(realpath .) + #NDPI_CFLAGS='-Wextra -Werror' ./autogen.sh --enable-option-checking=fatal --enable-debug-messages --enable-tls-sigs + #make -j $(nproc) all + #make -C example ndpiSimpleIntegration + #make -C rrdtool + #NDPI_FORCE_PARALLEL_UTESTS=1 NDPI_SKIP_PARALLEL_BAR=1 ./tests/do.sh + #./tests/do-unit.sh + #./tests/do-dga.sh + + - name: Show the artifact + # Items placed in /artifacts in the container will be in + # ${PWD}/artifacts on the host. + run: | + ls -al "${PWD}/artifacts" diff --git a/tests/do.sh.in b/tests/do.sh.in index d867bca0de1..896e253d894 100755 --- a/tests/do.sh.in +++ b/tests/do.sh.in @@ -78,6 +78,7 @@ if [ $FORCE_PARALLEL_UTESTS -eq 1 ]; then echo "$0: Try something like `apt install parallel`" exit 1 fi + #source `which env_parallel.bash` fi if [ ${GPROF_ENABLED} -eq 1 ]; then @@ -184,11 +185,10 @@ run_single_pcap() return 1 } -export -f run_single_pcap check_results() { if [ $FORCE_PARALLEL_UTESTS -eq 1 ]; then - parallel --bar --tag "run_single_pcap" ::: $PCAPS + env_parallel --bar --tag run_single_pcap ::: $PCAPS RET=$? #Number of failed job up to 100 RC=$(( RC + $RET )) else