# DO NOT EDIT - GENERATED FROM .github/workflows-in/infra.ys

name: infra
defaults:
  run:
    shell: bash -e -x {0}
'on':
  workflow_dispatch: null
  push:
    branches:
    - master
  pull_request:
    branches:
    - '*'
env:
  PROJ_PKG_NAME: rapidyaml-
  PROJ_PFX_TARGET: ryml-
  PROJ_PFX_CMAKE: RYML_
  CMAKE_FLAGS: -DRYML_TEST_SUITE=ON
  NUM_JOBS_BUILD: null
jobs:
  check_workflows:
    if: always()
    continue-on-error: false
    runs-on: ubuntu-24.04
    steps:
    - name: checkout (action)
      uses: actions/checkout@v4
      with:
        submodules: recursive
        fetch-depth: 0
    - name: install ys
      run: make -C .github/workflows-in install-ys
    - name: generate workflows
      run: make -C .github/workflows-in build
    - name: test workflows
      run: |
        wc --version
        wc --help
        make -C .github/workflows-in test
        status=$?
        if [ $status != 0 ] ; then
          echo "ERROR: generated workflows are out of date"
        fi
        exit $status
  check_doc:
    if: always()
    continue-on-error: false
    runs-on: ubuntu-24.04
    env:
      DOXY_VERSION: 1.12.0
      DOXY_DIR: /tmp/doxydir/bin
    steps:
    - name: checkout (action)
      uses: actions/checkout@v4
      with:
        submodules: recursive
        fetch-depth: 0
    - name: install python
      uses: actions/setup-python@v5
      with:
        python-version: 3.9
    - name: install requirements
      run: pip install -r doc/requirements.txt
    - name: install wget
      run: |
        sudo apt-get update
        sudo apt install -y wget
    - name: install doxygen
      run: |
        ver=$DOXY_VERSION
        uver=$(echo $ver | sed "s:\.:_:g")
        name=$(dirname $DOXY_DIR)
        dst=$(dirname $name)
        url="https://github.com/doxygen/doxygen/releases/download/Release_$uver/doxygen-$ver.linux.bin.tar.gz"
        ( \
          cd $dst ; \
          wget $url ; \
          tar xvfz $(basename $url) ; \
          ls -lFhp | grep dox ; \
          mv -v doxygen-$ver $name ; \
        )
    - name: doxygen version
      run: |
        export PATH=$DOXY_DIR:$PATH
        which doxygen
        doxygen --version
    - name: check doxygen docs
      run: |
        export PATH=$DOXY_DIR:$PATH
        # put doxygen to fail if there are warnings
        sed "s/WARN_AS_ERROR.*= .*/WARN_AS_ERROR = FAIL_ON_WARNINGS_PRINT/g" -i doc/Doxyfile
        make -C doc doxy
    - name: check sphinx
      run: |
        # put doxygen to not fail if there are warnings.
        sed "s/WARN_AS_ERROR.*= .*/WARN_AS_ERROR = NO/g" -i doc/Doxyfile
        export PATH=$DOXY_DIR:$PATH
        make -C doc html
