EnricoMi / publish-unit-test-result-action

GitHub Action to publish unit test results on GitHub
Apache License 2.0
625 stars 183 forks source link

ERROR: Could not open requirements file: [Errno 2] No such file or directory: '.GITHUB_ACTION_PATH\\..\\python\\requirements.txt' #581

Closed marcelom2s closed 9 months ago

marcelom2s commented 9 months ago

I have the following error: ERROR: Could not open requirements file: [Errno 2] No such file or directory: '.GITHUB_ACTION_PATH\\..\\python\\requirements.txt'

When I try the following job:

  - name: Publish Test Results
    uses: EnricoMi/publish-unit-test-result-action/windows@v2
    if: always()
    with:
      files: |
        TestResults/*.trx        

Any idea why? Here is the log from the GitHub Actions:

Run EnricoMi/publish-unit-test-result-action/windows@v[2](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:2)
  with:
    files: TestResults/*.trx        

    github_token: ***
    github_token_actor: github-actions
    github_retries: 10
    check_name: Test Results
    comment_mode: always
    fail_on: test failures
    action_fail: false
    action_fail_on_inconclusive: false
    time_unit: seconds
    report_suite_logs: none
    ignore_runs: false
    check_run: true
    job_summary: true
    compare_to_earlier_commit: true
    pull_request_build: merge
    check_run_annotations: all tests, skipped tests
    seconds_between_github_reads: 0.25
    seconds_between_github_writes: 2.0
    json_thousands_separator:  
    json_suite_details: false
    json_test_case_results: false
    search_pull_requests: false
Run # Check for Python[3](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:3)
  # Check for Python3
  Write-Output "::group::Check for Python3"
  try {
    # we check version here just to execute `python3` with an argument
    # on Windows, there is a `python3.exe` that is a proxy to trigger installation from app store
    # command `which python3` finds that, but `python3 -V` does not return the version on stdout
    if ( !(Get-Command python3 -ErrorAction SilentlyContinue) -Or -Not ((python3 -V 2> $null) -Like "Python 3.*") ) {
      if ( !(Get-Command python -ErrorAction SilentlyContinue) -Or -Not ((python -V 2> $null) -Like "Python 3.*") ) {
        Write-Output "::error::No python3 interpreter found. Please setup python before running this action. You could use https://github.com/actions/setup-python."
        Exit 1
      }

      $PYTHON_BIN = python -c "import sys; print(sys.executable)"
    } else {
      $PYTHON_BIN = python3 -c "import sys; print(sys.executable)"
    }
    Write-Output "Python that creates venv: $PYTHON_BIN"
    "PYTHON_BIN=$PYTHON_BIN" | Out-File -FilePath $env:GITHUB_ENV -Append

    $VERSION = Invoke-Expression -Command "& '$PYTHON_BIN' -V"
    Write-Output "Python version: $VERSION"
    "version=$VERSION" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
  } finally {
    Write-Output "::endgroup::"
  }
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
Check for Python3
  Python that creates venv: C:\hostedtoolcache\windows\Python\3.9.13\x6[4](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:4)\python3.exe
  Python version: Python 3.9.13
Run actions/cache/restore@v4
  with:
    path: ~\AppData\Local\pip\Cache
    key: enricomi-publish-action-Windows-X64-pip-Python 3.9.13-70a313922fdbeb7398ec60313d908b11
    enableCrossOsArchive: false
    fail-on-cache-miss: false
    lookup-only: false
  env:
    PYTHON_BIN: C:\hostedtoolcache\windows\Python\3.9.13\x64\python3.exe
Cache Size: ~11 MB (112[5](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:5)2522 B)
"C:\Program Files\Git\usr\bin\tar.exe" -xf D:/a/_temp/19e5bfc9-773f-4a33-b553-18f30019212b/cache.tzst -P -C D:/a/myrepository/myrepository --force-local --use-compress-program "zstd -d"
Cache restored successfully
Cache restored from key: enricomi-publish-action-Windows-X[6](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:6)4-pip-Python 3.9.13-[7](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:7)0a313922fdbeb739[8](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:8)ec60313d[9](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:9)08b[11](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:11)
Run # Create virtualenv
  # Create virtualenv
  Write-Output "::group::Create virtualenv"
  try {
    Write-Output "Python that creates venv: $env:PYTHON_BIN"

    Write-Output "Creating virtual environment"
    if ( -Not (Invoke-Expression -Command "& '$env:PYTHON_BIN' -m virtualenv enricomi-publish-action-venv" 2> $null) -And -Not (Invoke-Expression -Command "& '$env:PYTHON_BIN' -m venv enricomi-publish-action-venv" 2> $null) ) {
      Write-Output "Looks like there is neither virtualenv nor venv package installed"
      if ( -Not (Invoke-Expression -Command "& '$env:PYTHON_BIN' -m pip install --user virtualenv" 2> $null) ) {
        Write-Output "Installing virtualenv package with PIP option '--user' failed, now trying without"
        if ( -Not (Invoke-Expression -Command "& '$env:PYTHON_BIN' -m pip install virtualenv" 2> $null) ) {
          Write-Output "::error::Installing virtualenv package failed"
          Exit 1
        }
      }

      if ( -Not (Invoke-Expression -Command "& '$env:PYTHON_BIN' -m virtualenv enricomi-publish-action-venv" 2> $null) ) {
        Write-Output "::error::Cannot create venv after installing virtualenv package"
        Exit 1
      }
    }

    Write-Output "Finding Python interpreter in venv"
    $PYTHON_VENV = enricomi-publish-action-venv\Scripts\python -c "import sys; print(sys.executable)"
    Write-Output "Python in venv: $PYTHON_VENV"
    "PYTHON_VENV=$PYTHON_VENV" | Out-File -FilePath $env:GITHUB_ENV -Append
  } finally {
    Write-Output "::endgroup::"
  }
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    PYTHON_BIN: C:\hostedtoolcache\windows\Python\3.9.[13](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:13)\x64\python3.exe
Create virtualenv
  Python that creates venv: C:\hostedtoolcache\windows\Python\3.9.13\x64\python3.exe
  Creating virtual environment
  Looks like there is neither virtualenv nor venv package installed
  Finding Python interpreter in venv
  Python in venv: D:\a\myproject\myproject\enricomi-publish-action-venv\Scripts\python.exe
Run # Install Python dependencies
  # Install Python dependencies
  Write-Output "::group::Install Python dependencies"
  try {
    # make sure wheel is installed, which improves installing our dependencies
    Invoke-Expression -Command "& '$env:PYTHON_VENV' -m pip install wheel"
    Invoke-Expression -Command "& '$env:PYTHON_VENV' -m pip install -r '$env.GITHUB_ACTION_PATH\..\python\requirements.txt'"
  } finally {
    Write-Output "::endgroup::"
  }
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    PYTHON_BIN: C:\hostedtoolcache\windows\Python\3.9.13\x64\python3.exe
    PYTHON_VENV: D:\a\myrepository\myrepository\enricomi-publish-action-venv\Scripts\python.exe
Install Python dependencies
  Requirement already satisfied: wheel in d:\a\myrepository\myrepository\enricomi-publish-action-venv\lib\site-packages (0.[42](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:43).0)
  ERROR: Could not open requirements file: [Errno 2] No such file or directory: '.GITHUB_ACTION_PATH\\..\\python\\requirements.txt'
Error: Process completed with exit code 1.

/actions/runs/8073530472/job/22057358719#step:13:2)
  with:
    files: TestResults/*.trx        

    github_token: ***
    github_token_actor: github-actions
    github_retries: 10
    check_name: Test Results
    comment_mode: always
    fail_on: test failures
    action_fail: false
    action_fail_on_inconclusive: false
    time_unit: seconds
    report_suite_logs: none
    ignore_runs: false
    check_run: true
    job_summary: true
    compare_to_earlier_commit: true
    pull_request_build: merge
    check_run_annotations: all tests, skipped tests
    seconds_between_github_reads: 0.25
    seconds_between_github_writes: 2.0
    json_thousands_separator:  
    json_suite_details: false
    json_test_case_results: false
    search_pull_requests: false
Run # Check for Python[3](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:3)
  # Check for Python3
  Write-Output "::group::Check for Python3"
  try {
    # we check version here just to execute `python3` with an argument
    # on Windows, there is a `python3.exe` that is a proxy to trigger installation from app store
    # command `which python3` finds that, but `python3 -V` does not return the version on stdout
    if ( !(Get-Command python3 -ErrorAction SilentlyContinue) -Or -Not ((python3 -V 2> $null) -Like "Python 3.*") ) {
      if ( !(Get-Command python -ErrorAction SilentlyContinue) -Or -Not ((python -V 2> $null) -Like "Python 3.*") ) {
        Write-Output "::error::No python3 interpreter found. Please setup python before running this action. You could use https://github.com/actions/setup-python."
        Exit 1
      }

      $PYTHON_BIN = python -c "import sys; print(sys.executable)"
    } else {
      $PYTHON_BIN = python3 -c "import sys; print(sys.executable)"
    }
    Write-Output "Python that creates venv: $PYTHON_BIN"
    "PYTHON_BIN=$PYTHON_BIN" | Out-File -FilePath $env:GITHUB_ENV -Append

    $VERSION = Invoke-Expression -Command "& '$PYTHON_BIN' -V"
    Write-Output "Python version: $VERSION"
    "version=$VERSION" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
  } finally {
    Write-Output "::endgroup::"
  }
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
Check for Python3
  Python that creates venv: C:\hostedtoolcache\windows\Python\3.9.13\x6[4](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:4)\python3.exe
  Python version: Python 3.9.13
Run actions/cache/restore@v4
  with:
    path: ~\AppData\Local\pip\Cache
    key: enricomi-publish-action-Windows-X64-pip-Python 3.9.13-70a313922fdbeb7398ec60313d908b11
    enableCrossOsArchive: false
    fail-on-cache-miss: false
    lookup-only: false
  env:
    PYTHON_BIN: C:\hostedtoolcache\windows\Python\3.9.13\x64\python3.exe
Cache Size: ~11 MB (112[5](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:5)2522 B)
"C:\Program Files\Git\usr\bin\tar.exe" -xf D:/a/_temp/19e5bfc9-773f-4a33-b553-18f30019212b/cache.tzst -P -C D:/a/myrepository/myrepository --force-local --use-compress-program "zstd -d"
Cache restored successfully
Cache restored from key: enricomi-publish-action-Windows-X[6](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:6)4-pip-Python 3.9.13-[7](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:7)0a313922fdbeb739[8](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:8)ec60313d[9](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:9)08b[11](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:11)
Run # Create virtualenv
  # Create virtualenv
  Write-Output "::group::Create virtualenv"
  try {
    Write-Output "Python that creates venv: $env:PYTHON_BIN"

    Write-Output "Creating virtual environment"
    if ( -Not (Invoke-Expression -Command "& '$env:PYTHON_BIN' -m virtualenv enricomi-publish-action-venv" 2> $null) -And -Not (Invoke-Expression -Command "& '$env:PYTHON_BIN' -m venv enricomi-publish-action-venv" 2> $null) ) {
      Write-Output "Looks like there is neither virtualenv nor venv package installed"
      if ( -Not (Invoke-Expression -Command "& '$env:PYTHON_BIN' -m pip install --user virtualenv" 2> $null) ) {
        Write-Output "Installing virtualenv package with PIP option '--user' failed, now trying without"
        if ( -Not (Invoke-Expression -Command "& '$env:PYTHON_BIN' -m pip install virtualenv" 2> $null) ) {
          Write-Output "::error::Installing virtualenv package failed"
          Exit 1
        }
      }

      if ( -Not (Invoke-Expression -Command "& '$env:PYTHON_BIN' -m virtualenv enricomi-publish-action-venv" 2> $null) ) {
        Write-Output "::error::Cannot create venv after installing virtualenv package"
        Exit 1
      }
    }

    Write-Output "Finding Python interpreter in venv"
    $PYTHON_VENV = enricomi-publish-action-venv\Scripts\python -c "import sys; print(sys.executable)"
    Write-Output "Python in venv: $PYTHON_VENV"
    "PYTHON_VENV=$PYTHON_VENV" | Out-File -FilePath $env:GITHUB_ENV -Append
  } finally {
    Write-Output "::endgroup::"
  }
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    PYTHON_BIN: C:\hostedtoolcache\windows\Python\3.9.[13](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:13)\x64\python3.exe
Create virtualenv
  Python that creates venv: C:\hostedtoolcache\windows\Python\3.9.13\x64\python3.exe
  Creating virtual environment
  Looks like there is neither virtualenv nor venv package installed
  Finding Python interpreter in venv
  Python in venv: D:\a\myrepository\myrepository\enricomi-publish-action-venv\Scripts\python.exe
Run # Install Python dependencies
  # Install Python dependencies
  Write-Output "::group::Install Python dependencies"
  try {
    # make sure wheel is installed, which improves installing our dependencies
    Invoke-Expression -Command "& '$env:PYTHON_VENV' -m pip install wheel"
    Invoke-Expression -Command "& '$env:PYTHON_VENV' -m pip install -r '$env.GITHUB_ACTION_PATH\..\python\requirements.txt'"
  } finally {
    Write-Output "::endgroup::"
  }
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    PYTHON_BIN: C:\hostedtoolcache\windows\Python\3.9.13\x64\python3.exe
    PYTHON_VENV: D:\a\myrepository\myrepository\enricomi-publish-action-venv\Scripts\python.exe
Install Python dependencies
  Requirement already satisfied: wheel in d:\a\myrepository\myrepository\enricomi-publish-action-venv\lib\site-packages (0.[42](https://github.com/myproject/myrepository/actions/runs/8073530472/job/22057358719#step:13:43).0)
  ERROR: Could not open requirements file: [Errno 2] No such file or directory: '.GITHUB_ACTION_PATH\\..\\python\\requirements.txt'
Error: Process completed with exit code 1.
marcelom2s commented 9 months ago

I think it's the same issue reported here: https://github.com/EnricoMi/publish-unit-test-result-action/issues/580

EnricoMi commented 9 months ago

Yes, looks like a duplicate.

EnricoMi commented 9 months ago

Fix has been released. Thanks for reporting!

marcelom2s commented 9 months ago

Yes, it's working now, thanks!