julia-actions / setup-julia

This action sets up a Julia environment for use in actions by downloading a specified version of Julia and adding it to PATH.
MIT License
93 stars 23 forks source link

extract julia directly to tool path to maintain mtimes #196

Closed IanButterworth closed 9 months ago

IanButterworth commented 9 months ago

A bit of a hack to get julia installed with original mtimes to help https://github.com/JuliaLang/julia/issues/50667

The comments explain the reasoning.

Also should be a bit faster as it avoids the cp action.

You can see here that 1.10.0 has the release mtimes

StatStruct("/Users/runner/hostedtoolcache/julia/1.10.0/x64/share/julia/stdlib/v1.10/MbedTLS_jll/src/MbedTLS_jll.jl" 
size: 2169 bytes device: 16777220 inode: 7005911 mode: 0o100644 (-rw-r--r--) nlink: 1 uid: 501 (runner) 
gid: 20 (staff) rdev: 0 blksz: 4096 blocks: 8 
mtime: 2023-12-25T20:50:13+0000 (9 days ago) ctime: 2024-01-04T06:25:27+0000 (8 seconds ago))

The added mtime test fails on master to illustrate the issue. https://github.com/julia-actions/setup-julia/pull/200

Closes https://github.com/julia-actions/setup-julia/pull/100 Closes https://github.com/julia-actions/setup-julia/pull/165

DilumAluthge commented 9 months ago

Can we add a test for this? E.g. do StatStruct in Julia (like in your example above) and check the mtime?

IanButterworth commented 9 months ago

Added mtime test which fails on master https://github.com/julia-actions/setup-julia/pull/200

DilumAluthge commented 9 months ago

Can we remove the tests from here, and keep the tests in #200, and merge #200 separately?

Reason: I am hoping that this PR will be a short-term solution; I'm hoping that the long-term solution will be for me to get a patch into upstream tc.cacheDir to add the ability to preserve mtimes. If we are able to get that feature accepted into upstream, then we can revert this PR. But if/when we revert this PR, I wouldn't want to revert the tests. If we keep the tests separate in #200, then later we can revert this PR without reverting #200.

omus commented 9 months ago

I'm hoping that the long-term solution will be for me to get a patch into upstream tc.cacheDir to add the ability to preserve mtimes.

If we're changing tool-cache you may want to introduce a tc.cache function which provides a callback so we just do the install inside the callback. I foresee that this new function could be used by tc.cacheFile and tc.cacheDir.

IanButterworth commented 9 months ago

Ok, #200 is updated. Probably best to merge that as failing first then rebase this

DilumAluthge commented 9 months ago

This is great!

Is this the last change needed to make /compiled reusable in GitHub Actions CI when using Julia 1.10?

IanButterworth commented 9 months ago

Yeah, should be.

IanButterworth commented 9 months ago

I made a test release for 1.9.5 using bin/build-test-release.sh and tested it here https://github.com/IanButterworth/PowerMonitor.jl/pull/2

with

uses: julia-actions/setup-julia@test/ib/1_9_5/releases/v1.9.5

And all platforms avoid re-precompilation once cached

IanButterworth commented 9 months ago

Released now https://github.com/julia-actions/setup-julia/releases/tag/v1.9.5

omus commented 9 months ago

Can we remove the tests from here, and keep the tests in #200, and merge #200 separately?

Reason: I am hoping that this PR will be a short-term solution; I'm hoping that the long-term solution will be for me to get a patch into upstream tc.cacheDir to add the ability to preserve mtimes. If we are able to get that feature accepted into upstream, then we can revert this PR. But if/when we revert this PR, I wouldn't want to revert the tests. If we keep the tests separate in #200, then later we can revert this PR without reverting #200.

Upstream tc.cacheDir PR to preserve mtimes: https://github.com/actions/toolkit/pull/1617