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

extract julia directly to tool path to maintain mtimes #196

Merged
merged 18 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if VERSION >= v"1.7.0" # pkgdir was introduced here, and before then mtime wasn'
using Pkg
src = pkgdir(Pkg, "src", "Pkg.jl")
# mtime is when it's compressed, ctime is when the file is extracted
if !<(mtime(src), ctime(src))
if mtime(src) >= ctime(src)
error("source mtime ($(mtime(src))) is not earlier than ctime ($(ctime(src)))")
end
end
2 changes: 1 addition & 1 deletion .github/workflows/example-builds-defaultarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ jobs:
- run: julia --version
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'
- name: "Check that the correct julia is used and that archive mtimes are maintained"
run: julia --startup-file=no --color=yes ./.github/workflows/common-tests.jl
run: julia --startup-file=no --color=yes ./.github/scripts/common-tests.jl
2 changes: 1 addition & 1 deletion .github/workflows/example-builds-nightly-defaultarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
- run: julia --version
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'
- name: "Check that the correct julia is used and that archive mtimes are maintained"
run: julia --startup-file=no --color=yes ./.github/workflows/common-tests.jl
run: julia --startup-file=no --color=yes ./.github/scripts/common-tests.jl
2 changes: 1 addition & 1 deletion .github/workflows/example-builds-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
- run: julia --version
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'
- name: "Check that the correct julia is used and that archive mtimes are maintained"
run: julia --startup-file=no --color=yes ./.github/workflows/common-tests.jl
run: julia --startup-file=no --color=yes ./.github/scripts/common-tests.jl
2 changes: 1 addition & 1 deletion .github/workflows/example-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
- run: julia --version
- run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()'
- name: "Check that the correct julia is used and that archive mtimes are maintained"
run: julia --startup-file=no --color=yes ./.github/workflows/common-tests.jl
run: julia --startup-file=no --color=yes ./.github/scripts/common-tests.jl
12 changes: 6 additions & 6 deletions lib/setup-julia.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/setup-julia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ async function run() {

// https://github.com/julia-actions/setup-julia/pull/196
// we want julia to be installed with unmodified file mtimes
IanButterworth marked this conversation as resolved.
Show resolved Hide resolved
// but tc.cacheDir uses `cp` which destroys mtime
// but `tc.cacheDir` uses `cp` internally which destroys mtime
// and `tc` provides no API to get the tool directory alone
// so hack it by installing a dummy julia file then use the path it returns
// so hack it by installing a empty directory then use the path it returns
// and extract the archives directly to that location
const tempDummyDir = fs.mkdtempSync('julia-dummy-')
juliaPath = await tc.cacheDir(tempDummyDir, 'julia', version, arch)
const emptyDir = fs.mkdtempSync('empty')
juliaPath = await tc.cacheDir(emptyDir, 'julia', version, arch)
await installer.installJulia(juliaPath, versionInfo, version, arch)

core.debug(`added Julia to cache: ${juliaPath}`)

// Remove temporary dummy dir
fs.rmSync(tempDummyDir, {recursive: true})
// Remove empty dir. Has to be recursive as it's a dir, even though it's empty
fs.rmSync(emptyDir, { recursive: true })
} else {
core.debug(`using cached version of Julia: ${juliaPath}`)
}
Expand Down
Loading