Emulating different architecture in a workflow / using 2 containers

Hello,

I’m working on a platform independent library and I need to test my code on some big-endian platform. I recently found out that Docker allows me to easily run my tests on s390x architecture locally:

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -it s390x/ubuntu bash

I successfully managed to add these steps to my workflow:

big-endian:
    name: "Big-endian tests"
    needs: [build]
    runs-on: ubuntu-latest
    steps:
    - name: Get the qemu container
      run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
    - name: Run uname
      run: uname -a
    - name: Run tests on s390x/ubuntu
      run: docker run --rm s390x/ubuntu bash -c "apt update && apt install -y gcc g++ make git && git clone https://github.com/jacajack/liblightmodbus.git && cd liblightmodbus && git checkout origin/dev-v3.0 && make -C test && ./test/main-test"

It works fine, but I’m just unhappy with running the entire test process in one line instead of using job steps. I feel like there must be a cleaner way to do this and I’m just missing something obvious. I already tried running the job with container: image: s390x/ubuntu, but I got an error saying that the container is not running.

Hence my question: is there a ‘nicer’ way of running all my test build steps using these two containers?

Thanks!