# Tests on architectures other than x86_64. The aarch64 tests run natively on an ARM runner while the rest are emulated.
|
name: arch
|
|
on: workflow_call
|
|
# Limit permissions on the repository
|
permissions:
|
contents: read
|
|
jobs:
|
# Unit tests on aarch64 with valgrind
|
aarch64:
|
runs-on: ubuntu-22.04-arm
|
|
# Allow pushing base images to the GHCR container cache
|
permissions:
|
contents: read
|
packages: write
|
|
steps:
|
- name: Checkout Code
|
uses: actions/checkout@v6
|
with:
|
path: pgbackrest
|
|
- name: Update Apt
|
uses: ./pgbackrest/.github/action/apt
|
|
- name: Login to GHCR
|
continue-on-error: true
|
run: echo "${{secrets.GITHUB_TOKEN}}" | docker login ghcr.io -u ${{github.actor}} --password-stdin
|
|
- name: Run Test
|
run: |
|
cd ${HOME?} && ${GITHUB_WORKSPACE?}/pgbackrest/test/ci.py test --vm=u22 --param=c-only --param=no-coverage \
|
--param=no-back-trace
|
|
# 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.
|
emulated:
|
runs-on: ubuntu-24.04
|
|
# Allow pushing base images to the GHCR container cache
|
permissions:
|
contents: read
|
packages: write
|
|
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@v6
|
with:
|
path: pgbackrest
|
|
- name: Update Apt
|
uses: ./pgbackrest/.github/action/apt
|
|
- name: Install
|
run: |
|
sudo DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive apt-get install -y sudo python3-yaml \
|
zlib1g-dev libssl-dev libxml2-dev libpq-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: Login to GHCR
|
continue-on-error: true
|
run: echo "${{secrets.GITHUB_TOKEN}}" | docker login ghcr.io -u ${{github.actor}} --password-stdin
|
|
- name: Build VM
|
run: ${GITHUB_WORKSPACE?}/pgbackrest/test/test.py vm-build --vm=u22 --vm-arch=${{matrix.arch}}
|
|
# Compiling under emulation is slow enough that a warm ccache saves a lot of time
|
- name: Restore ccache
|
uses: ./pgbackrest/.github/action/ccache
|
with:
|
mode: restore
|
arch: ${{matrix.arch}}
|
path: test/ccache
|
|
- name: Run Test
|
run: |
|
${GITHUB_WORKSPACE?}/pgbackrest/test/test.py --vm=u22 --vm-arch=${{matrix.arch}} --no-valgrind --no-coverage \
|
--module=common/type/pack --module=common/crypto --module=common/compress --module=postgres/interface \
|
--module=command/backup --module=command/restore --module=command/archive/get --module=command/archive/push \
|
--module=command/verify
|
|
# Run the smoke test against the arch build: a real PostgreSQL driven through a full backup/restore/verify cycle, which
|
# exercises checksums end-to-end on big-endian. It reuses the pgbackrest binary already built for the arch above and the
|
# single PostgreSQL version baked into the arch base image. A fresh container is started (test.py removes its own) with the
|
# SSH entrypoint overridden and run as root so smoke.py can drop to the postgres user, as the misc smoke job does.
|
#
|
# The binary is copied to /tmp first: test.py creates the test tree mode 0770 owned by the build user, so the unprivileged
|
# postgres user that smoke.py drops to cannot traverse it to execute the binary. /tmp is world-accessible -- it is where
|
# smoke.py puts its own work dirs -- so the copy there is reachable.
|
- name: Run Smoke Test
|
run: |
|
rm -rf /tmp/smoke && mkdir -p /tmp/smoke
|
cp ${GITHUB_WORKSPACE?}/test/build/u22/src/pgbackrest /tmp/smoke/pgbackrest
|
docker run --rm --platform linux/${{matrix.arch}} -u root --entrypoint python3 \
|
-v ${GITHUB_WORKSPACE?}/pgbackrest:${GITHUB_WORKSPACE?}/pgbackrest \
|
-v /tmp/smoke:/tmp/smoke \
|
ghcr.io/pgbackrest/test:u22-test-${{matrix.arch}} \
|
${GITHUB_WORKSPACE?}/pgbackrest/test/smoke.py --pgbackrest /tmp/smoke/pgbackrest
|
|
# Save on always() so the cache is still warmed even when tests fail
|
- name: Save ccache
|
if: always()
|
uses: ./pgbackrest/.github/action/ccache
|
with:
|
mode: save
|
arch: ${{matrix.arch}}
|
path: test/ccache
|