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

More windows CI debugging #2374

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
c042348
temporarily allow ssh to runner
IanButterworth Jan 30, 2021
a3b9468
do ssh after setup
IanButterworth Jan 30, 2021
fd65491
use shell: bash
IanButterworth Jan 30, 2021
bbd291f
damn macbook keyboard
IanButterworth Jan 30, 2021
aee8ed9
disable ssh
IanButterworth Jan 30, 2021
a1c8250
revert tmp env var set method
IanButterworth Jan 30, 2021
65f04ae
use bash to set up TEMP
IanButterworth Jan 30, 2021
c536526
add isdir check
IanButterworth Jan 30, 2021
56dcc0b
just test windows for now
IanButterworth Jan 30, 2021
b50634f
see if it's temporally stable
IanButterworth Jan 30, 2021
af1cde2
Update new.jl
IanButterworth Jan 30, 2021
3d311a3
more debug
IanButterworth Jan 30, 2021
6139b18
more debug
IanButterworth Jan 30, 2021
e205ba2
check file stats
IanButterworth Jan 30, 2021
abb52d7
re-enable other CI
IanButterworth Jan 30, 2021
d33d30b
revert tests
IanButterworth Jan 30, 2021
6387468
assert tree hashes are equal during git_init_package
IanButterworth Jan 30, 2021
fb3bb69
Update utils.jl
IanButterworth Jan 30, 2021
233a5d7
move tree_hash to utils
IanButterworth Jan 30, 2021
59059a3
fix
IanButterworth Jan 30, 2021
72f69b2
show source tree_hash
IanButterworth Jan 30, 2021
5cc1137
do less CI
IanButterworth Jan 30, 2021
5372ece
add sanity checks
IanButterworth Jan 30, 2021
12338bb
use a fixed alternative uuid to keep tree_hash causal
IanButterworth Jan 30, 2021
1ddc512
update checkout action
IanButterworth Jan 30, 2021
7de3bd3
try forcing symlink support on windows
IanButterworth Jan 31, 2021
09bdca2
don't use fixed hash to find scratch space
IanButterworth Jan 31, 2021
807fc57
Update test.yml
IanButterworth Jan 31, 2021
022c48b
path fix
IanButterworth Jan 31, 2021
16a3143
tidy up
IanButterworth Jan 31, 2021
62f2b98
disable artifact symlink perm test on windows CI
IanButterworth Jan 31, 2021
c8dd7a5
enable all CI
IanButterworth Jan 31, 2021
92fba24
typo
IanButterworth Jan 31, 2021
db6b63f
check filesystem type on windows
IanButterworth Feb 1, 2021
7661d2e
get-volume on appveyor too
IanButterworth Feb 1, 2021
b64f866
re-enable test
IanButterworth Feb 2, 2021
6ae2645
debug: check win64 binary from symlink PR
IanButterworth Feb 2, 2021
85ee07c
run symlink fix PR on other gha CI os's
IanButterworth Feb 7, 2021
b0143a9
typo
IanButterworth Feb 7, 2021
7bb227f
use same mock uuid on appveyor
IanButterworth Feb 7, 2021
b7a7e95
try nightly
IanButterworth Feb 7, 2021
7ec10ae
debug FailBuild dir perms
IanButterworth Feb 7, 2021
604a26b
fix debug path
IanButterworth Feb 7, 2021
0f66cb4
Merge branch 'master' into ib/windows_debug
IanButterworth Feb 7, 2021
79d3116
more debug
IanButterworth Feb 7, 2021
57a3a35
show file tree before copy
IanButterworth Feb 7, 2021
aaedd78
show root perms
IanButterworth Feb 7, 2021
391151c
add file size to debug
IanButterworth Feb 7, 2021
f490ef4
show full stat object (experimental base PR)
IanButterworth Feb 7, 2021
2e819e6
print file contents
IanButterworth Feb 7, 2021
fa0aaa0
update julia commit
IanButterworth Feb 8, 2021
d047b07
fix filesize calc
IanButterworth Feb 8, 2021
3884d29
Add `tree_hash()` debugging output
staticfloat Feb 8, 2021
d1d7834
check tree_hash of root with debug
IanButterworth Feb 8, 2021
9415372
fix tree_hash wrapper
staticfloat Feb 8, 2021
d769e31
Fix hashing bug introduced by debugging
staticfloat Feb 8, 2021
ba7dd43
Add `icacls` and `Sys.isexecutable()` to the panoply of debugging output
staticfloat Feb 8, 2021
2fa2f4e
Dump permission inheritance chain
staticfloat Feb 8, 2021
9b78abb
hash file contents
staticfloat Feb 8, 2021
bf1a404
set git to use LF on windows
IanButterworth Feb 8, 2021
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
57 changes: 46 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
branches:
- master
tags: '*'
defaults:
run:
shell: bash
jobs:
test:
runs-on: ${{ matrix.os }}
Expand All @@ -15,32 +18,64 @@ jobs:
matrix:
os:
- ubuntu-latest
- macOS-latest
# - macOS-latest
- windows-latest
julia-arch:
- 'x64'
- 'x86'
# - 'x86'
pkg-server:
- ""
- "pkg.julialang.org"
julia-version:
# - '1.6'
- 'nightly'
exclude:
- os: macOS-latest
julia-arch: x86
# exclude:
# - os: macOS-latest
# julia-arch: x86
steps:
- uses: actions/checkout@v1.0.0
- uses: julia-actions/setup-julia@latest
- name: Set git to use LF
if: matrix.os == 'windows-latest'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Determine filesystem of drives on windows
if: matrix.os == 'windows-latest'
run: get-volume
shell: powershell
- uses: actions/checkout@v2

