name: ppc64le workflow

on:
  workflow_dispatch:
  push:
  pull_request:
    branches: [ master ]
    paths-ignore:
    - '.github/CODEOWNERS'
    - 'doc/**'
    - 'release_docs/**'
    - 'COPYING'
    - '**.md'

jobs:
  powerpc-cmake:
    # The host should always be Linux
    runs-on: ubuntu-latest
    name: Ubuntu PowerPC CMake

    steps:
      - uses: actions/checkout@v4.1.7

      - uses: uraimo/run-on-arch-action@v3
        name: Run commands
        id: runcmd
        with:
          arch: ppc64le
          distro: ubuntu_latest

          # Not required, but speeds up builds by storing container images in
          # a GitHub package registry.
          githubToken: ${{ github.token }}

          install: |
            apt-get update -q -y
            apt-get install -q -y --no-install-recommends \
            ninja-build libtirpc-dev graphviz gcc \
            libc6-dev libjpeg-dev \
            make sudo zlib1g zlib1g-dev \
            cmake

          run: |
            mkdir "build"
            cd "build"
            cmake -C ../config/cmake/cacheinit.cmake \
                -G Ninja \
                --log-level=VERBOSE \
                -DCMAKE_BUILD_TYPE=Release \
                -DCMAKE_TOOLCHAIN_FILE=../config/toolchain/gcc.cmake \
                -DBUILD_SHARED_LIBS:BOOL=ON \
                -DHDF4_BUILD_EXAMPLES=ON \
                -DHDF4_BUILD_FORTRAN=OFF \
                -DHDF4_BUILD_JAVA=OFF \
                -DHDF4_BUILD_DOC=OFF \
                -DJPEG_USE_LOCALCONTENT=OFF \
                -DLIBAEC_USE_LOCALCONTENT=OFF \
                -DZLIB_USE_LOCALCONTENT=OFF \
                -DHDF4_PACK_EXAMPLES:BOOL=ON \
                -DHDF4_PACKAGE_EXTLIBS:BOOL=ON \
                ..
            cmake --build . --config Release
            ctest . -C Release -V -E "MFHDF_TEST-hdftest|HDP-dumpsds-18"
            cpack -C Release -V
