#!/bin/bash

# Explicitly setting the architecture to use
ARCH=${ARCH:-x86_64}

# Where the connect-ng source is located within the container
SOURCE=${SOURCE:-/usr/src/connect-ng}

# Where is the rpm build environment to be found
BUILD_DIR=${BUILD_DIR:-/usr/src/packages}

group() { echo "::group::$1"; }
groupend() { echo "::groupend::"; }
fail() { echo "::error::$1"; exit 1; }

group "install suseconnect"
pushd "$BUILD_DIR/RPMS/${ARCH}"
  zypper --non-interactive --no-refresh install --allow-unsigned-rpm *.rpm
  zypper --non-interactive --no-refresh install systemd
popd
groupend

group "install cucumber"
pushd "$SOURCE/features"
  bundle install
popd
groupend
