name: iut_zephyr_build

on:
  pull_request:
    branches: [ main ]
  schedule:
    - cron: '0 20 * * 2,6'

jobs:
  iut_zephyr_build:
    runs-on: ubuntu-22.04
    container:
      image: ghcr.io/zephyrproject-rtos/ci:v0.26.4
    env:
      ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1

    steps:
      - name: Apply container owner mismatch workaround
        run: |
          # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not
          #        match the container user UID because of the way GitHub
          #        Actions runner is implemented. Remove this workaround when
          #        GitHub comes up with a fundamental fix for this problem.
          git config --global --add safe.directory ${GITHUB_WORKSPACE}

      - name: Checkout Zephyr
        run:
          west init

      - name: Checkout Intel HAL
        uses: actions/checkout@v3
        with:
          path: modules/hal/intel

      - name: Build IUT Test for ISH 5.4.1
        run:
          west build -b intel_ish_5_4_1 modules/hal/intel/zephyr/iut_test -d iut_build_5_4_1

      - name: Build IUT Test for ISH 5.6.0
        run:
          west build -b intel_ish_5_6_0 modules/hal/intel/zephyr/iut_test -d iut_build_5_6_0

      - name: Build IUT Test for ISH 5.8.0
        run:
          west build -b intel_ish_5_8_0 modules/hal/intel/zephyr/iut_test -d iut_build_5_8_0
