1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-02-03 13:21:32 +02:00

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.
This commit is contained in:
David Steele 2020-12-09 15:19:01 -05:00
parent 8361a97482
commit d01669aa58
6 changed files with 81 additions and 52 deletions

52
.github/workflows/test.yml vendored Normal file
View File

@ -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}}

View File

@ -5,65 +5,33 @@ branches:
- /-cit$/ - /-cit$/
os: linux os: linux
dist: trusty dist: bionic
language: c language: c
services:
- docker
jobs: 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. # Run unit tests that provide wide coverage on multiple architectures.
# 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.
include: 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. # 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 - arch: ppc64le
dist: bionic
env: 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: 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 - arch: arm64
dist: bionic
env: env:
- PGB_CI="test --vm=none --param=no-coverage --param=module=command --param=module=storage" - PGB_CI="test --vm=none --param=no-coverage --param=module=command --param=module=storage"
services: services:
# All integration tests - arch: s390x
- env: PGB_CI="test --vm=co7 --param=module=mock --param=module=real" dist: bionic
env:
# Basic unit tests only. Coverage testing is also disabled to save time. - PGB_CI="test --vm=none --param=no-coverage --param=module=command --param=module=storage"
# - arch: s390x services:
# dist: bionic
# env:
# - PGB_CI="test --vm=none --param=no-coverage --param=module=command --param=module=storage"
# services:
install: install:
- umask 0022 && cd ~ && pwd && whoami && umask && groups - umask 0022 && cd ~ && pwd && whoami && umask && groups
- df -Th && top -bn1 - df -Th && top -bn1
script: script:
- ${TRAVIS_BUILD_DIR?}/test/travis.pl ${PGB_CI?} - ${TRAVIS_BUILD_DIR?}/test/ci.pl ${PGB_CI?}

View File

@ -98,6 +98,13 @@
usermod -aG docker `whoami` usermod -aG docker `whoami`
</exe-cmd> </exe-cmd>
</execute> </execute>
<!-- Hack permissions on the docker socket so the local user can run commands -->
<execute user="root" show="n">
<exe-cmd>
chmod 666 /var/run/docker.sock
</exe-cmd>
</execute>
</execute-list> </execute-list>
<p>This clone of the <backrest/> repository is sufficient for experimentation. For development, create a fork and clone that instead.</p> <p>This clone of the <backrest/> repository is sufficient for experimentation. For development, create a fork and clone that instead.</p>

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
#################################################################################################################################### ####################################################################################################################################
# Travis CI Test Wrapper # CI Test Wrapper
#################################################################################################################################### ####################################################################################################################################
#################################################################################################################################### ####################################################################################################################################
@ -37,7 +37,7 @@ use pgBackRestTest::Common::VmTest;
=head1 NAME =head1 NAME
travis.pl - Travis CI Test Wrapper ci.pl - CI Test Wrapper
=head1 SYNOPSIS =head1 SYNOPSIS
@ -102,7 +102,7 @@ eval
# Display version and exit if requested # Display version and exit if requested
if ($bHelp) if ($bHelp)
{ {
syswrite(*STDOUT, "Travis CI Test Wrapper\n"); syswrite(*STDOUT, "CI Test Wrapper\n");
syswrite(*STDOUT, "\n"); syswrite(*STDOUT, "\n");
pod2usage(); pod2usage();
@ -145,6 +145,8 @@ eval
################################################################################################################################ ################################################################################################################################
# Build documentation # Build documentation
################################################################################################################################ ################################################################################################################################
my $strUser = getpwuid($UID);
if ($ARGV[0] eq 'doc') if ($ARGV[0] eq 'doc')
{ {
if ($strVm eq VM_CO7) if ($strVm eq VM_CO7)
@ -153,11 +155,11 @@ eval
processExec( processExec(
'sudo apt-get install -y --no-install-recommends texlive-latex-base texlive-latex-extra texlive-fonts-recommended', 'sudo apt-get install -y --no-install-recommends texlive-latex-base texlive-latex-extra texlive-fonts-recommended',
{bSuppressStdErr => true}); {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'); processBegin('remove sudo');
processExec('sudo rm /etc/sudoers.d/travis'); processExec("sudo rm /etc/sudoers.d/${strUser}");
processEnd(); processEnd();
processBegin('create link from home to repo for contributing doc'); processBegin('create link from home to repo for contributing doc');
@ -205,7 +207,7 @@ eval
if (!$bSudo) if (!$bSudo)
{ {
processBegin('remove sudo'); processBegin('remove sudo');
processExec('sudo rm /etc/sudoers.d/travis'); processExec("sudo rm /etc/sudoers.d/${strUser}");
processEnd(); processEnd();
} }
@ -219,7 +221,7 @@ eval
processBegin(($strVm eq VM_NONE ? "no container" : $strVm) . ' test'); processBegin(($strVm eq VM_NONE ? "no container" : $strVm) . ' test');
processExec( 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) : ''), (@stryParam != 0 ? " --" . join(" --", @stryParam) : ''),
{bShowOutputAsync => true, bOutLogOnError => false}); {bShowOutputAsync => true, bOutLogOnError => false});
processEnd(); processEnd();

View File

@ -295,8 +295,6 @@ my $oyVm =
PG_VERSION_84, PG_VERSION_84,
PG_VERSION_90, PG_VERSION_90,
PG_VERSION_91, PG_VERSION_91,
PG_VERSION_92,
PG_VERSION_93,
], ],
}, },
@ -398,6 +396,8 @@ my $oyVm =
&VM_DB_TEST => &VM_DB_TEST =>
[ [
PG_VERSION_92,
PG_VERSION_93,
PG_VERSION_94, PG_VERSION_94,
PG_VERSION_95, PG_VERSION_95,
PG_VERSION_10, PG_VERSION_10,

View File

@ -861,7 +861,7 @@ testRun(void)
TEST_RESULT_LOG( TEST_RESULT_LOG(
"P00 WARN: unknown user '{[user]}' in backup manifest mapped to current user\n" "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(); userInitInternal();
@ -909,7 +909,7 @@ testRun(void)
TEST_RESULT_VOID(restoreManifestOwner(manifest), "check ownership"); 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"); TEST_TITLE("owner is root and group is bad");