Skip to content

always default to wi1, native format is opt-in #32

always default to wi1, native format is opt-in

always default to wi1, native format is opt-in #32

Workflow file for this run

name: pg-compat
# Integration tests adapted from wal-g's docker/pg_tests test scripts. Verifies
# walross against a real PostgreSQL cluster on the fs storage backend, plus
# bidirectional bucket interop with an installed wal-g binary (forward:
# walross writes & wal-g reads, reverse: wal-g writes & walross reads).
on:
push:
branches: [master, main]
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
# Pinned wal-g release; bump deliberately so a wal-g change can't silently
# break the cross-tool gate. Release artifacts live at
# https://github.com/wal-g/wal-g/releases
WALG_VERSION: v3.0.8
WALG_ASSET: wal-g-pg-22.04-amd64
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --locked --bin walross
- uses: actions/upload-artifact@v7
with:
name: walross-bin
path: target/release/walross
if-no-files-found: error
retention-days: 7
pg:
needs: build
# PG 13-17 on jammy; PG 18 single-tool cells on noble (PGDG packages for
# jammy lagged 18). Cross-tool stays 13-17 — pinned wal-g v3.0.8 predates 18.
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
strategy:
fail-fast: false
matrix:
pg: [13, 14, 15, 16, 17]
test:
- full_backup
- backup_mark
- backup_show
- wal_overwrite
- daemon
- cross_tool_forward
- cross_tool_reverse
- cross_tool_encryption
- cross_tool_retention
- cross_tool_lzma
include:
- { pg: 18, test: full_backup, os: ubuntu-24.04 }
- { pg: 18, test: backup_mark, os: ubuntu-24.04 }
- { pg: 18, test: backup_show, os: ubuntu-24.04 }
- { pg: 18, test: wal_overwrite, os: ubuntu-24.04 }
- { pg: 18, test: daemon, os: ubuntu-24.04 }
steps:
- uses: actions/checkout@v6
- name: Fetch walross binary
uses: actions/download-artifact@v8
with:
name: walross-bin
path: bin
- run: chmod +x bin/walross && bin/walross --version
- name: Install PostgreSQL ${{ matrix.pg }}
uses: ./.github/actions/install-pg
with:
pg-version: ${{ matrix.pg }}
- name: Install wal-g ${{ env.WALG_VERSION }}
if: ${{ startsWith(matrix.test, 'cross_tool') }}
run: |
set -eux
url="https://github.com/wal-g/wal-g/releases/download/${WALG_VERSION}/${WALG_ASSET}.tar.gz"
curl -fsSL -o /tmp/wal-g.tar.gz "$url"
tar -C /tmp -xzf /tmp/wal-g.tar.gz
sudo install -m 0755 "/tmp/${WALG_ASSET}" /usr/local/bin/wal-g
wal-g --version
- name: Run ${{ matrix.test }}
env:
PG_VERSION: ${{ matrix.pg }}
PG_BIN: /usr/lib/postgresql/${{ matrix.pg }}/bin
WALROSS_BIN: ${{ github.workspace }}/bin/walross
WALG_BIN: /usr/local/bin/wal-g
run: scripts/ci/${{ matrix.test }}.sh
- name: Collect PG logs on failure
if: failure()
uses: actions/upload-artifact@v7
with:
name: logs-pg${{ matrix.pg }}-${{ matrix.test }}
path: |
/tmp/walross-ci-*/**/*.log
/tmp/walross-ci-*/**/log/*
if-no-files-found: ignore
retention-days: 14
# Run the live-PG suite (tests/vm_live.rs, gated on the vm-test feature)
# against a real PGDG cluster. Previously VM-only; this brings backup-push,
# wal-receive, encryption & retention live exercises into GitHub CI.
pg-vm-test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
pg: [13, 14, 15, 16, 17]
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install PostgreSQL ${{ matrix.pg }}
uses: ./.github/actions/install-pg
with:
pg-version: ${{ matrix.pg }}
- name: vm-test against PG ${{ matrix.pg }}
env:
PG_VERSION: ${{ matrix.pg }}
PG_BIN: /usr/lib/postgresql/${{ matrix.pg }}/bin
# Unused by the cargo tests (they call library functions directly),
# but lib.sh requires it set; point at the build output.
WALROSS_BIN: ${{ github.workspace }}/target/debug/walross
run: scripts/ci/vm_test_cluster.sh cargo test --features vm-test --locked
- name: Collect PG logs on failure
if: failure()
uses: actions/upload-artifact@v7
with:
name: logs-vmtest-pg${{ matrix.pg }}
path: |
/tmp/walross-ci-*/**/*.log
/tmp/walross-ci-*/**/log/*
if-no-files-found: ignore
retention-days: 14
# Object-storage lane: drive the same shell tests against MinIO (S3) and
# fsouza/fake-gcs-server (GCS) so the hand-rolled S3/GCS clients get exercised
# against real APIs (SigV4 path-style, multipart, listing, server-side copy).
pg-storage:
needs: build
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
backend: [s3, gcs]
test: [full_backup, storage_copy]
steps:
- uses: actions/checkout@v6
- name: Fetch walross binary
uses: actions/download-artifact@v8
with:
name: walross-bin
path: bin
- run: chmod +x bin/walross && bin/walross --version
- name: Install PostgreSQL 16
uses: ./.github/actions/install-pg
with:
pg-version: 16
- name: Start object-storage emulators + bootstrap buckets
run: |
set -eux
docker run -d --name minio -p 9000:9000 \
-e MINIO_ROOT_USER=minioadmin -e MINIO_ROOT_PASSWORD=minioadmin \
minio/minio server /data
docker run -d --name fakegcs -p 4443:4443 \
fsouza/fake-gcs-server -scheme http -port 4443 -public-host 127.0.0.1:4443
for _ in $(seq 1 60); do
curl -fsS http://127.0.0.1:9000/minio/health/live >/dev/null 2>&1 && break; sleep 1
done
for _ in $(seq 1 60); do
curl -fsS "http://127.0.0.1:4443/storage/v1/b?project=test" >/dev/null 2>&1 && break; sleep 1
done
AWS_ACCESS_KEY_ID=minioadmin AWS_SECRET_ACCESS_KEY=minioadmin \
aws --endpoint-url http://127.0.0.1:9000 s3 mb s3://walross
curl -fsS -X POST "http://127.0.0.1:4443/storage/v1/b?project=test" \
-H 'Content-Type: application/json' -d '{"name":"walross"}'
- name: Run ${{ matrix.test }} against ${{ matrix.backend }}
env:
PG_VERSION: 16
PG_BIN: /usr/lib/postgresql/16/bin
WALROSS_BIN: ${{ github.workspace }}/bin/walross
WALROSS_STORAGE_BACKEND: ${{ matrix.backend }}
MINIO_ENDPOINT: http://127.0.0.1:9000
FAKE_GCS_ENDPOINT: http://127.0.0.1:4443
run: scripts/ci/${{ matrix.test }}.sh
- name: Collect logs on failure
if: failure()
uses: actions/upload-artifact@v7
with:
name: logs-storage-${{ matrix.backend }}-${{ matrix.test }}
path: |
/tmp/walross-ci-*/**/*.log
/tmp/walross-ci-*/**/log/*
if-no-files-found: ignore
retention-days: 14
# TLS + SCRAM live handshakes. Auth/TLS code is PG-version-independent, so one
# version suffices. These need TCP (TLS is skipped on unix sockets).
pg-tls-scram:
needs: build
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
test: [tls_replication, scram_auth]
steps:
- uses: actions/checkout@v6
- name: Fetch walross binary
uses: actions/download-artifact@v8
with:
name: walross-bin
path: bin
- run: chmod +x bin/walross && bin/walross --version
- name: Install PostgreSQL 16
uses: ./.github/actions/install-pg
with:
pg-version: 16
- name: Run ${{ matrix.test }}
env:
PG_VERSION: 16
PG_BIN: /usr/lib/postgresql/16/bin
WALROSS_BIN: ${{ github.workspace }}/bin/walross
run: scripts/ci/${{ matrix.test }}.sh
- name: Collect logs on failure
if: failure()
uses: actions/upload-artifact@v7
with:
name: logs-tlsscram-${{ matrix.test }}
path: |
/tmp/walross-ci-*/**/*.log
/tmp/walross-ci-*/**/log/*
if-no-files-found: ignore
retention-days: 14
# Non-zstd codecs end-to-end (push → fetch → WAL replay). zstd is already the
# default exercised by the main `pg` matrix; this covers the rest on one PG.
pg-codec:
needs: build
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
codec: [brotli, lz4, lzma, gzip]
steps:
- uses: actions/checkout@v6
- name: Fetch walross binary
uses: actions/download-artifact@v8
with:
name: walross-bin
path: bin
- run: chmod +x bin/walross && bin/walross --version
- name: Install PostgreSQL 16
uses: ./.github/actions/install-pg
with:
pg-version: 16
- name: full_backup with ${{ matrix.codec }}
env:
PG_VERSION: 16
PG_BIN: /usr/lib/postgresql/16/bin
WALROSS_BIN: ${{ github.workspace }}/bin/walross
WALG_COMPRESSION_METHOD: ${{ matrix.codec }}
run: scripts/ci/full_backup.sh
- name: Collect logs on failure
if: failure()
uses: actions/upload-artifact@v7
with:
name: logs-codec-${{ matrix.codec }}
path: |
/tmp/walross-ci-*/**/*.log
/tmp/walross-ci-*/**/log/*
if-no-files-found: ignore
retention-days: 14
# Line-coverage baseline. Instruments the vm-test suite (tests/vm_live.rs)
# against a real PG 17 cluster under cargo-llvm-cov so PG-dependent library
# code is exercised, not just the unit tests. One major is enough for a
# baseline; the pg matrix proves cross-version behaviour separately. Uploads
# lcov.info + HTML; summary lands in the job log; fails on any 0%-coverage
# source file.
coverage:
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
# cargo-llvm-cov needs llvm-profdata + llvm-cov from this component.
components: llvm-tools-preview
- uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- uses: Swatinem/rust-cache@v2
with:
# Instrumented builds differ from the other jobs'; isolate the cache.
key: coverage
- name: Install PostgreSQL 17
uses: ./.github/actions/install-pg
with:
pg-version: 17
# Single instrumented pass (--no-report); the report steps re-read the
# cached profdata to emit summary + lcov + html.
- name: Run instrumented vm-test suite (cargo llvm-cov)
env:
PG_VERSION: 17
PG_BIN: /usr/lib/postgresql/17/bin
# Unused by the cargo tests (they call library functions directly),
# but lib.sh requires it set; point at the build output.
WALROSS_BIN: ${{ github.workspace }}/target/debug/walross
run: |
cargo llvm-cov clean
scripts/ci/vm_test_cluster.sh \
cargo llvm-cov --no-report --features vm-test --locked -- --nocapture
- name: Coverage summary (job log)
run: cargo llvm-cov report --summary-only
- name: Coverage lcov.info
run: cargo llvm-cov report --lcov --output-path lcov.info
- name: Coverage HTML
run: cargo llvm-cov report --html
- name: Upload coverage artifacts
uses: actions/upload-artifact@v7
with:
name: coverage
path: |
lcov.info
target/llvm-cov/html
if-no-files-found: error
retention-days: 30
- name: Fail on any 0%-coverage file
run: |
zero=$(awk '
/^SF:/ { f = substr($0, 4) }
/^LF:/ { lf = substr($0, 4) + 0 }
/^LH:/ {
if (substr($0, 4) + 0 == 0 && lf > 0) {
i = index(f, "/src/"); if (i) f = substr(f, i + 1)
print f
}
}
' lcov.info)
if [ -n "$zero" ]; then
count=$(printf '%s\n' "$zero" | grep -c .)
echo "Files with 0% line coverage (every source file must be exercised by a test):"
printf '%s\n' "$zero" | sed 's/^/ /'
echo "::error::${count} file(s) have 0% line coverage"
exit 1
fi
echo "OK: all instrumented files have >0% line coverage."
- name: Collect PG logs on failure
if: failure()
uses: actions/upload-artifact@v7
with:
name: logs-coverage
path: |
/tmp/walross-ci-*/**/*.log
/tmp/walross-ci-*/**/log/*
if-no-files-found: ignore
retention-days: 14