| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| using Tar, Inflate, SHA, TOML |
|
|
| |
| LOCAL = false |
| |
| DECOMPRESS_7Z = true |
|
|
| |
| if isnothing(get(ENV, "GITHUB_ACTIONS", nothing)) |
| LOCAL = true |
| DECOMPRESS_7Z = false |
| else |
| LOCAL = false |
| DECOMPRESS_7Z = true |
| end |
|
|
| if DECOMPRESS_7Z |
| PY_SCRIPT = joinpath(@__DIR__, "util/GitHub-ForceLargeFiles/src/reverse.py") |
| run( |
| Cmd([ |
| "python", |
| PY_SCRIPT, |
| # reverse.py will delete the 7z files by default |
| "--delete_partitions", |
| # workaround for python argparse: only empty string "" -> false |
| "", |
| "--root_dir", |
| joinpath(@__DIR__, "datasets"), |
| ]), |
| ) |
| end |
|
|
| artifacts = Dict() |
|
|
| const datasets_dir = joinpath(@__DIR__, "datasets") |
| const artifacts_dir = joinpath(@__DIR__, "artifacts") |
| |
| const tar_excludes = ["generator", ".gitignore", "README.md", "*.7z.*"] |
|
|
| |
| const GZIP = "-9" |
| |
| compress_prog = "gzip $GZIP" |
| |
| |
| try |
| run(`which pigz`) |
| |
| global compress_prog = "pigz $GZIP -k" |
| catch |
| |
| end |
|
|
| TAR_CMD = [ |
| "tar", |
| "--exclude-vcs", |
| "--exclude-vcs-ignores", |
| "--use-compress-program=$compress_prog", |
| ] |
| append!(TAR_CMD, ["--exclude=" * f for f in tar_excludes]) |
|
|
| mkpath(artifacts_dir) |
|
|
| for data in readdir(datasets_dir) |
| startswith(data, "_") && continue |
| fullpath = joinpath(datasets_dir, data) |
| isdir(fullpath) || continue |
|
|
| tar_name = "$(data).tar.gz" |
| outpath = joinpath(artifacts_dir, tar_name) |
| cd(fullpath) do |
| files = readdir() |
| run(Cmd(vcat(TAR_CMD, ["-cvf", outpath], files))) |
| end |
|
|
| if LOCAL |
| |
| url = "file://$(outpath)" |
| else |
| |
| |
| |
| |
| url = "https://github.com/qiaojunfeng/WannierDatasets/releases/latest/download/$(tar_name)" |
| end |
|
|
| artifact_name = data |
| artifacts[artifact_name] = Dict( |
| "git-tree-sha1" => Tar.tree_hash(IOBuffer(inflate_gzip(outpath))), |
| "lazy" => true, |
| "download" => |
| [Dict("url" => url, "sha256" => bytes2hex(open(sha256, outpath)))], |
| ) |
| end |
|
|
| open("Artifacts.toml", "w") do io |
| TOML.print(io, artifacts) |
| end |
|
|