|
28 | 28 | mkdir build && cd build
|
29 | 29 | ../configure --with-asan --with-ubsan
|
30 | 30 | make -j$(nproc) check
|
| 31 | +
|
| 32 | + distro_matrix: |
| 33 | + name: build distribution matrix |
| 34 | + runs-on: ubuntu-latest |
| 35 | + outputs: |
| 36 | + matrix: ${{ steps.matrix.outputs.matrix }} |
| 37 | + steps: |
| 38 | + - id: matrix |
| 39 | + name: build matrix |
| 40 | + shell: python |
| 41 | + run: | |
| 42 | + import os |
| 43 | + import json |
| 44 | + runner = { |
| 45 | + "x86_64": "ubuntu-24.04", |
| 46 | + "i686": "ubuntu-24.04", |
| 47 | + "aarch64": "ubuntu-24.04-arm", |
| 48 | + "armv7l": "ubuntu-24.04-arm", |
| 49 | + "ppc64le": "ubuntu-24.04", |
| 50 | + "s390x": "ubuntu-24.04", |
| 51 | + "riscv64": "ubuntu-24.04", |
| 52 | + } |
| 53 | + reduced = [ |
| 54 | + ("almalinux:8", ("x86_64", "aarch64", "ppc64le", "s390x")), |
| 55 | + ("almalinux:9", ("x86_64", "aarch64", "ppc64le", "s390x")), |
| 56 | + ("centos:7", ("x86_64", "i686", "aarch64", "ppc64le", "s390x")), |
| 57 | + ("debian:10", ("x86_64", "i686", "aarch64", "armv7l")), |
| 58 | + ("debian:11", ("x86_64", "i686", "aarch64", "armv7l")), |
| 59 | + ("debian:12", ("x86_64", "i686", "aarch64", "armv7l", "ppc64le", "s390x")), |
| 60 | + ("ubuntu:18.04", ("x86_64", "i686", "aarch64", "armv7l", "ppc64le", "s390x")), |
| 61 | + ("ubuntu:20.04", ("x86_64", "aarch64", "armv7l", "ppc64le", "s390x", "riscv64")), |
| 62 | + ("ubuntu:22.04", ("x86_64", "aarch64", "armv7l", "ppc64le", "s390x", "riscv64")), |
| 63 | + ("ubuntu:24.04", ("x86_64", "aarch64", "armv7l", "ppc64le", "s390x", "riscv64")), |
| 64 | + ] |
| 65 | + expanded = [{"distro": distro, "platform": platform, "runner": runner[platform]} for distro, platforms in reduced for platform in platforms] |
| 66 | + print(json.dumps(expanded, indent=2)) |
| 67 | + with open(os.environ["GITHUB_OUTPUT"], "at") as f: |
| 68 | + f.write(f"matrix={json.dumps(expanded)}") |
| 69 | +
|
| 70 | + distro_check: |
| 71 | + needs: distro_matrix |
| 72 | + name: ${{ matrix.distro }} ${{ matrix.platform }} |
| 73 | + runs-on: ${{ matrix.runner }} |
| 74 | + timeout-minutes: 10 |
| 75 | + strategy: |
| 76 | + fail-fast: false |
| 77 | + matrix: |
| 78 | + include: ${{ fromJson(needs.distro_matrix.outputs.matrix) }} |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v4 |
| 81 | + - name: Set up QEMU |
| 82 | + if: runner.arch == 'X64' && matrix.platform != 'x86_64' |
| 83 | + uses: docker/setup-qemu-action@v3 |
| 84 | + - run: | |
| 85 | + # ${{ matrix.distro }} ${{ matrix.platform }} tests |
| 86 | + cat <<EOF > build.sh |
| 87 | + set -e |
| 88 | + set -x |
| 89 | +
|
| 90 | + case "${{ matrix.distro }}" in |
| 91 | + ubuntu*|debian*) apt-get update && apt-get -y install automake g++ make;; |
| 92 | + esac |
| 93 | +
|
| 94 | + c++ --version |
| 95 | + ld --version |
| 96 | + autoconf --version |
| 97 | + ./bootstrap.sh |
| 98 | + mkdir build && cd build |
| 99 | + ../configure |
| 100 | + make -j$(nproc) check || (cat tests/test-suite.log; exit 1) |
| 101 | + EOF |
| 102 | +
|
| 103 | + case "${{ matrix.platform }}" in |
| 104 | + x86_64) DOCKER_PLATFORM=amd64;; |
| 105 | + i686) DOCKER_PLATFORM=386;; |
| 106 | + aarch64) DOCKER_PLATFORM=arm64/v8;; |
| 107 | + armv7l) DOCKER_PLATFORM=arm/v7;; |
| 108 | + *) DOCKER_PLATFORM=${{ matrix.platform }};; |
| 109 | + esac |
| 110 | +
|
| 111 | + case "${{ matrix.distro }}" in |
| 112 | + centos:7) IMAGE=quay.io/pypa/manylinux2014_${{ matrix.platform }}:latest;; |
| 113 | + almalinux:8) IMAGE=quay.io/pypa/manylinux_2_28_${{ matrix.platform }}:latest;; |
| 114 | + almalinux:9) IMAGE=quay.io/pypa/manylinux_2_34_${{ matrix.platform }}:latest;; |
| 115 | + *) IMAGE=${{ matrix.distro }} |
| 116 | + esac |
| 117 | +
|
| 118 | + docker run --platform linux/${DOCKER_PLATFORM} -v $(pwd):/gha ${IMAGE} sh -ec "cd /gha && bash ./build.sh" |
0 commit comments