From f5f856698ad27d620b04c99ab0c83409aab80d98 Mon Sep 17 00:00:00 2001 From: Benedikt Spranger Date: Mon, 11 Sep 2023 21:03:54 +0200 Subject: [PATCH] Add github actions for basic testing Add basic tests to ensure E.L.B.E. is building and can be installed: - Build Debian Stable packages - Build Debian Unstable packages - Build Ubuntu packages and install all packages Signed-off-by: Benedikt Spranger --- .github/scripts/install_all.sh | 7 ++ .github/scripts/setup_repo.sh | 13 +++ .github/scripts/update_sources_list.sh | 8 ++ .github/templates/reprepro/conf/distributions | 7 ++ .github/templates/reprepro/conf/options | 2 + .github/workflows/main.yml | 98 +++++++++++++++++++ 6 files changed, 135 insertions(+) create mode 100755 .github/scripts/install_all.sh create mode 100755 .github/scripts/setup_repo.sh create mode 100755 .github/scripts/update_sources_list.sh create mode 100644 .github/templates/reprepro/conf/distributions create mode 100644 .github/templates/reprepro/conf/options create mode 100644 .github/workflows/main.yml diff --git a/.github/scripts/install_all.sh b/.github/scripts/install_all.sh new file mode 100755 index 000000000..c906957f2 --- /dev/null +++ b/.github/scripts/install_all.sh @@ -0,0 +1,7 @@ +#! /bin/bash + +ARCH="$(dpkg-architecture -q DEB_BUILD_ARCH)" +DIST="$(. /etc/os-release; echo ${VERSION_CODENAME/*, /})" + +cd repo +reprepro list "$DIST" | awk '{print "sudo apt-get install -y "$2}' | sh diff --git a/.github/scripts/setup_repo.sh b/.github/scripts/setup_repo.sh new file mode 100755 index 000000000..b481091fa --- /dev/null +++ b/.github/scripts/setup_repo.sh @@ -0,0 +1,13 @@ +#! /bin/bash + +ARCH="$(dpkg-architecture -q DEB_BUILD_ARCH)" +DIST="$(. /etc/os-release; echo ${VERSION_CODENAME/*, /})" + +mkdir repo +cp -a .github/templates/reprepro/* repo +cd repo + +find . -type f -exec sed -i -e "s/@ARCH@/${ARCH}/" -e "s/@DIST@/${DIST}/" {} \; + +reprepro --ignore=wrongdistribution include "$DIST" ../../*_${ARCH}.changes +reprepro --ignore=wrongdistribution include "$DIST" ../contrib/*_${ARCH}.changes diff --git a/.github/scripts/update_sources_list.sh b/.github/scripts/update_sources_list.sh new file mode 100755 index 000000000..a1e69846b --- /dev/null +++ b/.github/scripts/update_sources_list.sh @@ -0,0 +1,8 @@ +#! /bin/bash + +DIST="$(. /etc/os-release; echo ${VERSION_CODENAME/*, /})" + +echo "deb [trusted=yes] file://$(pwd)/repo ${DIST} main" \ + > /etc/apt/sources.list.d/elbe.list + +apt-get update diff --git a/.github/templates/reprepro/conf/distributions b/.github/templates/reprepro/conf/distributions new file mode 100644 index 000000000..296e56ab3 --- /dev/null +++ b/.github/templates/reprepro/conf/distributions @@ -0,0 +1,7 @@ +Origin: elbe +Label: elbe +Codename: @DIST@ +Architectures: source @ARCH@ +Components: main +Description: E.L.B.E. packages repository (unsafe) +# SignWith: 8044921302364FBDC541F38971F7AE8C018CE6CB diff --git a/.github/templates/reprepro/conf/options b/.github/templates/reprepro/conf/options new file mode 100644 index 000000000..10c27c277 --- /dev/null +++ b/.github/templates/reprepro/conf/options @@ -0,0 +1,2 @@ +verbose +ask-passphrase diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..6e33fa2be --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,98 @@ +name: "E.L.B.E. test runner" + +# Controls when the action will run. Triggers the workflow on push or pull +# request events but only for the master branch +on: + workflow_dispatch: {} + push: + branches: + - master + - 'devel/**' + pull_request: + branches: + - master + - 'devel/**' + +# A workflow run is made up of one or more jobs that can run sequentially or +# in parallel +jobs: + Build-for-stable: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Build E.L.B.E. Debian stable packages + uses: jtdor/build-deb-action@v1.7.0 + with: + docker-image: debian:stable-slim + artifacts-dir: stable + + - name: Retrieve results + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: stable + path: | + stable/ + if-no-files-found: warn + + Build-for-unstable: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Build E.L.B.E. Debian stable packages + uses: jtdor/build-deb-action@v1.7.0 + with: + docker-image: debian:unstable-slim + artifacts-dir: unstable + + - name: Retrieve results + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: unstable + path: | + unstable/ + if-no-files-found: warn + + Run-on-Ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install tools + run: sudo apt-get install -y config-package-dev devscripts git-buildpackage lighttpd reprepro + + - name: Create build environment + run: ARCH="$(dpkg-architecture -q DEB_BUILD_ARCH)" DIST="$(. /etc/os-release; echo ${VERSION_CODENAME/*, /})" git-pbuilder create + + - name: Build E.L.B.E. packages + run: gbp buildpackage -nc --git-debian-branch="$(git branch --show-current)" --git-pbuilder --git-dist="$(. /etc/os-release; echo ${VERSION_CODENAME/*, /})" --git-arch="$(dpkg-architecture -q DEB_BUILD_ARCH)" + + - name: Build configuration package + run: cd contrib/debathena-transform-lighttpd; ARCH="$(dpkg-architecture -q DEB_BUILD_ARCH)" DIST="$(. /etc/os-release; echo ${VERSION_CODENAME/*, /})" git-pbuilder -nc + + - name: Build Repo + run: ./.github/scripts/setup_repo.sh + + - name: Retrieve results + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: repo + path: | + repo/ + if-no-files-found: warn + + - name: Prepare to use Repo + run: sudo ./.github/scripts/update_sources_list.sh + + - name: Install E.L.B.E. + run: sudo apt-get install -y elbe + + - name: Show E.L.B.E. version + run: elbe --version + + - name: Install all E.L.B.E. packages + run: sudo ./.github/scripts/install_all.sh