Skip to content

Commit

Permalink
Add github actions for basic testing
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bene42 committed Sep 12, 2023
1 parent 986d4a2 commit f5f8566
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/scripts/install_all.sh
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions .github/scripts/setup_repo.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .github/scripts/update_sources_list.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions .github/templates/reprepro/conf/distributions
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .github/templates/reprepro/conf/options
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
verbose
ask-passphrase
98 changes: 98 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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

0 comments on commit f5f8566

Please sign in to comment.