name: make check

on:
  push:
    branches: [ develop ]
  pull_request:
    branches: [ develop, master ]

jobs:
  tests:
    name: 'make check tests'
    runs-on: 'ubuntu-latest'
    steps:
    - name: checkout software
      uses: actions/checkout@v2
      with:
        path: software
    - name: 'refresh install'
      run: |
        sudo apt-get update --fix-missing
    - name: 'install libsdl2-dev'
      run: |
        sudo apt-get install --fix-broken --ignore-missing libsdl2-dev
    - name: 'install python3 pip'
      run: |
        sudo apt-get install --fix-broken --ignore-missing python3-pip
    - name: 'install unittest-xml-reporting'
      run: |
        pip3 install unittest-xml-reporting
    - name: 'build dir'
      run: |
        rm -rf build
        mkdir build
    - name: 'configure'
      run: |
        cd build && cmake -DTESTFLAGS=--xmlresults=TEST-zziplibs.xml -DZZIP_TESTCVE=OFF ../software
    - name: 'make all'
      run: |
        cd build && make all VERBOSE=1
    - name: 'make check'
      run: |
        cd build && make check VERBOSE=1 || true
    - name: 'find xml'
      run: |
        find . -name '*.xml'
    - name: 'publish testresults'
      uses: EnricoMi/publish-unit-test-result-action@v1
      with:
        commit: ${{ github.event.workflow_run.head_sha }}
        files: '**/TEST-*.xml'
        check_name: 'Unit tests without docker-based tests'
        report_individual_runs: "true"