# - uses: julia-actions/setup-julia@latest
# with:
# version: ${{ matrix.julia-version }}

- name: Install Julia from URL (windows)
if: matrix.os == 'windows-latest'
uses: julia-actions/install-julia-from-url@main
with:
# url: https://s3.amazonaws.com/julialangnightlies/assert_pretesting/winnt/x64/1.7/julia-a6df655fea-win64.tar.gz
url: https://s3.amazonaws.com/julialangnightlies/assert_pretesting/winnt/x64/1.7/julia-850d42a7ec-win64.tar.gz #statstruct
- name: Install Julia from URL (ubuntu)
if: matrix.os == 'ubuntu-latest'
uses: julia-actions/install-julia-from-url@main
with:
version: ${{ matrix.julia-version }}
# url: https://s3.amazonaws.com/julialangnightlies/assert_pretesting/linux/x64/1.7/julia-a6df655fea-linux64.tar.gz
url: https://s3.amazonaws.com/julialangnightlies/assert_pretesting/linux/x64/1.7/julia-850d42a7ec-linux64.tar.gz #statstruct
# - name: Install Julia from URL (macos)
# if: matrix.os == 'macOS-latest'
# uses: julia-actions/install-julia-from-url@main
# with:
# url: https://s3.amazonaws.com/julialangnightlies/assert_pretesting/mac/x64/1.7/julia-a6df655fea-mac64.tar.gz
# url: https://s3.amazonaws.com/julialangnightlies/assert_pretesting/linux/x64/1.7/julia-850d42a7ec-linux64.tar.gz #statstruct
- name: Show versioninfo()
run: julia -e "using InteractiveUtils; versioninfo()"

- name: Fix TEMP on windows
if: matrix.os == 'windows-latest'
run: |
# See https://github.com/actions/virtual-environments/issues/712
echo "TMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
- name: Run tests
echo "TMP=${USERPROFILE}\AppData\Local\Temp" >> ${GITHUB_ENV}
echo "TEMP=${USERPROFILE}\AppData\Local\Temp" >> ${GITHUB_ENV}
- name: Prepare local Pkg for tests
run: |
julia test/pkg-uuid.jl
julia --project --color=yes -e 'write("Project.toml", replace(read("Project.toml", String), r"uuid = .*?\n" =>"uuid = \"54cfe95a-1eb2-52ea-b672-e2afdf69b78f\"\n"));'
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ notifications:
on_build_status_changed: false

install:
- ps: get-volume
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
Expand Down
30 changes: 21 additions & 9 deletions src/GitTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -257,31 +257,43 @@ end

Calculate the git tree hash of a given path.
"""
function tree_hash(::Type{HashType}, root::AbstractString) where HashType
function tree_hash(::Type{HashType}, root::AbstractString; debug_out::Union{IO,Nothing} = nothing, indent::Int=0) where HashType
entries = Tuple{String, Vector{UInt8}, GitMode}[]
for f in readdir(root)
for f in sort(readdir(root; join=true); by = f -> isdir(f) ? f*"/" : f)
# Skip `.git` directories
if f == ".git"
continue
end

filepath = abspath(root, f)
filepath = abspath(f)
mode = gitmode(filepath)
if mode == mode_dir
# If this directory contains no files, then skip it
contains_files(filepath) || continue

# Otherwise, hash it up!
hash = tree_hash(HashType, filepath)
child_stream = nothing
if debug_out !== nothing
child_stream = IOBuffer()
end
hash = tree_hash(HashType, filepath; debug_out=child_stream, indent=indent+1)
if debug_out !== nothing
indent_str = "| "^indent
println(debug_out, "$(indent_str)+ [D] $(basename(filepath)) - $(bytes2hex(hash))")
print(debug_out, String(take!(child_stream)))
println(debug_out, indent_str)
end
else
hash = blob_hash(HashType, filepath)
if debug_out !== nothing
indent_str = "| "^indent
mode_str = mode == mode_normal ? "F" : "X"
println(debug_out, "$(indent_str)[$(mode_str)] $(basename(filepath)) - $(bytes2hex(hash))")
end
end
push!(entries, (f, hash, mode))
push!(entries, (basename(filepath), hash, mode))
end

# Sort entries by name (with trailing slashes for directories)
sort!(entries, by = ((name, hash, mode),) -> mode == mode_dir ? name*"/" : name)

content_size = 0
for (n, h, m) in entries
content_size += ndigits(UInt32(m); base=8) + 1 + sizeof(n) + 1 + sizeof(h)
Expand All @@ -296,7 +308,7 @@ function tree_hash(::Type{HashType}, root::AbstractString) where HashType
end
return SHA.digest!(ctx)
end
tree_hash(root::AbstractString) = tree_hash(SHA.SHA1_CTX, root)
tree_hash(root::AbstractString; debug_out::Union{IO,Nothing} = nothing) = tree_hash(SHA.SHA1_CTX, root; debug_out)

function check_valid_HEAD(repo)
try LibGit2.head(repo)
Expand Down
1 change: 1 addition & 0 deletions test/artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ end
@test iszero(filemode(joinpath(artifact_dir, file_link)) & 0o222)
@test !iszero(filemode(joinpath(artifact_dir, subdir)) & 0o222)
@test !iszero(filemode(joinpath(artifact_dir, dir_link)) & 0o222)

# Make sure we can delete the artifact directory without having
# to manually change permissions
rm(artifact_dir; recursive=true)
Expand Down
70 changes: 68 additions & 2 deletions test/new.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ unicode_uuid = UUID("4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5")
unregistered_uuid = UUID("dcb67f36-efa0-11e8-0cef-2fc465ed98ae")
simple_package_uuid = UUID("fc6b7c0f-8a2f-4256-bbf4-8c72c30df5be")


tree_hash(root::AbstractString; kwargs...) = bytes2hex(@inferred Pkg.GitTools.tree_hash(root; kwargs...))

#
# # Sanity checks
#
pkg_path = joinpath(dirname(@__DIR__))
@info "Pkg.jl path: $pkg_path"
@info "Tree hash of Pkg.jl repo: $(tree_hash(pkg_path))"

#
# # Depot Changes
#
Expand Down Expand Up @@ -1781,7 +1791,40 @@ end

# Build log location
isolate(loaded_depot=true) do; mktempdir() do tmp
@info("Dumping permission inheritance chain for test_packages")
r = joinpath(@__DIR__, "test_packages")
while dirname(r) != r
run(`icacls $r`)
r = dirname(r)
end

# debugging
r = joinpath(@__DIR__, "test_packages", "FailBuild")
@info "File tree for source package $r"
println(r, " ", "0o$(string(filemode(stat(r)), base = 8, pad = 6))")
@info "Checking tree hash of $r"
@show tree_hash(r; debug_out=stdout)

for (root, dirs, files) in walkdir(r)
for dir in dirs
println(joinpath(root, dir), " ", "0o$(string(filemode(stat(joinpath(root, dir))), base = 8, pad = 6))")
@show stat(joinpath(root, dir))
end
for file in files
fp = joinpath(root, file)
println(fp, " ", filesize(fp), " 0o$(string(filemode(stat(fp)), base = 8, pad = 6))")
@show stat(fp)
@show Sys.isexecutable(fp)
@show run(`icacls $fp`)
@show read(fp, String)
@show sha256(read(fp, String))
end
end

path = git_init_package(tmp, joinpath(@__DIR__, "test_packages", "FailBuild"))
@show tmp, joinpath(@__DIR__, "test_packages", "FailBuild"), path
@show filemode(joinpath(path, "src", "FailBuild.jl")), filesize(joinpath(path, "src", "FailBuild.jl"))
@show stat(joinpath(path, "deps", "build.jl")), filesize(joinpath(path, "deps", "build.jl"))
# Log file in the directory when it is deved
Pkg.develop(path=path; io=devnull)
log_file_dev = joinpath(path, "deps", "build.log")
Expand All @@ -1794,8 +1837,33 @@ end
log_file_add = joinpath(path, "deps", "build.log")
@test_throws PkgError Pkg.add(path=path; io=devnull)
@test !isfile(joinpath(Base.find_package("FailBuild"), "..", "..", "deps", "build.log"))

# Should be "f99d57aad0e5eb2434491b47bac92bb88d463001", but differs on windows
treehash = tree_hash(dirname(dirname(Base.find_package("FailBuild"))))
Comment on lines +1841 to +1842
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was failing on the github actions windows CI, but not on appveyor or other CI

@info "Tree hash for $(dirname(dirname(Base.find_package("FailBuild")))) should be f99d57aad0e5eb2434491b47bac92bb88d463001. Calculated: $treehash"

log_file_add = joinpath(DEPOT_PATH[1], "scratchspaces",
"44cfe95a-1eb2-52ea-b672-e2afdf69b78f", "f99d57aad0e5eb2434491b47bac92bb88d463001", "build.log")

# debugging
r = dirname(dirname(Base.find_package("FailBuild")))
@info "File tree for package add-ed into depot $r"
println(r, " ", "0o$(string(filemode(stat(r)), base = 8, pad = 6))")
@info "Checking tree hash of $r"
@show tree_hash(r; debug_out=stdout)
for (root, dirs, files) in walkdir(r)
for dir in dirs
println(joinpath(root, dir), " ", "0o$(string(filemode(stat(joinpath(root, dir))), base = 8, pad = 6))")
@show stat(joinpath(root, dir))
end
for file in files
fp = joinpath(root, file)
println(fp, " ", filesize(fp), " 0o$(string(filemode(stat(fp)), base = 8, pad = 6))")
@show stat(fp)
@show read(fp, String)
end
end

@test isfile(log_file_add)
@test occursin("oops", read(log_file_add, String))
end end
Expand Down Expand Up @@ -2306,8 +2374,6 @@ end
end
end

tree_hash(root::AbstractString) = bytes2hex(@inferred Pkg.GitTools.tree_hash(root))

@testset "git tree hash computation" begin
mktempdir() do dir
# test "well known" empty tree hash
Expand Down
6 changes: 3 additions & 3 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function write_build(path, content)
end

function with_current_env(f)
prev_active = Base.ACTIVE_PROJECT[]
prev_active = Base.ACTIVE_PROJECT[]
Pkg.activate(".")
try
f()
Expand All @@ -160,7 +160,7 @@ function with_current_env(f)
end

function with_temp_env(f, env_name::AbstractString="Dummy"; rm=true)
prev_active = Base.ACTIVE_PROJECT[]
prev_active = Base.ACTIVE_PROJECT[]
env_path = joinpath(mktempdir(), env_name)
Pkg.generate(env_path)
Pkg.activate(env_path)
Expand All @@ -178,7 +178,7 @@ function with_temp_env(f, env_name::AbstractString="Dummy"; rm=true)
end

function with_pkg_env(fn::Function, path::AbstractString="."; change_dir=false)
prev_active = Base.ACTIVE_PROJECT[]
prev_active = Base.ACTIVE_PROJECT[]
Pkg.activate(path)
try
if change_dir
Expand Down