Support hashFiles #40

Open
opened 2023-03-07 05:26:13 +00:00 by wolfogre · 7 comments
Owner

About hashFiles:

0a1a67bb-dfe3-42b8-88f2-924c8737a7cd

See https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows

act_runner will panic when using hashFiles, it could be fixed by https://github.com/nektos/act/pull/1667 , but it cannot make act_runner support it.

Because there's no code files in local disk for act_runner to read, the files could be in containers.

About `hashFiles`: ![0a1a67bb-dfe3-42b8-88f2-924c8737a7cd](/attachments/eaa7e111-dd28-41e7-9b83-7bcba225146e) See https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows act_runner will panic when using `hashFiles`, it could be fixed by https://github.com/nektos/act/pull/1667 , but it cannot make act_runner support it. Because there's no code files in local disk for act_runner to read, the files could be in containers.
Contributor

hashfiles in act is broken by design, act should probably run it within the "container" by using node and the hashfiles js script of actions/runner.

The following seems to require adding hashfiles as an externally defined function, in the current place is no container instance or dependency

Just an indea, but hashfiles doesn't gain much attention for me

hashfiles in act is broken by design, act should probably run it within the "container" by using node and the hashfiles js script of actions/runner. The following seems to require adding hashfiles as an externally defined function, in the current place is no container instance or dependency - Call ReplaceLogWriter (capture output of hashfiles) - Call Exec with node https://github.com/actions/runner/blob/main/src/Misc/layoutbin/hashFiles/index.js (src https://github.com/actions/runner/tree/main/src/Misc/expressionFunc/hashFiles) env and parameter for args and env https://github.com/actions/runner/blob/main/src/Runner.Worker/Expressions/HashFilesFunction.cs - extract hash out of stderr - Restore Logwriter via ReplaceLogWriter _Just an indea, but hashfiles doesn't gain much attention for me_
lunny added the
kind
feature
label 2023-03-14 05:50:20 +00:00
Member

https://gitea.com/actions/go-hashfiles

I created an action that computes SHA256 checksum for specified files. I think this action can provide similar function until act_runner fully supports hashFiles.

https://gitea.com/actions/go-hashfiles I created an action that computes SHA256 checksum for specified files. I think this action can provide similar function until act_runner fully supports `hashFiles`.
Contributor

https://gitea.com/seepine/hash-files or https://github.com/seepine/hash-files

I created an action that computes SHA256 base on node.
It doesn't need to setup-go when runs-on ubuntu-latest

- uses: seepine/hash-files@v1
  with:
    # The patterns used to match files.
    patterns: '**/package-lock.json'

    # Multiple patterns should be seperated by `\n`
    patterns: |
      **/package-lock.json
      **/yarn.lock           
https://gitea.com/seepine/hash-files or https://github.com/seepine/hash-files I created an action that computes SHA256 base on node. It doesn't need to `setup-go` when runs-on `ubuntu-latest` ```yml - uses: seepine/hash-files@v1 with: # The patterns used to match files. patterns: '**/package-lock.json' # Multiple patterns should be seperated by `\n` patterns: | **/package-lock.json **/yarn.lock ```
Contributor

BTW I currently use this patch in my act fork

(aec5ff7a02, dd3cfce42d)

Better user experience than rewriting workflows.

I'm not shure how clean these can be applied to nektos/act and gitea/act

I plan to create a pr to nektos/act at some point of time

BTW I currently use this patch in my act fork (https://github.com/ChristopherHX/act/commit/aec5ff7a0240c136a637fd6558befc5e7553cf08, https://github.com/ChristopherHX/act/commit/dd3cfce42d4dc4e7efb708c6c0224e2f202b9469) Better user experience than rewriting workflows. _I'm not shure how clean these can be applied to nektos/act and gitea/act_ I plan to create a pr to nektos/act at some point of time
Contributor

BTW I currently use this patch in my act fork

(aec5ff7a02, dd3cfce42d)

Better user experience than rewriting workflows.

I'm not shure how clean these can be applied to nektos/act and gitea/act

I plan to create a pr to nektos/act at some point of time

Of course, it is best for act to directly support hashFiles, looking forward to your PR

> BTW I currently use this patch in my act fork > > (https://github.com/ChristopherHX/act/commit/aec5ff7a0240c136a637fd6558befc5e7553cf08, https://github.com/ChristopherHX/act/commit/dd3cfce42d4dc4e7efb708c6c0224e2f202b9469) > > Better user experience than rewriting workflows. > > _I'm not shure how clean these can be applied to nektos/act and gitea/act_ > > I plan to create a pr to nektos/act at some point of time Of course, it is best for act to directly support hashFiles, looking forward to your PR
wolfogre reopened this issue 2023-08-04 02:46:00 +00:00
Author
Owner
https://github.com/nektos/act/pull/1940

https://gitea.com/seepine/hash-files or https://github.com/seepine/hash-files

I created an action that computes SHA256 base on node.
It doesn't need to setup-go when runs-on ubuntu-latest

seepine/hash-files is much faster than actions/go-hashfiles (0 second vs 16 seconds)

it seems that actions written in Go are slow due to the building process.

> https://gitea.com/seepine/hash-files or https://github.com/seepine/hash-files > > I created an action that computes SHA256 base on node. > It doesn't need to `setup-go` when runs-on `ubuntu-latest` `seepine/hash-files` is much faster than `actions/go-hashfiles` (0 second vs 16 seconds) it seems that actions written in Go are slow due to the building process.
Sign in to join this conversation.
No Milestone
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/act_runner#40
No description provided.