1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
name: test
on:
push:
branches:
- integration
- '**-ci'
- '**-cig'
pull_request:
branches:
- integration
- '**-ci'
- '**-cig'
jobs:
test:
runs-on: ubuntu-22.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 tests (without coverage or valgrind) for 32-bit
- param: test --vm=d11 --param=no-performance --param=no-coverage --param=no-valgrind
# Debian/Ubuntu documentation
- param: doc --vm=u22
# All integration tests
- param: test --vm=u22 --param=build-package --param=module=integration
# All unit tests with coverage, backtrace and alternate timezone
- param: test --vm=u22 --param=c-only --param=no-valgrind --param=tz=America/New_York
# All unit tests with valgrind (disable coverage and backtrace for performance)
- param: test --vm=u22 --param=c-only --param=no-coverage --param=no-back-trace
# All unit tests on the newest gcc available
- param: test --vm=f42 --param=c-only --param=no-valgrind --param=no-coverage --param=no-performance
# All unit tests on musl libc
- param: test --vm=a321 --param=c-only --param=no-coverage --param=no-performance
# RHEL documentation
- param: doc --vm=rh8
# All integration tests
- param: test --vm=rh8 --param=module=integration
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: pgbackrest
- name: Run Test
run: cd ${HOME?} && ${GITHUB_WORKSPACE?}/pgbackrest/test/ci.pl ${{matrix.param}} --param=build-max=2
# Output the coverage report on failure in case the failure was caused by lack of coverage. This is not ideal since the report
# needs to be copied from the log output into an HTML file where it can be viewed, but better than nothing.
- name: Coverage Report
if: failure()
run: |
cat ${GITHUB_WORKSPACE?}/pgbackrest/test/result/coverage/coverage.html
# Unit tests on aarch64 with valgrind
aarch64:
runs-on: ubuntu-22.04-arm
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: pgbackrest
- name: Run Test
run: cd ${HOME?} && ${GITHUB_WORKSPACE?}/pgbackrest/test/ci.pl test --vm=u22 --param=c-only --param=no-coverage --param=no-back-trace --param=build-max=2
# Basic tests on other architectures using emulation. The emulation is so slow that running all the unit tests would be too
# expensive, but this at least shows that the build works and some of the more complex tests run. In particular, it is good to
# test on one big-endian architecture to be sure that checksums are correct.
arch:
runs-on: ubuntu-24.04
strategy:
# Let all the jobs run to completion even if one fails
fail-fast: false
matrix:
include:
- arch: 'ppc64le'
- arch: 's390x'
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: pgbackrest
- name: Install
run: |
sudo apt-get update
sudo DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive apt-get install -y perl sudo libxml-checker-perl libyaml-perl rsync zlib1g-dev libssl-dev libxml2-dev libpq-dev libyaml-dev pkg-config make gcc ccache meson git liblz4-dev liblz4-tool zstd libzstd-dev bzip2 libbz2-dev
docker run --privileged --rm tonistiigi/binfmt --install all
- name: Build VM
run: ${GITHUB_WORKSPACE?}/pgbackrest/test/test.pl --vm-build --vm=u22 --vm-arch=${{matrix.arch}}
- name: Run Test
run: |
${GITHUB_WORKSPACE?}/pgbackrest/test/test.pl --vm=u22 --vm-arch=${{matrix.arch}} --no-valgrind --no-coverage --no-optimize --build-max=2 --module=command --test=backup
${GITHUB_WORKSPACE?}/pgbackrest/test/test.pl --vm=u22 --vm-arch=${{matrix.arch}} --no-valgrind --no-coverage --no-optimize --build-max=2 --module=postgres --test=interface
# Run meson unity build to check for errors, unused functions, and externed functions
unity:
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: pgbackrest
- name: Install
run: |
sudo apt-get update
DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive sudo apt-get install -y zlib1g-dev libssl-dev libxml2-dev libpq-dev libyaml-dev pkg-config meson liblz4-dev libzstd-dev libbz2-dev
- name: Build
run: |
meson setup --unity=on -Dwerror=true build ${GITHUB_WORKSPACE?}/pgbackrest
ninja -vC build
- name: Check
run: |
diff ${GITHUB_WORKSPACE?}/pgbackrest/.github/workflows/symbol.out <(nm -gj --defined-only build/src/pgbackrest)
# Check that code is correctly formatted
code-format:
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: pgbackrest
- name: Check
run: |
cd ${HOME?} && ${GITHUB_WORKSPACE?}/pgbackrest/test/ci.pl test --param=code-format-check
codeql:
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language:
- cpp
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Packages
run: sudo apt-get install -y --no-install-recommends libyaml-dev libbz2-dev meson
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{matrix.language}}
- name: Build
run: meson setup ${HOME?}/build ${GITHUB_WORKSPACE?} && ninja -C ${HOME?}/build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
|