!yamlscript/v0:

:use common: :all
:: workflow-setup()

jobs:
  emscripten:
    name: emscripten/${{matrix.emver}}/c++${{matrix.std}}/${{matrix.bt}}
    :: setup-job('emscripten' 'emscripten')
    # this job is always causing trouble, with failures showing unreadable code
    # dumps. eg https://github.com/biojppm/rapidyaml/actions/runs/10368522906
    # Disabling until we can find a proper way to investigate these failures:
    if: ${{ false }}
    runs-on: ${{matrix.os}}
    strategy:
      fail-fast: false
      matrix:
        item =: \({:std %1, :cxx 'em++', :emver %2, :bt %3,
                   :os 'ubuntu-latest', :bitlinks :static32})
        include:
       #- ! item(11 '2.0.34' 'Debug')
        - ! item(11 '2.0.34' 'Release')
       #- ! item(20 '2.0.34' 'Debug')
        - ! item(20 '2.0.34' 'Release')
       #- ! item(11 '3.0.0' 'Debug')
        - ! item(11 '3.0.0' 'Release')
       #- ! item(20 '3.0.0' 'Debug')
        - ! item(20 '3.0.0' 'Release')
    env:: load('share/env.yaml') + {'EMSCRIPTEN_CACHE_FOLDER' 'emsdk-cache'}
         + {'CMAKE_FLAGS' '-DRYML_TEST_SUITE=OFF'}
    steps:
    - name: checkout
      uses: actions/checkout@v4
      with: {submodules: recursive}
    - name: setup emscripten cache
      id: cache-system-libraries
      uses: actions/cache@v4
      with:
        path: ${{env.EMSCRIPTEN_CACHE_FOLDER}}
        key: ${{matrix.emver}}-${{runner.os}}
    - name: setup emscripten
      uses: mymindstorm/setup-emsdk@v11
      with:
        version: ${{matrix.emver}}
        actions-cache-folder: ${{env.EMSCRIPTEN_CACHE_FOLDER}}
    - name: show info
      run: source .github/setenv.sh && c4_show_info
    - name: static32-configure-------------------------------------------------
      run: source .github/setenv.sh && c4_cfg_test static32
    - name: static32-build
      run: source .github/setenv.sh && c4_build_test static32
    - name: static32-run
      run: source .github/setenv.sh && c4_run_test static32
