name: Regression tests

inputs:
  artifact-name:
    description: 'Name of the uploaded artifact'
    required: false
    default: 'regression-test-results'

runs:
  using: "composite"
  steps:
    - name: Show gcc version
      run: |
        gcc --version
      shell: bash

    - name: Show ldd version
      run: |
        ldd --version || true
      shell: bash

    - name: Run regression tests
      run: run-tests --test-config=INCHI-1-TEST/tests/test_library/config/config.regression.py --data-config=INCHI-1-TEST/tests/test_library/config/config.ci.py
      shell: bash

    - name: Write regression summary
      if: '!cancelled()'
      run: parse-log --test-config=INCHI-1-TEST/tests/test_library/config/config.regression.py --data-config=INCHI-1-TEST/tests/test_library/config/config.ci.py
      shell: bash

    - name: Upload regression test results
      if: '!cancelled()'
      uses: actions/upload-artifact@v4
      with:
        name: ${{ inputs.artifact-name }}
        path: |
          ./INCHI-1-TEST/tests/test_library/data/ci/*_regression_ci.log
          ./INCHI-1-TEST/tests/test_library/data/ci/*_regression_ci_*.html
