name: "ARM build"

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  schedule:
    - cron: '0 7 * * 2'

jobs:
  build:
    runs-on: ubuntu-latest
    name: Build on ${{ matrix.arch }}

    # Run steps on a matrix of 3 arch/distro combinations
    strategy:
      matrix:
        include:
          - arch: aarch64
          - arch: armv7
          - arch: armv6

    steps:
    - name: Repository checkout
      uses: actions/checkout@v3

    - name: Test on ARM architecture
      uses: uraimo/run-on-arch-action@v2
      id: runcmd
      with:
        arch: ${{ matrix.arch }}
        distro: bullseye
        run: |
          cat /etc/os-release
          uname -a
          whoami
          tty || echo
          pwd
          # Install dependencies via apt-get
          echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
          apt-get update
          apt-get -y install \
            ca-certificates \
            make \
            gcc \
            g++ \
            gpm \
            libgpm-dev \
            libcppunit-dev \
            libncurses-dev \
            pkg-config \
            libtool \
            automake \
            autoconf \
            autoconf-archive
          # Build
          g++ --version
          autoreconf -v --install --force
          ./configure --prefix=/usr
          make -j10

    - name: Get the output
      run: |
        echo "The uname output was ${{ steps.runcmd.outputs.uname }}"

