diff --git a/.github/workflows/test_distros.yml b/.github/workflows/test_distros.yml new file mode 100644 index 0000000..8f61aea --- /dev/null +++ b/.github/workflows/test_distros.yml @@ -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' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d36fdad..0000000 --- a/.travis.yml +++ /dev/null @@ -1,81 +0,0 @@ ---- -language: bash -dist: focal -sudo: enabled -branches: - only: - - master - - development - - testing - -matrix: - include: - - name: "CentOS 7" - env: - - DISTRO='centos:7' - - REGISTRY=quay.io/centos - - name: "CentOS 8" - env: - - DISTRO='centos:8' - - REGISTRY=quay.io/centos - - name: "CentOS stream 8" - env: - - DISTRO='centos:stream8' - - REGISTRY=quay.io/centos - - name: "Ubuntu 18.04 (bionic)" - env: - - DISTRO='ubuntu:18.04' - - REGISTRY=mirror.gcr.io/library - - name: "Ubuntu 20.04 (focal)" - env: - - DISTRO='ubuntu:20.04' - - REGISTRY=mirror.gcr.io/library - - name: "Debian 9 (stretch)" - env: - - DISTRO='debian:stretch' - - REGISTRY=mirror.gcr.io/library - - name: "Debian 10 (buster)" - env: - - DISTRO='debian:buster' - - REGISTRY=mirror.gcr.io/library - - name: "Fedora (latest)" - env: - - DISTRO='fedora:latest' - - REGISTRY=registry.fedoraproject.org - - name: "Fedora (rawhide)" - env: - - DISTRO='fedora:rawhide' - - REGISTRY=registry.fedoraproject.org - -before_install: - - docker pull ${REGISTRY}/${DISTRO} - -install: - - | - docker run \ - --detach \ - --rm \ - --tty \ - --privileged \ - --network=host \ - --name recap_on_${DISTRO/:/_} \ - --mount type=bind,src="$(pwd)",dst=/recap \ - ${REGISTRY}/${DISTRO} - - docker exec recap_on_${DISTRO/:/_} /recap/tests/install_deps.sh ${DISTRO} - - docker exec recap_on_${DISTRO/:/_} /recap/tests/test_install_recap.sh - -script: - - docker exec recap_on_${DISTRO/:/_} bash -c 'recap --version' - - docker exec recap_on_${DISTRO/:/_} bash -c 'recaplog --version' - - docker exec recap_on_${DISTRO/:/_} /recap/tests/run_recap.sh - - docker exec recap_on_${DISTRO/:/_} bash -c 'ls -tr /var/log/recap/*log | xargs tail -v -n+0' - - docker exec recap_on_${DISTRO/:/_} /recap/tests/run_recaplog.sh - - docker exec recap_on_${DISTRO/:/_} bash -c 'tail -v -n+0 /var/log/recap/recaplog.log' - - docker exec recap_on_${DISTRO/:/_} bash -c 'recap -p list' - - docker exec recap_on_${DISTRO/:/_} bash -c 'recap -p list enabled' - - docker exec recap_on_${DISTRO/:/_} bash -c 'recap -p enable all' - - docker exec recap_on_${DISTRO/:/_} bash -c 'recap -p list enabled' - - docker exec recap_on_${DISTRO/:/_} bash -c 'recap -p list disabled' - - docker exec recap_on_${DISTRO/:/_} bash -c 'recap -p disable all' - - docker exec recap_on_${DISTRO/:/_} bash -c 'recap -p list disabled' - - docker exec recap_on_${DISTRO/:/_} bash -c 'recap -p list enabled' diff --git a/tests/install_deps.sh b/tests/install_deps.sh index ed64abe..64581d7 100755 --- a/tests/install_deps.sh +++ b/tests/install_deps.sh @@ -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+=( diff --git a/tests/run_recap.sh b/tests/run_recap.sh index bbeb584..6bb7f28 100755 --- a/tests/run_recap.sh +++ b/tests/run_recap.sh @@ -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