From 705b55e1f8fb237e49f8a4e06877f67b94a0aadc Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Tue, 19 Dec 2023 23:42:40 +0300 Subject: [PATCH] Add linux packaging testing CI Signed-off-by: Vitalii Koshura --- .github/workflows/debrepo/Dockerfile | 55 ----- .github/workflows/linux-package.yml | 200 +++++++++++++++++- .github/workflows/rpmrepo/Dockerfile.fedora | 55 ----- .github/workflows/rpmrepo/Dockerfile.suse | 57 ----- .../linux_package_tests/integration_tests.py | 1 + 5 files changed, 199 insertions(+), 169 deletions(-) delete mode 100644 .github/workflows/debrepo/Dockerfile delete mode 100644 .github/workflows/rpmrepo/Dockerfile.fedora delete mode 100644 .github/workflows/rpmrepo/Dockerfile.suse create mode 100644 tests/linux_package_tests/integration_tests.py diff --git a/.github/workflows/debrepo/Dockerfile b/.github/workflows/debrepo/Dockerfile deleted file mode 100644 index 1e8519275b..0000000000 --- a/.github/workflows/debrepo/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# This file is part of BOINC. -# http://boinc.berkeley.edu -# Copyright (C) 2023 University of California -# -# BOINC is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, -# either version 3 of the License, or (at your option) any later version. -# -# BOINC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with BOINC. If not, see . - -# example build usage: -# LINUX: export BUILDKIT_PROGRESS=plain -# WINDOWS: set BUILDKIT_PROGRESS=plain -# docker build -t jammy-boinc --build-arg PACKAGE=boinc-linux-client --build-arg VERSION=1.0.0-1 -f ./Dockerfile . - -ARG DISTRO=ubuntu -ARG RELEASE=jammy - -FROM $DISTRO:$RELEASE - -# All args are cleared after a FROM instruction -ARG RELEASE=jammy - -ARG REPOBASE=https://boinc.berkeley.edu/dl/linux -ARG REPOTYPE=stable -ARG PACKAGE=boinc-linux-client -ARG VERSION=1.0.0-1 -ARG REPOKEY=boinc.gpg - -USER root - -WORKDIR /root - -RUN bash -c 'apt update && apt-get install -y wget gnupg ca-certificates' - -RUN bash -c 'wget $REPOBASE/$REPOTYPE/$RELEASE/$REPOKEY' - -RUN bash -c 'apt-key add $REPOKEY' - -RUN bash -c 'echo "deb $REPOBASE/$REPOTYPE/$RELEASE $RELEASE main" >> /etc/apt/sources.list' - -RUN bash -c 'cat /etc/apt/sources.list' - -RUN bash -c 'apt update' - -RUN bash -c 'apt list -a $PACKAGE' - -RUN bash -c 'apt-get install -y $PACKAGE=$VERSION' diff --git a/.github/workflows/linux-package.yml b/.github/workflows/linux-package.yml index c93581ffdb..8c3adbd923 100644 --- a/.github/workflows/linux-package.yml +++ b/.github/workflows/linux-package.yml @@ -409,11 +409,207 @@ jobs: name: linux-package_${{ matrix.type }}_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} path: rpmbuild/RPMS/${{ env.ARCH }}/${{ env.PKG_FULL }}.rpm + test-debian-deb-package: + name: Test Debian DEB Package + runs-on: ubuntu-latest + container: + image: debian:${{ matrix.os }} + needs: build-deb-package + strategy: + matrix: + os: [bullseye, buster] + fail-fast: false + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Install dependencies + if: success() + run: | + apt update -qq + apt install -y python3 + + - name: Download client + if: success() + uses: actions/download-artifact@v3 + with: + name: linux-package_client_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} + + - name: Download manager + if: success() + uses: actions/download-artifact@v3 + with: + name: linux-package_manager_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} + + - name: Install client and manager + if: success() + run: | + apt update -qq + apt install -y $(find ./ -type f -name "boinc-client*.deb" -printf "%p\n") + apt install -y $(find ./ -type f -name "boinc-manager*.deb" -printf "%p\n") + + - name: Run integration tests + if: success() + run: | + python3 ./tests/linux_package_tests/integration_tests.py + + test-ubuntu-deb-package: + name: Test Ubuntu DEB Package + runs-on: ubuntu-latest + container: + image: ubuntu:${{ matrix.os }} + needs: build-deb-package + strategy: + matrix: + os: [jammy, focal] + fail-fast: false + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Install dependencies + if: success() + run: | + apt update -qq + apt install -y python3 + + - name: Download client + if: success() + uses: actions/download-artifact@v3 + with: + name: linux-package_client_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} + + - name: Download manager + if: success() + uses: actions/download-artifact@v3 + with: + name: linux-package_manager_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} + + - name: Install client and manager + if: success() + run: | + apt update -qq + apt install -y $(find ./ -type f -name "boinc-client*.deb" -printf "%p\n") + apt install -y $(find ./ -type f -name "boinc-manager*.deb" -printf "%p\n") + + - name: Run integration tests + if: success() + run: | + python3 ./tests/linux_package_tests/integration_tests.py + + test-fedora-rpm-package: + name: Test Fedora RPM Package + runs-on: ubuntu-latest + container: + image: fedora:${{ matrix.os }} + needs: build-rpm-package + strategy: + matrix: + os: [37, 38] + fail-fast: false + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Install dependencies + if: success() + run: | + dnf install -y python3 + + - name: Get OS name + if: success() + run: | + if [[ "${{ matrix.os }}" == "37" ]]; then + OS="fc37" + elif [[ "${{ matrix.os }}" == "38" ]]; then + OS="fc38" + fi + echo "OS=${OS}" >> $GITHUB_ENV + + - name: Download client + if: success() + uses: actions/download-artifact@v3 + with: + name: linux-package_client_${{ env.OS }}_${{ github.event.pull_request.head.sha }} + + - name: Download manager + if: success() + uses: actions/download-artifact@v3 + with: + name: linux-package_manager_${{ env.OS }}_${{ github.event.pull_request.head.sha }} + + - name: Install client and manager + if: success() + run: | + yum localinstall -y $(find ./ -type f -name "boinc-client*.rpm" -printf "%p\n") + yum localinstall -y $(find ./ -type f -name "boinc-manager*.rpm" -printf "%p\n") + + - name: Run integration tests + if: success() + run: | + python3 ./tests/linux_package_tests/integration_tests.py + + test-opensuse-rpm-package: + name: Test openSUSE RPM Package + runs-on: ubuntu-latest + container: + image: opensuse/leap:${{ matrix.os }} + needs: build-rpm-package + strategy: + matrix: + os: [15.4, 15.5] + fail-fast: false + steps: + - name: Install dependencies + if: success() + run: | + zypper install -y python3 tar gzip + + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Get OS name + if: success() + run: | + if [[ "${{ matrix.os }}" == "15.4" ]]; then + OS="suse15_4" + elif [[ "${{ matrix.os }}" == "15.5" ]]; then + OS="suse15_5" + fi + echo "OS=${OS}" >> $GITHUB_ENV + + - name: Download client + if: success() + uses: actions/download-artifact@v3 + with: + name: linux-package_client_${{ env.OS }}_${{ github.event.pull_request.head.sha }} + + - name: Download manager + if: success() + uses: actions/download-artifact@v3 + with: + name: linux-package_manager_${{ env.OS }}_${{ github.event.pull_request.head.sha }} + + - name: Install client and manager + if: success() + run: | + zypper --no-gpg-checks install -y $(find ./ -type f -name "boinc-client*.rpm" -printf "%p\n") + zypper --no-gpg-checks install -y $(find ./ -type f -name "boinc-manager*.rpm" -printf "%p\n") + + - name: Run integration tests + if: success() + run: | + python3 ./tests/linux_package_tests/integration_tests.py + publish-deb-package: name: Publish DEB Package if: github.repository == 'BOINC/boinc' runs-on: ubuntu-latest - needs: build-deb-package + needs: [test-debian-deb-package, test-ubuntu-deb-package] strategy: matrix: os: [jammy, focal, bullseye, buster] @@ -506,7 +702,7 @@ jobs: runs-on: ubuntu-latest container: image: fedora:38 - needs: build-rpm-package + needs: [test-fedora-rpm-package, test-opensuse-rpm-package] strategy: matrix: os: [fc38, fc37, suse15_5, suse15_4] diff --git a/.github/workflows/rpmrepo/Dockerfile.fedora b/.github/workflows/rpmrepo/Dockerfile.fedora deleted file mode 100644 index fe41056ace..0000000000 --- a/.github/workflows/rpmrepo/Dockerfile.fedora +++ /dev/null @@ -1,55 +0,0 @@ -# This file is part of BOINC. -# http://boinc.berkeley.edu -# Copyright (C) 2023 University of California -# -# BOINC is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, -# either version 3 of the License, or (at your option) any later version. -# -# BOINC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with BOINC. If not, see . - -# example build usage: -# LINUX: export BUILDKIT_PROGRESS=plain -# WINDOWS: set BUILDKIT_PROGRESS=plain -# docker build -t fedora38-boinc --build-arg PACKAGE=boinc-linux-client --build-arg VERSION=1.0.0-1 -f ./Dockerfile . - -ARG DISTRO=fedora -ARG RELEASE=38 - -FROM $DISTRO:$RELEASE - -# All args are cleared after a FROM instruction -ARG RELEASE=38 - -ARG REPOBASE=https://boinc.berkeley.edu/dl/linux -ARG REPOTYPE=stable -ARG PACKAGE=boinc-linux-client -ARG VERSION=7.23.0-1 -ARG REPOKEY=boinc-202305.gpg - -USER root - -WORKDIR /root - -RUN bash -c 'echo "defaultyes=True" >> /etc/dnf/dnf.conf' - -RUN bash -c 'echo "fastestmirror=True" >> /etc/dnf/dnf.conf' - -RUN bash -c 'echo "max_parallel_downloads=10" >> /etc/dnf/dnf.conf' - -RUN bash -c 'dnf update && dnf -y install wget' - -RUN bash -c 'cd /etc/yum.repos.d && wget $REPOBASE/$REPOTYPE/fc$RELEASE/boinc-${REPOTYPE}-fc${RELEASE}.repo' - -RUN bash -c 'dnf update' - -RUN bash -c 'dnf list | grep $PACKAGE' - -RUN bash -c 'dnf -y install $PACKAGE-$VERSION' diff --git a/.github/workflows/rpmrepo/Dockerfile.suse b/.github/workflows/rpmrepo/Dockerfile.suse deleted file mode 100644 index a6fb398b98..0000000000 --- a/.github/workflows/rpmrepo/Dockerfile.suse +++ /dev/null @@ -1,57 +0,0 @@ -# This file is part of BOINC. -# http://boinc.berkeley.edu -# Copyright (C) 2023 University of California -# -# BOINC is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, -# either version 3 of the License, or (at your option) any later version. -# -# BOINC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with BOINC. If not, see . - -# example build usage: -# LINUX: export BUILDKIT_PROGRESS=plain -# WINDOWS: set BUILDKIT_PROGRESS=plain -# docker build -t jammy-boinc --build-arg PACKAGE=boinc-linux-client --build-arg VERSION=1.0.0-1 -f ./Dockerfile . - -ARG DISTRO=opensuse/leap -ARG RELEASE=15.5 - -FROM $DISTRO:$RELEASE - -# All args are cleared after a FROM instruction -ARG RELEASE=15.5 - -ARG REPOBASE=https://boinc.berkeley.edu/dl/linux -ARG REPOTYPE=stable -ARG PACKAGE=boinc-linux-client -ARG VERSION=7.23.0-1 -ARG REPOKEY=boinc.gpg - -USER root - -WORKDIR /root - -RUN bash -c 'zypper -n update && zypper install -y wget expect' - -RUN printf '#!/bin/bash -xe \n\ -cd /etc/zypp/repos.d \n\ -VARIANT=$(echo $RELEASE | sed -e "s|\.|_|\") \n\ -wget $REPOBASE/$REPOTYPE/suse$VARIANT/boinc-${REPOTYPE}-suse${VARIANT}.repo \n\ -' > update.sh - -RUN bash -c 'cat update.sh' - -RUN bash -x update.sh - -RUN bash -c 'expect -c 'spawn zypper --gpg-auto-import-keys update; expect "Continue? [yes/no] (no)"; send "yes\r"; interact' - -RUN bash -c 'zypper search -v $PACKAGE' - -RUN bash -c 'zypper -y install $PACKAGE=$VERSION' diff --git a/tests/linux_package_tests/integration_tests.py b/tests/linux_package_tests/integration_tests.py new file mode 100644 index 0000000000..b231225b56 --- /dev/null +++ b/tests/linux_package_tests/integration_tests.py @@ -0,0 +1 @@ +print("Here will be integration tests")