From 840c417a71304cdfb889852565e80d6f7538b8a5 Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Fri, 15 Apr 2022 18:15:17 +0800 Subject: [PATCH] run tests via Github Action --- .github/workflows/integration.yml | 30 ++++++++++++++++++++++++++++++ tests/Makefile | 2 +- tests/scripts/image-init-lib.sh | 2 +- tests/scripts/test-lib.sh | 2 +- tools/test-github.sh | 14 ++++++++++++++ 5 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/integration.yml create mode 100755 tools/test-github.sh diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 00000000..fb0c4e17 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,30 @@ +name: Integration Test + +on: + pull_request: + branches: [ github_action ] + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 45 + concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }} + cancel-in-progress: true + strategy: + matrix: + container: [ + "fedora:35", + ] + fail-fast: false + container: + image: ghcr.io/coiby/${{ matrix.container }} + options: "--privileged -v /dev:/dev -v /lib/modules:/lib/modules:ro" + steps: + - name: "Checkout Repository" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: "${{ matrix.container }} kdump tests" + run: bash ./tools/test-github.sh diff --git a/tests/Makefile b/tests/Makefile index 8fb38c7a..6d811446 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -42,7 +42,7 @@ all: $(TEST_ROOT)/output/test-base-image # to rebuild the rpm, currently use rpmbuild to have better control over the rpm building process # $(KEXEC_TOOLS_RPM): $(KEXEC_TOOLS_SRC) - sh -c "cd .. && fedpkg sources" + sh -c "cd .. && fedpkg --debug --verbose --release f$(RELEASE) sources" @echo Rebuilding RPM due to modification of sources: $? rpmbuild $(RPMDEFINE) -ba $(REPO)/$(SPEC) diff --git a/tests/scripts/image-init-lib.sh b/tests/scripts/image-init-lib.sh index c9da0eee..5b298b44 100644 --- a/tests/scripts/image-init-lib.sh +++ b/tests/scripts/image-init-lib.sh @@ -263,7 +263,7 @@ create_image_from_base_image() { if [ "$image_fmt" != "raw" ]; then if fmt_is_qcow2 "$image_fmt"; then echo "Source image is qcow2, using snapshot..." - qemu-img create -f qcow2 -b $image $output + qemu-img create -f qcow2 -b $image -F qcow2 $output else perror_exit "Unrecognized base image format '$image_mnt'" fi diff --git a/tests/scripts/test-lib.sh b/tests/scripts/test-lib.sh index 8b24b2ad..3a6da0bb 100644 --- a/tests/scripts/test-lib.sh +++ b/tests/scripts/test-lib.sh @@ -89,7 +89,7 @@ run_test_sync() { local qemu_cmd=$(get_test_qemu_cmd $1) if [ -n "$qemu_cmd" ]; then - timeout --foreground 10m $BASEDIR/run-qemu $(get_test_qemu_cmd $1) + timeout --foreground 15m $BASEDIR/run-qemu $(get_test_qemu_cmd $1) else echo "error: test qemu command line is not configured" > /dev/stderr return 1 diff --git a/tools/test-github.sh b/tools/test-github.sh new file mode 100755 index 00000000..3a17c441 --- /dev/null +++ b/tools/test-github.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -ex + +[[ -d ${0%/*} ]] && cd "${0%/*}"/../ + +source /etc/os-release + +cd tests + + +git remote add fedora_src https://src.fedoraproject.org/rpms/kexec-tools.git +git config --add branch.f$VERSION_ID.remote fedora_src + +RELEASE=$VERSION_ID make test-run