Skip to content

Commit

Permalink
Merge pull request #250 from tonyskapunk/gha_ci
Browse files Browse the repository at this point in the history
Use diff CI to test recap in supported distros
  • Loading branch information
tonyskapunk authored Aug 14, 2022
2 parents 26910c6 + 933c526 commit 28cbcb9
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 91 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/test_distros.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Test distros
on:
pull_request:
branches:
- master
- development
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: "centos_8"
registry: quay.io/centos/centos:stream8
- name: "centos_9"
registry: quay.io/centos/centos:stream9
- name: "ubuntu_22.04"
registry: mirror.gcr.io/library/ubuntu:22.04
- name: "ubuntu_20.04"
registry: mirror.gcr.io/library/ubuntu:20.04
- name: "debian_11"
registry: mirror.gcr.io/library/debian:bullseye
- name: "fedora_latest"
registry: quay.io/fedora/fedora:latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Run container
run: >
sudo
podman run
--pull always
--detach
--rm
--tty
--privileged
--network=host
--name ${{ matrix.name }}
--mount type=bind,src="$(pwd)",dst=/recap
${{ matrix.registry }}
- name: Install in container
run: >
sudo
podman exec
${{ matrix.name }}
bash -c '/recap/tests/install_deps.sh ${{ matrix.name }} && /recap/tests/test_install_recap.sh'
- name: Run Tests in container
run: |
sudo podman exec ${{ matrix.name }} bash -c 'recap --version'
sudo podman exec ${{ matrix.name }} bash -c 'recaplog --version'
sudo podman exec ${{ matrix.name }} /recap/tests/run_recap.sh
sudo podman exec ${{ matrix.name }} bash -c 'ls -tr /var/log/recap/*log | xargs tail -v -n+0'
sudo podman exec ${{ matrix.name }} /recap/tests/run_recaplog.sh
sudo podman exec ${{ matrix.name }} bash -c 'tail -v -n+0 /var/log/recap/recaplog.log'
sudo podman exec ${{ matrix.name }} bash -c 'recap -p list'
sudo podman exec ${{ matrix.name }} bash -c 'recap -p list enabled'
sudo podman exec ${{ matrix.name }} bash -c 'recap -p enable all'
sudo podman exec ${{ matrix.name }} bash -c 'recap -p list enabled'
sudo podman exec ${{ matrix.name }} bash -c 'recap -p list disabled'
sudo podman exec ${{ matrix.name }} bash -c 'recap -p disable all'
sudo podman exec ${{ matrix.name }} bash -c 'recap -p list disabled'
sudo podman exec ${{ matrix.name }} bash -c 'recap -p list enabled'
81 changes: 0 additions & 81 deletions .travis.yml

This file was deleted.

11 changes: 5 additions & 6 deletions tests/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ case ${DISTRO} in
;;
centos*)
packages+=(
"procps-ng"
"psmisc"
"iproute"
)
version=$(grep -Po "[0-9]+" <<<${DISTRO/*:/})
version=$(grep -Po "[0-9]+" <<<${DISTRO/*_/})
if [[ ${version} -ge 8 ]]; then
packages+=(
"procps-ng"
)
extra_args+="--enablerepo=powertools "
# elinks is not available in centos stream
packages=( ${packages[@]/elinks} )
fi
yum install --assumeyes ${extra_args} ${packages[@]} || exit $?
dnf install --assumeyes ${packages[@]} || exit $?
;;
debian*|ubuntu*)
packages+=(
Expand Down
6 changes: 2 additions & 4 deletions tests/run_recap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
# Get full path to recap
recap_path=$(type -p recap)

# Insert 'set -e' on line 2 of recap to exit after any failure
sed -i "2iset -e" "${recap_path}";

# Save debugging info and record the status of the recap run
debug_info=$(bash -x "${recap_path}" 2>&1)
# exiting on any failure
debug_info=$(bash -xe "${recap_path}" 2>&1)
stat=$?

# Save the debugging info that occurred right before the cleanup operation
Expand Down

0 comments on commit 28cbcb9

Please sign in to comment.