|
| 1 | +name: Test LTO - Rocky Linux Only |
| 2 | + |
| 3 | +# Focused workflow for iterating on LTO / builder-image changes for Rocky Linux. |
| 4 | +# Only builds and tests Rocky Linux 8/9/10 — AlmaLinux and CentOS Stream are |
| 5 | +# intentionally omitted to keep CI fast during development. |
| 6 | +# |
| 7 | +# Extra jobs compared to the main rpm.yml workflow: |
| 8 | +# verify-container — inspects each builder image (gcc version, LLVM, libstdc++) |
| 9 | +# verify-binaries — checks GLIBC/GLIBCXX symbol requirements of the built RPM |
| 10 | +# and fails if they exceed what the target distro ships |
| 11 | +# |
| 12 | +# Once Rocky Linux passes cleanly, re-enable AlmaLinux/CentOS in rpm.yml. |
| 13 | + |
| 14 | +on: |
| 15 | + workflow_dispatch: |
| 16 | + push: |
| 17 | + branches: |
| 18 | + - test-lto-rockylinux |
| 19 | + |
| 20 | +jobs: |
| 21 | + # ── 1. Build the builder containers ──────────────────────────────────────── |
| 22 | + build-containers: |
| 23 | + name: Build Builder Containers |
| 24 | + uses: ./.github/workflows/build_workflow_containers.yaml |
| 25 | + |
| 26 | + # ── 2. Verify builder container environment ───────────────────────────────── |
| 27 | + # Quick sanity check: confirms gcc version, LLVM presence, and the max |
| 28 | + # GLIBCXX version available in the container's libstdc++. |
| 29 | + verify-container: |
| 30 | + name: Verify Builder (${{ matrix.distro }}${{ matrix.distro_version }}-amd64) |
| 31 | + needs: build-containers |
| 32 | + runs-on: ubuntu-latest |
| 33 | + strategy: |
| 34 | + fail-fast: false |
| 35 | + matrix: |
| 36 | + include: |
| 37 | + - {distro: rockylinux, distro_version: "10"} |
| 38 | + - {distro: rockylinux, distro_version: "9"} |
| 39 | + - {distro: rockylinux, distro_version: "8"} |
| 40 | + steps: |
| 41 | + - name: Checkout code |
| 42 | + uses: actions/checkout@v4 |
| 43 | + |
| 44 | + - name: Log in to GitHub Container Registry |
| 45 | + run: echo "${{ github.token }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin |
| 46 | + |
| 47 | + - name: Inspect builder image |
| 48 | + run: | |
| 49 | + IMAGE="ghcr.io/${{ github.repository }}/builder:${{ matrix.distro }}${{ matrix.distro_version }}" |
| 50 | + echo "Pulling $IMAGE..." |
| 51 | + docker pull "$IMAGE" |
| 52 | +
|
| 53 | + echo "" |
| 54 | + echo "=== Compiler versions ===" |
| 55 | + docker run --rm "$IMAGE" bash -lc "gcc --version | head -1; g++ --version | head -1" 2>/dev/null || \ |
| 56 | + docker run --rm "$IMAGE" bash -c "source /etc/bashrc 2>/dev/null || true; gcc --version | head -1; g++ --version | head -1" |
| 57 | +
|
| 58 | + echo "" |
| 59 | + echo "=== LLVM / LTO gate ===" |
| 60 | + docker run --rm "$IMAGE" bash -c " |
| 61 | + if [ -x /opt/llvm/bin/clang ]; then |
| 62 | + /opt/llvm/bin/clang --version | head -1 |
| 63 | + echo 'LTO gate: ENABLED (LTO=1)' |
| 64 | + else |
| 65 | + echo 'No /opt/llvm/bin/clang found' |
| 66 | + echo 'LTO gate: DISABLED (LTO=0)' |
| 67 | + fi |
| 68 | + " |
| 69 | +
|
| 70 | + echo "" |
| 71 | + echo "=== libstdc++ GLIBCXX range ===" |
| 72 | + docker run --rm "$IMAGE" bash -c " |
| 73 | + echo -n 'Min: '; strings /lib64/libstdc++.so.6 | grep -oE 'GLIBCXX_3\.[0-9]+\.[0-9]+' | sort -V | head -1 |
| 74 | + echo -n 'Max: '; strings /lib64/libstdc++.so.6 | grep -oE 'GLIBCXX_3\.[0-9]+\.[0-9]+' | sort -V | tail -1 |
| 75 | + " |
| 76 | +
|
| 77 | + echo "" |
| 78 | + echo "=== System glibc ===" |
| 79 | + docker run --rm "$IMAGE" bash -c "ldd --version | head -1" |
| 80 | +
|
| 81 | + # ── 3. Build the RPM packages (Rocky Linux only) ──────────────────────────── |
| 82 | + build-package: |
| 83 | + name: Build RPM (${{ matrix.distro }}${{ matrix.distro_version }}-${{ matrix.platform }}) |
| 84 | + needs: build-containers |
| 85 | + runs-on: ${{ matrix.platform == 'arm64' && 'ubuntu24-arm64-2-8' || 'ubuntu-latest' }} |
| 86 | + strategy: |
| 87 | + fail-fast: false |
| 88 | + matrix: |
| 89 | + include: |
| 90 | + - {distro: rockylinux, distro_version: "10", platform: amd64} |
| 91 | + - {distro: rockylinux, distro_version: "10", platform: arm64} |
| 92 | + - {distro: rockylinux, distro_version: "9", platform: amd64} |
| 93 | + - {distro: rockylinux, distro_version: "9", platform: arm64} |
| 94 | + - {distro: rockylinux, distro_version: "8", platform: amd64} |
| 95 | + - {distro: rockylinux, distro_version: "8", platform: arm64} |
| 96 | + steps: |
| 97 | + - name: Checkout code |
| 98 | + uses: actions/checkout@v4 |
| 99 | + |
| 100 | + - name: Build package |
| 101 | + uses: ./.github/actions/build-package |
| 102 | + with: |
| 103 | + distro: ${{ matrix.distro }} |
| 104 | + distro_version: ${{ matrix.distro_version }} |
| 105 | + platform: ${{ matrix.platform }} |
| 106 | + release_tag: unstable |
| 107 | + |
| 108 | + # ── 4. Verify binary symbol requirements ──────────────────────────────────── |
| 109 | + # Extracts the RPM and checks that redis-server and every *.so module only |
| 110 | + # use GLIBC/GLIBCXX symbols that the target distro actually ships. |
| 111 | + # Fails fast if a newer glibc or libstdc++ contaminated the build. |
| 112 | + verify-binaries: |
| 113 | + name: Verify Binaries (${{ matrix.distro }}${{ matrix.distro_version }}-amd64) |
| 114 | + needs: build-package |
| 115 | + runs-on: ubuntu-latest |
| 116 | + strategy: |
| 117 | + fail-fast: false |
| 118 | + matrix: |
| 119 | + include: |
| 120 | + # max_glibc / max_glibcxx = highest version the distro ships natively |
| 121 | + - {distro: rockylinux, distro_version: "10", artifact: rpm-rockylinux10-amd64, max_glibc: "2.38", max_glibcxx: "3.4.32"} |
| 122 | + - {distro: rockylinux, distro_version: "9", artifact: rpm-rockylinux9-amd64, max_glibc: "2.34", max_glibcxx: "3.4.29"} |
| 123 | + - {distro: rockylinux, distro_version: "8", artifact: rpm-rockylinux8-amd64, max_glibc: "2.28", max_glibcxx: "3.4.25"} |
| 124 | + steps: |
| 125 | + - name: Download RPM artifact |
| 126 | + uses: actions/download-artifact@v4 |
| 127 | + with: |
| 128 | + name: ${{ matrix.artifact }} |
| 129 | + path: ./rpm |
| 130 | + |
| 131 | + - name: Check binary symbol requirements |
| 132 | + run: | |
| 133 | + IMAGE="${{ matrix.distro_version == '10' && 'rockylinux/rockylinux:10' || format('{0}:{1}', matrix.distro, matrix.distro_version) }}" |
| 134 | + docker run --rm \ |
| 135 | + --platform linux/amd64 \ |
| 136 | + -v "$PWD/rpm:/rpm:ro" \ |
| 137 | + "$IMAGE" bash -c ' |
| 138 | + set -euo pipefail |
| 139 | + dnf install -y --quiet cpio binutils 2>/dev/null | tail -2 |
| 140 | +
|
| 141 | + RPM=$(ls /rpm/*.rpm | head -1) |
| 142 | + echo "Checking: $(basename $RPM)" |
| 143 | +
|
| 144 | + mkdir -p /tmp/ex && cd /tmp/ex |
| 145 | + rpm2cpio "$RPM" | cpio -idm --quiet 2>/dev/null |
| 146 | +
|
| 147 | + FAILED=0 |
| 148 | +
|
| 149 | + check_binary() { |
| 150 | + local f="$1" label="$2" max_glibc="$3" max_glibcxx="$4" |
| 151 | + echo "" |
| 152 | + echo "--- $label ---" |
| 153 | + local mg mgxx |
| 154 | + mg=$(nm -D "$f" 2>/dev/null | grep -oE "GLIBC_[0-9.]+" | sed "s/GLIBC_//" | sort -Vu | tail -1 || true) |
| 155 | + mgxx=$(nm -D "$f" 2>/dev/null | grep -oE "GLIBCXX_[0-9.]+" | sed "s/GLIBCXX_//" | sort -Vu | tail -1 || true) |
| 156 | + echo " GLIBC max required: ${mg:-none}" |
| 157 | + echo " GLIBCXX max required: ${mgxx:-none}" |
| 158 | +
|
| 159 | + if [ -n "$mg" ] && ! printf "%s\n%s\n" "$max_glibc" "$mg" | sort -V -C; then |
| 160 | + echo " FAIL: requires GLIBC_$mg > platform max GLIBC_$max_glibc" |
| 161 | + FAILED=1 |
| 162 | + else |
| 163 | + echo " GLIBC OK" |
| 164 | + fi |
| 165 | + if [ -n "$mgxx" ] && ! printf "%s\n%s\n" "$max_glibcxx" "$mgxx" | sort -V -C; then |
| 166 | + echo " FAIL: requires GLIBCXX_$mgxx > platform max GLIBCXX_$max_glibcxx" |
| 167 | + FAILED=1 |
| 168 | + else |
| 169 | + [ -n "$mgxx" ] && echo " GLIBCXX OK" |
| 170 | + fi |
| 171 | + } |
| 172 | +
|
| 173 | + for SO in redisearch.so redisbloom.so redistimeseries.so rejson.so; do |
| 174 | + F=$(find . -name "$SO" | head -1) |
| 175 | + [ -n "$F" ] && check_binary "$F" "$SO" "'"${{ matrix.max_glibc }}"'" "'"${{ matrix.max_glibcxx }}"'" |
| 176 | + done |
| 177 | +
|
| 178 | + RS=$(find . -name redis-server | head -1) |
| 179 | + [ -n "$RS" ] && check_binary "$RS" "redis-server" "'"${{ matrix.max_glibc }}"'" "'"${{ matrix.max_glibcxx }}"'" |
| 180 | +
|
| 181 | + echo "" |
| 182 | + if [ "$FAILED" -eq 0 ]; then |
| 183 | + echo "PASS: all binaries are compatible with ${{ matrix.distro }} ${{ matrix.distro_version }}" |
| 184 | + echo " (GLIBC <= ${{ matrix.max_glibc }}, GLIBCXX <= ${{ matrix.max_glibcxx }})" |
| 185 | + else |
| 186 | + echo "FAIL: binary compatibility check failed for ${{ matrix.distro }} ${{ matrix.distro_version }}" |
| 187 | + exit 1 |
| 188 | + fi |
| 189 | + ' |
| 190 | +
|
| 191 | + # ── 5. Smoke-test the RPM on each Rocky Linux version ─────────────────────── |
| 192 | + # Uncomment AlmaLinux / CentOS Stream entries below once Rocky Linux passes. |
| 193 | + run-smoke-tests: |
| 194 | + name: Test RPM (${{ matrix.distro }}${{ matrix.distro_version }}-${{ matrix.platform }}) |
| 195 | + runs-on: ${{ matrix.platform == 'arm64' && 'ubuntu24-arm64-2-8' || 'ubuntu-latest' }} |
| 196 | + container: |
| 197 | + image: "${{ matrix.distro_version == '10' && 'rockylinux/rockylinux:10' || format('{0}:{1}', matrix.distro, matrix.distro_version) }}" |
| 198 | + needs: build-package |
| 199 | + strategy: |
| 200 | + fail-fast: false |
| 201 | + matrix: |
| 202 | + include: |
| 203 | + - {distro: rockylinux, distro_version: "10", platform: amd64, test_artifact_name: rpm-rockylinux10-amd64} |
| 204 | + - {distro: rockylinux, distro_version: "10", platform: arm64, test_artifact_name: rpm-rockylinux10-arm64} |
| 205 | + - {distro: rockylinux, distro_version: "9", platform: amd64, test_artifact_name: rpm-rockylinux9-amd64} |
| 206 | + - {distro: rockylinux, distro_version: "9", platform: arm64, test_artifact_name: rpm-rockylinux9-arm64} |
| 207 | + - {distro: rockylinux, distro_version: "8", platform: amd64, test_artifact_name: rpm-rockylinux8-amd64} |
| 208 | + - {distro: rockylinux, distro_version: "8", platform: arm64, test_artifact_name: rpm-rockylinux8-arm64} |
| 209 | + # Uncomment to also test on AlmaLinux and CentOS Stream once Rocky Linux passes: |
| 210 | + # - {distro: almalinux, distro_version: "10", platform: amd64, test_artifact_name: rpm-rockylinux10-amd64} |
| 211 | + # - {distro: almalinux, distro_version: "10", platform: arm64, test_artifact_name: rpm-rockylinux10-arm64} |
| 212 | + # - {distro: almalinux, distro_version: "9", platform: amd64, test_artifact_name: rpm-rockylinux9-amd64} |
| 213 | + # - {distro: almalinux, distro_version: "9", platform: arm64, test_artifact_name: rpm-rockylinux9-arm64} |
| 214 | + # - {distro: almalinux, distro_version: "8", platform: amd64, test_artifact_name: rpm-rockylinux8-amd64} |
| 215 | + # - {distro: almalinux, distro_version: "8", platform: arm64, test_artifact_name: rpm-rockylinux8-arm64} |
| 216 | + # - {distro: "quay.io/centos/centos", distro_version: "9", platform: amd64, test_artifact_name: rpm-rockylinux9-amd64} |
| 217 | + # - {distro: "quay.io/centos/centos", distro_version: "9", platform: arm64, test_artifact_name: rpm-rockylinux9-arm64} |
| 218 | + steps: |
| 219 | + - name: Checkout code |
| 220 | + uses: actions/checkout@v4 |
| 221 | + |
| 222 | + - name: Run smoke tests |
| 223 | + uses: ./.github/actions/run-smoke-tests |
| 224 | + with: |
| 225 | + run_id: ${{ github.run_id }} |
| 226 | + distro: ${{ matrix.distro }} |
| 227 | + distro_version: ${{ matrix.distro_version }} |
| 228 | + platform: ${{ matrix.platform }} |
| 229 | + test_artifact_name: ${{ matrix.test_artifact_name }} |
0 commit comments