Skip to content

CI: add cross compilation test #315

CI: add cross compilation test

CI: add cross compilation test #315

Workflow file for this run

name: C/C++ CI
on: [push, pull_request]
jobs:
full-build:
name: Build all, plus default examples, run tests against redis
runs-on: ubuntu-latest
env:
# the docker image used by the test.sh
REDIS_DOCKER: redis:alpine
steps:
- name: Install prerequisites
run: sudo apt-get update && sudo apt-get install -y libev-dev libevent-dev libglib2.0-dev libssl-dev valgrind
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Run make
run: make all examples
- name: Run unittests
run: make check
- name: Run tests with valgrind
env:
TEST_PREFIX: valgrind --error-exitcode=100
SKIPS_ARG: --skip-throughput
run: make check
build-32-bit:
name: Build and test minimal 32 bit linux
runs-on: ubuntu-latest
steps:
- name: Install prerequisites
run: sudo apt-get update && sudo apt-get install gcc-multilib
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Run make
run: make 32bit
- name: Run unittests
env:
REDIS_DOCKER: redis:alpine
run: make check
build-arm:
name: Cross-compile and test arm linux with Qemu
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: arm
toolset: arm-linux-gnueabi
emulator: qemu-arm
- name: aarch64
toolset: aarch64-linux-gnu
emulator: qemu-aarch64
steps:
- name: Install qemu
if: matrix.emulator
run: sudo apt-get update && sudo apt-get install -y qemu-user
- name: Install platform toolset
if: matrix.toolset
run: sudo apt-get install -y gcc-${{matrix.toolset}}
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Run make
run: make all
env:
CC: ${{matrix.toolset}}-gcc
AR: ${{matrix.toolset}}-ar
- name: Run unittests
env:
REDIS_DOCKER: redis:alpine
TEST_PREFIX: ${{matrix.emulator}} -L /usr/${{matrix.toolset}}/
run: make check
build-cross:
name: Cross-compile ${{ matrix.config.target }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
config:
- {target: arm, host: arm-linux-gnueabi, qemu: arm, gccver: 12 }
- {target: armhf, host: arm-linux-gnueabihf, qemu: arm, gccver: 12 }
- {target: aarch64, host: aarch64-linux-gnu, qemu: aarch64, gccver: 12 }
- {target: riscv64, host: riscv64-linux-gnu, qemu: riscv64, gccver: 12 }
- {target: ppc, host: powerpc-linux-gnu, qemu: ppc, gccver: 12 }
- {target: ppc64, host: powerpc64-linux-gnu, qemu: ppc64, gccver: 12 }
- {target: ppc64le, host: powerpc64le-linux-gnu, qemu: ppc64le, gccver: 12 }
- {target: s390x, host: s390x-linux-gnu, qemu: s390x, gccver: 12 }
- {target: mips, host: mips-linux-gnu, qemu: mips, gccver: 10 }
- {target: mips64, host: mips64-linux-gnuabi64, qemu: mips64, gccver: 10 }
- {target: mipsel, host: mipsel-linux-gnu, qemu: mipsel, gccver: 10 }
- {target: mips64el, host: mips64el-linux-gnuabi64, qemu: mips64el, gccver: 10 }
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Install toolchain
run: |
sudo apt install -y g++-${{ matrix.config.gccver }}-${{ matrix.config.host }}
- name: Build
env:
CC: ${{ matrix.config.host }}-gcc-${{ matrix.config.gccver }}
AR: ${{ matrix.config.host }}-ar
run: |
make