Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to find files with mixed backward slashes in path #127

Closed
atruskie opened this issue Jun 22, 2021 · 2 comments · Fixed by #128
Closed

Fails to find files with mixed backward slashes in path #127

atruskie opened this issue Jun 22, 2021 · 2 comments · Fixed by #128
Labels
bug Something isn't working

Comments

@atruskie
Copy link

With these options set:

      - name: Publish Test Results
        uses: dorny/test-reporter@v1.4.3
        with:
          name: AP Test Results win-x64 Release
          path: "${{runner.temp}}/Acoustics.Test_Results/**/*.trx"
          reporter: "dotnet-trx"

The action fails to find any files:

Run dorny/test-reporter@v1.4.3
  with:
    name: AP Test Results win-x64 Release
    path: D:\a\_temp/Acoustics.Test_Results/**/*.trx
    reporter: dotnet-trx
    list-suites: all
    list-tests: all
    max-annotations: 10
    fail-on-error: true
  env: {}
Check runs will be created with SHA=784cf60c324629adef252f2338961c097772c804
::group::Listing all files tracked by git
Listing all files tracked by git
Found 1320 files tracked by GitHub
Using test report parser 'dotnet-trx'
::group::Creating test report AP Test Results win-x64 Release
Creating test report AP Test Results win-x64 Release
  Warning: No file matches path D:\a\_temp/Acoustics.Test_Results/**/*.trx
  ::endgroup::
::set-output name=conclusion::success
##[debug]='success'
::set-output name=passed::0
##[debug]='0'
::set-output name=failed::0
##[debug]='0'
::set-output name=skipped::0
##[debug]='0'
::set-output name=time::0
##[debug]='0'
Error: No test report files were found
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Publish Test Results

The issues is that the GitHub runner.temp context variable contains \ slashes in the path.

Creating a safe version of runner.temp in a previous workflow step allows me to bypass the problem:

      - name: Calculate variables
        id: calc_vars
        shell: pwsh
        run: |
          $safe_temp = "${{ runner.temp }}" -replace "\\","/"
          echo "::set-output name=SAFE_TEMP::$safe_temp"

With that, this will work:

      - name: Publish Test Results
        uses: dorny/test-reporter@v1.4.3
        with:
          name: AP Test Results win-x64 Release
          path: "${{  steps.calc_vars.outputs.SAFE_TEMP }}/Acoustics.Test_Results/**/*.trx"
          reporter: "dotnet-trx"

I think the path just needs to be normalized before you pass it to the glob function.

@dorny dorny added the bug Something isn't working label Jun 22, 2021
@dorny
Copy link
Owner

dorny commented Jun 22, 2021

Thanks!

You are right. I will fix it later today.

dorny added a commit that referenced this issue Jun 22, 2021
The fast-glob library that is internally used interprets backslashes as escape characters. If enabled, all backslashes in provided path will be replaced by forward slashes and act as directory separators. It might be useful when path input variable is composed dynamically from existing directory paths on Windows.

Closes #127
@dorny
Copy link
Owner

dorny commented Jun 22, 2021

I've added the option path-replace-backslashes. If enabled, all backslashes in the provided path will be replaced by forward slashes and act as directory separators.

It's not enabled by default. I want to keep default settings compatible with micromatch behavior.
https://github.com/micromatch/micromatch#backslashes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants