gradle / actions

A collection of GitHub Actions to accelerate your Gradle Builds on GitHub
https://github.com/marketplace/actions/build-with-gradle
MIT License
163 stars 40 forks source link

Wrapper validation fails for repos with unmappable characters in file names #366

Open sschuberth opened 2 months ago

sschuberth commented 2 months ago

As part of our project we have committed test assets that deliberately contain unmappable characters as part of their file name, see this. When running the wrapper validation (or in fact also the Gradle setup), CI fails with this:

Run gradle/actions/wrapper-validation@16bf8bc8fe830fa669c3c9f914d3eb147c629707
Error: Error: ENOENT: no such file or directory, lstat '/home/runner/work/ort/ort/utils/common/src/test/assets/unmappable-characters/testu��es.txt'
Error: ENOENT: no such file or directory, lstat '/home/runner/work/ort/ort/utils/common/src/test/assets/unmappable-characters/testu��es.txt'
    at Object.lstatSync (node:fs:1633:25)
    at /home/runner/work/_actions/gradle/actions/16bf8bc8fe830fa669c3c9f914d3eb147c629707/dist/wrapper-validation/main/index.js:127651:19
    at Array.map (<anonymous>)
    at recursivelyListFiles (/home/runner/work/_actions/gradle/actions/16bf8bc8fe830fa669c3c9f914d3eb147c629707/dist/wrapper-validation/main/index.js:127649:59)
    at async Promise.all (index 9)
    at async recursivelyListFiles (/home/runner/work/_actions/gradle/actions/16bf8bc8fe830fa669c3c9f914d3eb147c629707/dist/wrapper-validation/main/index.js:127649:27)
    at async Promise.all (index 0)
    at async recursivelyListFiles (/home/runner/work/_actions/gradle/actions/16bf8bc8fe830fa669c3c9f914d3eb147c629707/dist/wrapper-validation/main/index.js:127649:27)
    at async Promise.all (index 1)
    at async recursivelyListFiles (/home/runner/work/_actions/gradle/actions/16bf8bc8fe830fa669c3c9f914d3eb147c629707/dist/wrapper-validation/main/index.js:127649:27)

Could such error be ignored / turned into a warning instead of making the action fail?

bigdaz commented 2 months ago

Does setup-gradle still fail if you disable wrapper validation?

      with:
        validate-wrappers: false
sschuberth commented 2 months ago

Apparently that works.

I should also note that I'm not using validate-wrappers: true on gradle/actions/setup-gradle, but gradle/actions/wrapper-validation directly, if that makes a difference.

sschuberth commented 2 months ago

BTW, the file I'm using for testing can be cloned from https://github.com/fshost/node-dir/tree/a57c3b1b571dd91f464ae398090ba40f64ba38a2/test/fixtures/testdir5.

bigdaz commented 1 month ago

@sschuberth I tried to clone the repo in order to reproduce this, and that wasn't even possible

~/dev/playground ❯ git clone git@github.com:fshost/node-dir.git
Cloning into 'node-dir'...
remote: Enumerating objects: 368, done.
remote: Total 368 (delta 0), reused 0 (delta 0), pack-reused 368 (from 1)
Receiving objects: 100% (368/368), 67.10 KiB | 369.00 KiB/s, done.
Resolving deltas: 100% (167/167), done.
error: unable to create file test/fixtures/testdir5/testu��es.txt: Illegal byte sequence
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

How did you manage to get those files committed? Can you provide a PR that will add the files to this repo? Just the presence of the file somewhere like sources/test/data should be enough to trigger this failure when wrapper-validation is carried out on the repo itself.

bigdaz commented 1 month ago

I suspect that something like this might resolve the issue: https://github.com/gradle/actions/pull/388

Are you able to test it locally?

sschuberth commented 1 month ago

I tried to clone the repo in order to reproduce this, and that wasn't even possible

Are you on macOS maybe?

How did you manage to get those files committed?

I did nothing special, just cloning https://github.com/fshost/node-dir.git worked for me on Fedora Linux 40 with Git 2.46.0, and I was able to copy over that file to my own repo, and commit it.

Can you provide a PR that will add the files to this repo?

Here you go: https://github.com/gradle/actions/pull/391.

Are you able to test it locally?

Not sure how. You mean with https://github.com/nektos/act?

sschuberth commented 3 weeks ago

Can you provide a PR that will add the files to this repo?

Here you go: #391.

Any update @bigdaz? Does that PR help you to move forward?