From d01669aa58cfabeeff859819334b697984e69988 Mon Sep 17 00:00:00 2001 From: David Steele Date: Wed, 9 Dec 2020 15:19:01 -0500 Subject: [PATCH] Move most tests to Github Actions. Testing on Travis-CI has been getting slower (from ~18 minutes to 3-6 hours) and the travis-ci.org service will be terminated at the end of the year. Moving to travis-ci.com is an option but the quotas are too low for our purposes. Instead use Github Actions, which does not currently have quotas, and runs our current tests with just a few tweaks. This still leaves multi-architecture tests on Travis-CI but we may be able to run those and stay within the new quotas. Also fix a minor bug in restoreTest.c exposed by Github Actions using a different name for the user and group. --- .github/workflows/test.yml | 52 ++++++++++++++++++++++++ .travis.yml | 50 ++++------------------- doc/xml/contributing.xml | 7 ++++ test/{travis.pl => ci.pl} | 16 ++++---- test/lib/pgBackRestTest/Common/VmTest.pm | 4 +- test/src/module/command/restoreTest.c | 4 +- 6 files changed, 81 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/test.yml rename test/{travis.pl => ci.pl} (95%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..e1a5cef2c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,52 @@ +name: test + +on: + push: + branches: + - integration + - '**-ci' + - '**-cig' + pull_request: + +jobs: + test: + runs-on: ubuntu-18.04 + + strategy: + # Let all the jobs run to completion even if one fails + fail-fast: false + + # The first jobs should be the canaries in the coal mine, i.e. the most likely to fail if there are problems in the code. They + # should also be a good mix of unit, integration, and documentation tests. + # + # In general tests should be ordered from slowest to fastest. This does not make a difference for testing a single commit, but + # when multiple commits are being tested it is best to have the slowest jobs first so that as jobs become available they will + # tackle the slowest tests first. + matrix: + include: + # All unit (without coverage) and integration tests for 32-bit + - param: test --vm=u12 --param=no-performance + + # Debian/Ubuntu documentation + - param: doc --vm=u18 + + # All integration tests + - param: test --vm=u18 --param=build-package --param=module=mock --param=module=real + + # All unit tests (with coverage) on the newest gcc available + - param: test --vm=f32 --param=c-only --param=no-performance --param=tz=America/New_York + + # RHEL/CentOS 7 documentation + - param: doc --vm=co7 + + # All integration tests + - param: test --vm=co7 --param=module=mock --param=module=real + + steps: + - name: Checkout Code + uses: actions/checkout@v2 + with: + path: pgbackrest + + - name: Run Test + run: cd ${HOME?} && ${GITHUB_WORKSPACE?}/pgbackrest/test/ci.pl ${{matrix.param}} diff --git a/.travis.yml b/.travis.yml index 314b7d0d9..2682c72eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,65 +5,33 @@ branches: - /-cit$/ os: linux -dist: trusty +dist: bionic language: c -services: - - docker - jobs: - # The first five jobs should be the canaries in the coal mine, i.e. the most likely to fail if there are problems in the code. - # They should also be a good mix of unit, integration, and documentation tests. - # - # In general tests should be ordered from slowest to fastest for the first five jobs (the maximum concurrent jobs allowed), then - # slowest to fastest for the rest of the tests. This does not make a difference for testing a single commit, but when multiple - # commits are being tested it is best to have the slowest jobs first so that as jobs become available they will tackle the slowest - # tests first. + # Run unit tests that provide wide coverage on multiple architectures. include: - # All unit (without coverage) and integration tests for 32-bit - - env: PGB_CI="test --vm=u12 --param=no-performance" - - # Debian/Ubuntu documentation - - env: PGB_CI=" doc --vm=u18" - - # All integration tests - - env: PGB_CI="test --vm=u18 --param=build-package --param=module=mock --param=module=real" - # Valgrind is disabled due to some platform-specific issues in getpwuid() and getgrgid() that do not seem to be pgBackRest bugs. - # Run in a different timezone to check time tests. - arch: ppc64le - dist: bionic env: - - PGB_CI="test --vm=none --param=no-valgrind --param=tz=America/New_York" + - PGB_CI="test --vm=none --param=no-coverage --param=module=command --param=module=storage --param=no-valgrind" services: - # All unit tests (with coverage) on the newest gcc available - - env: PGB_CI="test --vm=f32 --param=c-only --param=no-performance" - - # RHEL/CentOS 7 documentation - - env: PGB_CI=" doc --vm=co7" - - # Basic unit tests only because arm64 is slow. Coverage testing is also disabled to save time. - arch: arm64 - dist: bionic env: - PGB_CI="test --vm=none --param=no-coverage --param=module=command --param=module=storage" services: - # All integration tests - - env: PGB_CI="test --vm=co7 --param=module=mock --param=module=real" - - # Basic unit tests only. Coverage testing is also disabled to save time. - # - arch: s390x - # dist: bionic - # env: - # - PGB_CI="test --vm=none --param=no-coverage --param=module=command --param=module=storage" - # services: + - arch: s390x + dist: bionic + env: + - PGB_CI="test --vm=none --param=no-coverage --param=module=command --param=module=storage" + services: install: - umask 0022 && cd ~ && pwd && whoami && umask && groups - df -Th && top -bn1 script: - - ${TRAVIS_BUILD_DIR?}/test/travis.pl ${PGB_CI?} + - ${TRAVIS_BUILD_DIR?}/test/ci.pl ${PGB_CI?} diff --git a/doc/xml/contributing.xml b/doc/xml/contributing.xml index 942107e7f..5098af5dc 100644 --- a/doc/xml/contributing.xml +++ b/doc/xml/contributing.xml @@ -98,6 +98,13 @@ usermod -aG docker `whoami` + + + + + chmod 666 /var/run/docker.sock + +

This clone of the repository is sufficient for experimentation. For development, create a fork and clone that instead.

diff --git a/test/travis.pl b/test/ci.pl similarity index 95% rename from test/travis.pl rename to test/ci.pl index 04b6a86ad..249a17e7e 100755 --- a/test/travis.pl +++ b/test/ci.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl #################################################################################################################################### -# Travis CI Test Wrapper +# CI Test Wrapper #################################################################################################################################### #################################################################################################################################### @@ -37,7 +37,7 @@ use pgBackRestTest::Common::VmTest; =head1 NAME -travis.pl - Travis CI Test Wrapper +ci.pl - CI Test Wrapper =head1 SYNOPSIS @@ -102,7 +102,7 @@ eval # Display version and exit if requested if ($bHelp) { - syswrite(*STDOUT, "Travis CI Test Wrapper\n"); + syswrite(*STDOUT, "CI Test Wrapper\n"); syswrite(*STDOUT, "\n"); pod2usage(); @@ -145,6 +145,8 @@ eval ################################################################################################################################ # Build documentation ################################################################################################################################ + my $strUser = getpwuid($UID); + if ($ARGV[0] eq 'doc') { if ($strVm eq VM_CO7) @@ -153,11 +155,11 @@ eval processExec( 'sudo apt-get install -y --no-install-recommends texlive-latex-base texlive-latex-extra texlive-fonts-recommended', {bSuppressStdErr => true}); - processExec('sudo apt-get install -y texlive-font-utils latex-xcolor', {bSuppressStdErr => true}); + processExec('sudo apt-get install -y texlive-font-utils texlive-latex-recommended', {bSuppressStdErr => true}); } processBegin('remove sudo'); - processExec('sudo rm /etc/sudoers.d/travis'); + processExec("sudo rm /etc/sudoers.d/${strUser}"); processEnd(); processBegin('create link from home to repo for contributing doc'); @@ -205,7 +207,7 @@ eval if (!$bSudo) { processBegin('remove sudo'); - processExec('sudo rm /etc/sudoers.d/travis'); + processExec("sudo rm /etc/sudoers.d/${strUser}"); processEnd(); } @@ -219,7 +221,7 @@ eval processBegin(($strVm eq VM_NONE ? "no container" : $strVm) . ' test'); processExec( - "${strTestExe} --no-gen --no-coverage-report --vm-host=none --vm-max=2 --vm=${strVm}" . + "${strTestExe} --no-gen --log-level-test-file=off --no-coverage-report --vm-host=none --vm-max=2 --vm=${strVm}" . (@stryParam != 0 ? " --" . join(" --", @stryParam) : ''), {bShowOutputAsync => true, bOutLogOnError => false}); processEnd(); diff --git a/test/lib/pgBackRestTest/Common/VmTest.pm b/test/lib/pgBackRestTest/Common/VmTest.pm index f8b55af1d..7faba74e0 100644 --- a/test/lib/pgBackRestTest/Common/VmTest.pm +++ b/test/lib/pgBackRestTest/Common/VmTest.pm @@ -295,8 +295,6 @@ my $oyVm = PG_VERSION_84, PG_VERSION_90, PG_VERSION_91, - PG_VERSION_92, - PG_VERSION_93, ], }, @@ -398,6 +396,8 @@ my $oyVm = &VM_DB_TEST => [ + PG_VERSION_92, + PG_VERSION_93, PG_VERSION_94, PG_VERSION_95, PG_VERSION_10, diff --git a/test/src/module/command/restoreTest.c b/test/src/module/command/restoreTest.c index 5c4b74289..39e9c627c 100644 --- a/test/src/module/command/restoreTest.c +++ b/test/src/module/command/restoreTest.c @@ -861,7 +861,7 @@ testRun(void) TEST_RESULT_LOG( "P00 WARN: unknown user '{[user]}' in backup manifest mapped to current user\n" - "P00 WARN: unknown group '{[user]}' in backup manifest mapped to current group"); + "P00 WARN: unknown group '{[group]}' in backup manifest mapped to current group"); userInitInternal(); @@ -909,7 +909,7 @@ testRun(void) TEST_RESULT_VOID(restoreManifestOwner(manifest), "check ownership"); - TEST_RESULT_LOG("P00 WARN: unknown group in backup manifest mapped to '{[user]}'"); + TEST_RESULT_LOG("P00 WARN: unknown group in backup manifest mapped to '{[group]}'"); // ------------------------------------------------------------------------------------------------------------------------- TEST_TITLE("owner is root and group is bad");