From e8364666d5acc985c434fb574e92c5206d9a8d6b Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Mon, 15 May 2023 00:42:45 +0530 Subject: CI: Add build matrix with multiple Linux distributions set SETUPTOOLS_SCM_PRETEND_VERSION="0" variable because GitHub Actions does not copy the .git directory into the container. Without that, the build fails with the following error LookupError: setuptools-scm was unable to detect version for /__w/dtc/dtc. Signed-off-by: Biswapriyo Nath Signed-off-by: David Gibson --- .github/workflows/build.yml | 28 ++++++++++++++++------------ scripts/install-deps.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 12 deletions(-) create mode 100755 scripts/install-deps.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6daaa8d..442d98b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,22 +12,26 @@ jobs: build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: [ "alpine", "archlinux", "fedora", "ubuntu" ] + + container: + image: ${{ matrix.os }} + steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - name: Install Dependencies - run: - sudo apt install - flex - libyaml-dev - pkg-config - python3-dev - swig - valgrind - bison + run: | + ./scripts/install-deps.sh - name: Build - run: make + run: | + SETUPTOOLS_SCM_PRETEND_VERSION="0" make - name: Run check - run: make check + run: | + SETUPTOOLS_SCM_PRETEND_VERSION="0" make check diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh new file mode 100755 index 0000000..4076310 --- /dev/null +++ b/scripts/install-deps.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later + +if [ -f /etc/os-release ] +then + . /etc/os-release +else + echo "ERROR: OS name is not provided." + exit 1 +fi + +if [ "$NAME" = "Arch Linux" ] +then + pacman -Syu --needed --noconfirm bison diffutils flex gcc git libyaml \ + make pkgconf python python-setuptools-scm swig valgrind which +elif [ "$NAME" = "Alpine Linux" ] +then + apk add build-base bison coreutils flex git yaml yaml-dev python3-dev \ + py3-setuptools_scm swig valgrind +elif [ "$NAME" = "Fedora Linux" ] +then + dnf install -y bison diffutils flex gcc git libyaml libyaml-devel \ + make python3-devel python3-setuptools swig valgrind which +elif [ "$NAME" = "Ubuntu" ] +then + apt update + apt install -yq build-essential bison flex git libyaml-dev pkg-config \ + python3-dev python3-setuptools python3-setuptools-scm swig valgrind +else + echo "ERROR: OS name is not provided." + exit 1 +fi -- cgit v1.2.1