test: add github test environment action

Create a github action that accepts any command with args and runs
it in a container that is prepared with all the dependencies for
koji (hub, builder, command line), so all tests, like pylint or
unit tests can run in it.
This commit is contained in:
Christian Kellner 2020-09-12 15:57:46 +02:00
parent 0180bce383
commit 734d039089
3 changed files with 39 additions and 0 deletions

21
test/Dockerfile Normal file
View file

@ -0,0 +1,21 @@
FROM docker.io/library/fedora:latest
RUN dnf -y upgrade \
&& dnf -y \
--setopt=fastestmirror=True \
--setopt=install_weak_deps=False \
install \
koji-builder \
koji-hub \
koji-utils \
koji \
postgresql \
pylint \
python3-flexmock \
python3-jsonschema \
python3-koji \
&& dnf clean all
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

12
test/action.yml Normal file
View file

@ -0,0 +1,12 @@
name: 'Koji plugin test environment'
description: 'Environment prepared for running koji plugin tests'
inputs:
run:
description: 'What to run'
required: true
default: 'echo "Nothing to do"'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.run }}

6
test/entrypoint.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh -l
set -euo pipefail
cd $GITHUB_WORKSPACE
/bin/bash -o errexit -c "$1"