From 56865ff1cd11d92d019e54f0ede1a0eeaee829b3 Mon Sep 17 00:00:00 2001 From: Lorenzo Contento <16554887+lcontento@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:00:16 +0100 Subject: [PATCH 01/19] Set _COMPILED_DIR during __init__ to ensure relocatability --- src/TimeZones.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/TimeZones.jl b/src/TimeZones.jl index b8eb6c51..4aba2cfb 100644 --- a/src/TimeZones.jl +++ b/src/TimeZones.jl @@ -33,13 +33,16 @@ export TimeZone, @tz_str, istimezone, FixedTimeZone, VariableTimeZone, ZonedDate _scratch_dir() = @get_scratch!("build") -const _COMPILED_DIR = Ref{String}(TZJData.ARTIFACT_DIR) +const _COMPILED_DIR = Ref{String}() # TimeZone types used to disambiguate the context of a DateTime # abstract type UTC <: TimeZone end # Already defined in the Dates stdlib abstract type Local <: TimeZone end function __init__() + # Must be set at runtime to ensure relocatability + _COMPILED_DIR[] = TZJData.artifact_dir() + # Dates extension needs to happen everytime the module is loaded (issue #24) init_dates_extension() From 05d4c9eb31de3252eba9200fbe69189351962dea Mon Sep 17 00:00:00 2001 From: Lorenzo Contento <16554887+lcontento@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:10:01 +0100 Subject: [PATCH 02/19] Add fallback for older versions of TZJData --- Project.toml | 2 ++ src/TimeZones.jl | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index c74d2fcf..f3bf7ed7 100644 --- a/Project.toml +++ b/Project.toml @@ -4,6 +4,7 @@ authors = ["Curtis Vogt "] version = "1.18.1" [deps] +Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" InlineStrings = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" @@ -22,6 +23,7 @@ RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" TimeZonesRecipesBaseExt = "RecipesBase" [compat] +Artifacts = "1" Aqua = "0.8" Dates = "1" Downloads = "1" diff --git a/src/TimeZones.jl b/src/TimeZones.jl index 4aba2cfb..60e260d4 100644 --- a/src/TimeZones.jl +++ b/src/TimeZones.jl @@ -1,5 +1,6 @@ module TimeZones +using Artifacts using Dates using Printf using Scratch: @get_scratch! @@ -41,7 +42,12 @@ abstract type Local <: TimeZone end function __init__() # Must be set at runtime to ensure relocatability - _COMPILED_DIR[] = TZJData.artifact_dir() + _COMPILED_DIR[] = if isdefined(TZJData, :artifact_dir) + TZJData.artifact_dir() + else + # Backwards compatibility with TZJData v1.3.0 and below. + Artifacts.artifact_path(Base.SHA1(basename(TZJData.ARTIFACT_DIR))) + end # Dates extension needs to happen everytime the module is loaded (issue #24) init_dates_extension() From ca1ba7bd3c6dbb94d83897bd30c3617806d812cb Mon Sep 17 00:00:00 2001 From: Lorenzo Contento <16554887+lcontento@users.noreply.github.com> Date: Mon, 4 Nov 2024 17:57:45 +0100 Subject: [PATCH 03/19] Backwards compatibility with hardcoded artifact hashes --- src/TimeZones.jl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/TimeZones.jl b/src/TimeZones.jl index 60e260d4..171d61ae 100644 --- a/src/TimeZones.jl +++ b/src/TimeZones.jl @@ -43,10 +43,22 @@ abstract type Local <: TimeZone end function __init__() # Must be set at runtime to ensure relocatability _COMPILED_DIR[] = if isdefined(TZJData, :artifact_dir) + # Recent versions of TZJData are relocatable TZJData.artifact_dir() else - # Backwards compatibility with TZJData v1.3.0 and below. - Artifacts.artifact_path(Base.SHA1(basename(TZJData.ARTIFACT_DIR))) + # Backwards compatibility with TZJData v1.3.0 and below + hash = if TZJData.TZDATA_VERSION == "2024b" + Base.SHA1("7fdea2a12522469ca39925546d1fd93c10748180") + elseif TZJData.TZDATA_VERSION == "2024a" + Base.SHA1("520ce3f83be7fbb002cca87993a1b1f71fe10912") + elseif TZJData.TZDATA_VERSION == "2023d" + Base.SHA1("b071cffdb310f5d3ca640c09cfa3dc3f23d450ad") + elseif TZJData.TZDATA_VERSION == "2023c" + Base.SHA1("52e48e96c4df04eeebc6ece0d9f1c3b545f0544c") + else + error("TZJData.jl with TZDATA_VERSION = $(TZJData.TZDATA_VERSION) is supposed to be relocatable!") + end + Artifacts.artifact_path(hash) end # Dates extension needs to happen everytime the module is loaded (issue #24) From 0402582b3eab807251f42d2d2ef11fe37e1487fd Mon Sep 17 00:00:00 2001 From: Lorenzo Contento <16554887+lcontento@users.noreply.github.com> Date: Mon, 4 Nov 2024 18:40:44 +0100 Subject: [PATCH 04/19] remove the docs manifest --- docs/Manifest.toml | 230 --------------------------------------------- 1 file changed, 230 deletions(-) delete mode 100644 docs/Manifest.toml diff --git a/docs/Manifest.toml b/docs/Manifest.toml deleted file mode 100644 index 4be30318..00000000 --- a/docs/Manifest.toml +++ /dev/null @@ -1,230 +0,0 @@ -# This file is machine-generated - editing it directly is not advised - -julia_version = "1.9.4" -manifest_format = "2.0" -project_hash = "b0e0fdd6d2084cf873bc7d6040a84520736d76d6" - -[[deps.ANSIColoredPrinters]] -git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c" -uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9" -version = "0.0.1" - -[[deps.ArgTools]] -uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" -version = "1.1.1" - -[[deps.Artifacts]] -uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" - -[[deps.Base64]] -uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" - -[[deps.Compat]] -deps = ["TOML", "UUIDs"] -git-tree-sha1 = "c955881e3c981181362ae4088b35995446298b80" -uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.14.0" - - [deps.Compat.extensions] - CompatLinearAlgebraExt = "LinearAlgebra" - - [deps.Compat.weakdeps] - Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" - LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" - -[[deps.Dates]] -deps = ["Printf"] -uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" - -[[deps.DocStringExtensions]] -deps = ["LibGit2"] -git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" -uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" -version = "0.9.3" - -[[deps.Documenter]] -deps = ["ANSIColoredPrinters", "Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"] -git-tree-sha1 = "39fd748a73dce4c05a9655475e437170d8fb1b67" -uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -version = "0.27.25" - -[[deps.Downloads]] -deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] -uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" -version = "1.6.0" - -[[deps.ExprTools]] -git-tree-sha1 = "27415f162e6028e81c72b82ef756bf321213b6ec" -uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" -version = "0.1.10" - -[[deps.FileWatching]] -uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" - -[[deps.IOCapture]] -deps = ["Logging", "Random"] -git-tree-sha1 = "8b72179abc660bfab5e28472e019392b97d0985c" -uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89" -version = "0.2.4" - -[[deps.InlineStrings]] -deps = ["Parsers"] -git-tree-sha1 = "9cc2baf75c6d09f9da536ddf58eb2f29dedaf461" -uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" -version = "1.4.0" - -[[deps.InteractiveUtils]] -deps = ["Markdown"] -uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" - -[[deps.JSON]] -deps = ["Dates", "Mmap", "Parsers", "Unicode"] -git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a" -uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -version = "0.21.4" - -[[deps.LibCURL]] -deps = ["LibCURL_jll", "MozillaCACerts_jll"] -uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" -version = "0.6.4" - -[[deps.LibCURL_jll]] -deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] -uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "8.4.0+0" - -[[deps.LibGit2]] -deps = ["Base64", "NetworkOptions", "Printf", "SHA"] -uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" - -[[deps.LibSSH2_jll]] -deps = ["Artifacts", "Libdl", "MbedTLS_jll"] -uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" -version = "1.11.0+1" - -[[deps.Libdl]] -uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" - -[[deps.Logging]] -uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" - -[[deps.Markdown]] -deps = ["Base64"] -uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" - -[[deps.MbedTLS_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.2+0" - -[[deps.Mmap]] -uuid = "a63ad114-7e13-5084-954f-fe012c677804" - -[[deps.Mocking]] -deps = ["Compat", "ExprTools"] -git-tree-sha1 = "4cc0c5a83933648b615c36c2b956d94fda70641e" -uuid = "78c3b35d-d492-501b-9361-3d52fe80e533" -version = "0.7.7" - -[[deps.MozillaCACerts_jll]] -uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2022.10.11" - -[[deps.NetworkOptions]] -uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" -version = "1.2.0" - -[[deps.Parsers]] -deps = ["Dates", "PrecompileTools", "UUIDs"] -git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" -uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "2.8.1" - -[[deps.PrecompileTools]] -deps = ["Preferences"] -git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f" -uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" -version = "1.2.1" - -[[deps.Preferences]] -deps = ["TOML"] -git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6" -uuid = "21216c6a-2e73-6563-6e65-726566657250" -version = "1.4.3" - -[[deps.Printf]] -deps = ["Unicode"] -uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" - -[[deps.REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] -uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" - -[[deps.Random]] -deps = ["SHA", "Serialization"] -uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" - -[[deps.SHA]] -uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" -version = "0.7.0" - -[[deps.Scratch]] -deps = ["Dates"] -git-tree-sha1 = "3bac05bc7e74a75fd9cba4295cde4045d9fe2386" -uuid = "6c6a2e73-6563-6170-7368-637461726353" -version = "1.2.1" - -[[deps.Serialization]] -uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" - -[[deps.Sockets]] -uuid = "6462fe0b-24de-5631-8697-dd941f90decc" - -[[deps.TOML]] -deps = ["Dates"] -uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" -version = "1.0.3" - -[[deps.TZJData]] -deps = ["Artifacts"] -git-tree-sha1 = "1607ad46cf8d642aa779a1d45af1c8620dbf6915" -uuid = "dc5dba14-91b3-4cab-a142-028a31da12f7" -version = "1.2.0+2024a" - -[[deps.Test]] -deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] -uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" - -[[deps.TimeZones]] -deps = ["Dates", "Downloads", "InlineStrings", "Mocking", "Printf", "Scratch", "TZJData", "Unicode", "p7zip_jll"] -path = ".." -uuid = "f269a46b-ccf7-5d73-abea-4c690281aa53" -version = "1.14.0" - - [deps.TimeZones.extensions] - TimeZonesRecipesBaseExt = "RecipesBase" - - [deps.TimeZones.weakdeps] - RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" - -[[deps.UUIDs]] -deps = ["Random", "SHA"] -uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" - -[[deps.Unicode]] -uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" - -[[deps.Zlib_jll]] -deps = ["Libdl"] -uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.13+0" - -[[deps.nghttp2_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.52.0+1" - -[[deps.p7zip_jll]] -deps = ["Artifacts", "Libdl"] -uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" -version = "17.4.0+0" From c7612a0b1dd1ad19a2f78148f06bf4fbd40e0971 Mon Sep 17 00:00:00 2001 From: Lorenzo Contento <16554887+lcontento@users.noreply.github.com> Date: Mon, 16 Dec 2024 17:29:31 +0100 Subject: [PATCH 05/19] Turn off coverage for the setting of _COMPILED_DIR --- src/TimeZones.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/TimeZones.jl b/src/TimeZones.jl index 171d61ae..f8e3090b 100644 --- a/src/TimeZones.jl +++ b/src/TimeZones.jl @@ -41,6 +41,7 @@ const _COMPILED_DIR = Ref{String}() abstract type Local <: TimeZone end function __init__() + # COV_EXCL_START # Must be set at runtime to ensure relocatability _COMPILED_DIR[] = if isdefined(TZJData, :artifact_dir) # Recent versions of TZJData are relocatable @@ -60,6 +61,7 @@ function __init__() end Artifacts.artifact_path(hash) end + # COV_EXCL_STOP # Dates extension needs to happen everytime the module is loaded (issue #24) init_dates_extension() From 9af280caf6f41ae6fd4a2705a15fe36d96bbd3dc Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Thu, 19 Dec 2024 15:13:21 -0600 Subject: [PATCH 06/19] Determine tree hash directly from Artifacts.toml --- src/TimeZones.jl | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/TimeZones.jl b/src/TimeZones.jl index f8e3090b..84c076e1 100644 --- a/src/TimeZones.jl +++ b/src/TimeZones.jl @@ -1,6 +1,6 @@ module TimeZones -using Artifacts +using Artifacts: Artifacts using Dates using Printf using Scratch: @get_scratch! @@ -42,23 +42,13 @@ abstract type Local <: TimeZone end function __init__() # COV_EXCL_START - # Must be set at runtime to ensure relocatability - _COMPILED_DIR[] = if isdefined(TZJData, :artifact_dir) - # Recent versions of TZJData are relocatable + # Set at runtime to ensure relocatability + _COMPILED_DIR[] = @static if isdefined(TZJData, :artifact_dir) TZJData.artifact_dir() else - # Backwards compatibility with TZJData v1.3.0 and below - hash = if TZJData.TZDATA_VERSION == "2024b" - Base.SHA1("7fdea2a12522469ca39925546d1fd93c10748180") - elseif TZJData.TZDATA_VERSION == "2024a" - Base.SHA1("520ce3f83be7fbb002cca87993a1b1f71fe10912") - elseif TZJData.TZDATA_VERSION == "2023d" - Base.SHA1("b071cffdb310f5d3ca640c09cfa3dc3f23d450ad") - elseif TZJData.TZDATA_VERSION == "2023c" - Base.SHA1("52e48e96c4df04eeebc6ece0d9f1c3b545f0544c") - else - error("TZJData.jl with TZDATA_VERSION = $(TZJData.TZDATA_VERSION) is supposed to be relocatable!") - end + # Backwards compatibility for TZJData versions below v1.3.1 + artifact_dict = Artifacts.parse_toml(joinpath(pkgdir(TZJData), "Artifacts.toml")) + hash = Base.SHA1(artifact_dict["tzjdata"]["git-tree-sha1"]) Artifacts.artifact_path(hash) end # COV_EXCL_STOP From 3fbda1d5e04f45507930be2ee1687e1c004270a9 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 08:52:34 -0600 Subject: [PATCH 07/19] Remove CodeCov exclusion comments --- src/TimeZones.jl | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/TimeZones.jl b/src/TimeZones.jl index 84c076e1..9b8e26f5 100644 --- a/src/TimeZones.jl +++ b/src/TimeZones.jl @@ -41,7 +41,6 @@ const _COMPILED_DIR = Ref{String}() abstract type Local <: TimeZone end function __init__() - # COV_EXCL_START # Set at runtime to ensure relocatability _COMPILED_DIR[] = @static if isdefined(TZJData, :artifact_dir) TZJData.artifact_dir() @@ -51,7 +50,6 @@ function __init__() hash = Base.SHA1(artifact_dict["tzjdata"]["git-tree-sha1"]) Artifacts.artifact_path(hash) end - # COV_EXCL_STOP # Dates extension needs to happen everytime the module is loaded (issue #24) init_dates_extension() From 5aa01e62b084efe7637b54715b791232c537c2da Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 13:43:31 -0600 Subject: [PATCH 08/19] Use `locate_package` --- src/TimeZones.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/TimeZones.jl b/src/TimeZones.jl index 9b8e26f5..ce7032b8 100644 --- a/src/TimeZones.jl +++ b/src/TimeZones.jl @@ -45,8 +45,12 @@ function __init__() _COMPILED_DIR[] = @static if isdefined(TZJData, :artifact_dir) TZJData.artifact_dir() else - # Backwards compatibility for TZJData versions below v1.3.1 - artifact_dict = Artifacts.parse_toml(joinpath(pkgdir(TZJData), "Artifacts.toml")) + # Backwards compatibility for TZJData versions below v1.3.1. The portion of the + # code which determines the `pkg_dir` could be replaced by `pkgdir(TZJData)` however + # the `pkgdir` function doesn't work well with relocated system images. + pkg = Base.identify_package(TZJData, "TZJData") + pkg_dir = dirname(dirname(Base.locate_package(pkg))) + artifact_dict = Artifacts.parse_toml(joinpath(pkg_dir, "Artifacts.toml")) hash = Base.SHA1(artifact_dict["tzjdata"]["git-tree-sha1"]) Artifacts.artifact_path(hash) end From 7e3a3cbf128f64627949624ae7c03f2ffa275dfa Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 14:46:46 -0600 Subject: [PATCH 09/19] Test for sysimage --- .github/workflows/CI.yml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f1eb7360..ffeafa0e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -99,6 +99,47 @@ jobs: Pkg.add(PackageSpec(name="TimeZones", rev=ENV["SHA"])) using TimeZones + sysimage: + name: System Image + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - "1.6" # LTS / Oldest supported version + - "1" # Latest release + os: + - ubuntu-latest + env: + JULIA_DEPOT_PATH: build-depot + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: julia-actions/cache@v2 + - shell: julia --color=yes --project=@sysimage {0} + run: | + using Pkg + Pkg.add(".") + - shell: julia --color=yes {0} + run: | + using Pkg + Pkg.add(PackageSpec(name="PackageCompiler", version="2")) + using PackageCompiler + create_sysimage(; project="@sysimage", sysimage_path="sysimage.so") + - shell: julia --color=yes --project=@sysimage -Jsysimage.so + run: | + using TimeZones + println(TimeZones._COMPILED_DIR[]) + - run: mv build-depot sysimage-depot + - shell: julia --color=yes --project=@sysimage -Jsysimage.so + run: | + using TimeZones + println(TimeZones._COMPILED_DIR[]) + env: + JULIA_DEPOT_PATH: sysimage-depot + benchmarks: name: Benchmarks runs-on: ubuntu-latest From 63cbb292afdeda6249f61a3f44fb6d84810a9a17 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 14:51:06 -0600 Subject: [PATCH 10/19] fixup! Test for sysimage --- .github/workflows/CI.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ffeafa0e..07db8fd7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -100,7 +100,7 @@ jobs: using TimeZones sysimage: - name: System Image + name: System Image - Julia ${{ matrix.version }} - ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -118,22 +118,27 @@ jobs: with: version: ${{ matrix.version }} - uses: julia-actions/cache@v2 - - shell: julia --color=yes --project=@sysimage {0} + - name: Add TimeZones + shell: julia --color=yes --project=@sysimage {0} run: | using Pkg - Pkg.add(".") - - shell: julia --color=yes {0} + Pkg.dev(".") + - name: Create sysimage + shell: julia --color=yes {0} run: | using Pkg Pkg.add(PackageSpec(name="PackageCompiler", version="2")) using PackageCompiler create_sysimage(; project="@sysimage", sysimage_path="sysimage.so") - - shell: julia --color=yes --project=@sysimage -Jsysimage.so + - name: Validate sysimage works + shell: julia --color=yes --project=@sysimage -Jsysimage.so run: | using TimeZones println(TimeZones._COMPILED_DIR[]) - - run: mv build-depot sysimage-depot - - shell: julia --color=yes --project=@sysimage -Jsysimage.so + - name: Relocate Julia depot + run: mv build-depot sysimage-depot + - name: Validate sysimage works with relocated depot + shell: julia --color=yes --project=@sysimage -Jsysimage.so run: | using TimeZones println(TimeZones._COMPILED_DIR[]) From c303339240c651cb4a516a7e3f4be24a953f19d8 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 14:53:31 -0600 Subject: [PATCH 11/19] fixup! Test for sysimage --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 07db8fd7..7bd09669 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -122,7 +122,7 @@ jobs: shell: julia --color=yes --project=@sysimage {0} run: | using Pkg - Pkg.dev(".") + Pkg.develop(path=".") - name: Create sysimage shell: julia --color=yes {0} run: | From 99f9e7ea74994e138bd1206a8c763c6611087b12 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 15:00:47 -0600 Subject: [PATCH 12/19] fixup! Test for sysimage --- .github/workflows/CI.yml | 12 ++++++------ Project.toml | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7bd09669..0266f5ca 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -93,7 +93,7 @@ jobs: with: version: "1.6" # LTS / Oldest support version - uses: julia-actions/cache@v2 - - shell: julia --color=yes --project=docs {0} + - shell: julia --color=yes --project=@weakdeps {0} run: | using Pkg Pkg.add(PackageSpec(name="TimeZones", rev=ENV["SHA"])) @@ -119,26 +119,26 @@ jobs: version: ${{ matrix.version }} - uses: julia-actions/cache@v2 - name: Add TimeZones - shell: julia --color=yes --project=@sysimage {0} + shell: julia --color=yes --project=sysimage {0} run: | using Pkg - Pkg.develop(path=".") + Pkg.add(PackageSpec(name="TimeZones", rev=ENV["SHA"])) - name: Create sysimage shell: julia --color=yes {0} run: | using Pkg Pkg.add(PackageSpec(name="PackageCompiler", version="2")) using PackageCompiler - create_sysimage(; project="@sysimage", sysimage_path="sysimage.so") + create_sysimage(; project="sysimage", sysimage_path="sysimage.so") - name: Validate sysimage works - shell: julia --color=yes --project=@sysimage -Jsysimage.so + shell: julia --color=yes --project=sysimage -Jsysimage.so run: | using TimeZones println(TimeZones._COMPILED_DIR[]) - name: Relocate Julia depot run: mv build-depot sysimage-depot - name: Validate sysimage works with relocated depot - shell: julia --color=yes --project=@sysimage -Jsysimage.so + shell: julia --color=yes --project=sysimage -Jsysimage.so run: | using TimeZones println(TimeZones._COMPILED_DIR[]) diff --git a/Project.toml b/Project.toml index 73d6c9eb..0955b8c9 100644 --- a/Project.toml +++ b/Project.toml @@ -10,7 +10,6 @@ Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" InlineStrings = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" Mocking = "78c3b35d-d492-501b-9361-3d52fe80e533" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" -RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" Scratch = "6c6a2e73-6563-6170-7368-637461726353" TZJData = "dc5dba14-91b3-4cab-a142-028a31da12f7" Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" From 451d241e75f006b54f96c287a1bb62391e1f18bf Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 15:07:28 -0600 Subject: [PATCH 13/19] fixup! Test for sysimage --- .github/workflows/CI.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0266f5ca..a364b415 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -119,7 +119,7 @@ jobs: version: ${{ matrix.version }} - uses: julia-actions/cache@v2 - name: Add TimeZones - shell: julia --color=yes --project=sysimage {0} + shell: julia --color=yes --project=@sysimage {0} run: | using Pkg Pkg.add(PackageSpec(name="TimeZones", rev=ENV["SHA"])) @@ -129,16 +129,16 @@ jobs: using Pkg Pkg.add(PackageSpec(name="PackageCompiler", version="2")) using PackageCompiler - create_sysimage(; project="sysimage", sysimage_path="sysimage.so") + create_sysimage(; project=joinpath(first(DEPOT_PATH), "environments", "sysimage"), sysimage_path="sysimage.so") - name: Validate sysimage works - shell: julia --color=yes --project=sysimage -Jsysimage.so + shell: julia --color=yes --project=@sysimage -Jsysimage.so {0} run: | using TimeZones println(TimeZones._COMPILED_DIR[]) - name: Relocate Julia depot run: mv build-depot sysimage-depot - name: Validate sysimage works with relocated depot - shell: julia --color=yes --project=sysimage -Jsysimage.so + shell: julia --color=yes --project=@sysimage -Jsysimage.so {0} run: | using TimeZones println(TimeZones._COMPILED_DIR[]) From 3aa1b390abba47bb88212387ccfc75ca4fe95e32 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 15:09:21 -0600 Subject: [PATCH 14/19] fixup! Test for sysimage --- Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Project.toml b/Project.toml index 0955b8c9..73d6c9eb 100644 --- a/Project.toml +++ b/Project.toml @@ -10,6 +10,7 @@ Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" InlineStrings = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" Mocking = "78c3b35d-d492-501b-9361-3d52fe80e533" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" +RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" Scratch = "6c6a2e73-6563-6170-7368-637461726353" TZJData = "dc5dba14-91b3-4cab-a142-028a31da12f7" Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" From c64babd6315e6bedb90cd09f5f5146a04a018f55 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 15:10:52 -0600 Subject: [PATCH 15/19] fixup! Test for sysimage --- .github/workflows/CI.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a364b415..205df36d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -93,7 +93,7 @@ jobs: with: version: "1.6" # LTS / Oldest support version - uses: julia-actions/cache@v2 - - shell: julia --color=yes --project=@weakdeps {0} + - shell: julia --color=yes --project=weakdeps {0} run: | using Pkg Pkg.add(PackageSpec(name="TimeZones", rev=ENV["SHA"])) @@ -119,7 +119,7 @@ jobs: version: ${{ matrix.version }} - uses: julia-actions/cache@v2 - name: Add TimeZones - shell: julia --color=yes --project=@sysimage {0} + shell: julia --color=yes --project=sysimage {0} run: | using Pkg Pkg.add(PackageSpec(name="TimeZones", rev=ENV["SHA"])) @@ -129,16 +129,16 @@ jobs: using Pkg Pkg.add(PackageSpec(name="PackageCompiler", version="2")) using PackageCompiler - create_sysimage(; project=joinpath(first(DEPOT_PATH), "environments", "sysimage"), sysimage_path="sysimage.so") + create_sysimage(; project="sysimage", sysimage_path="sysimage.so") - name: Validate sysimage works - shell: julia --color=yes --project=@sysimage -Jsysimage.so {0} + shell: julia --color=yes --project=sysimage -Jsysimage.so {0} run: | using TimeZones println(TimeZones._COMPILED_DIR[]) - name: Relocate Julia depot run: mv build-depot sysimage-depot - name: Validate sysimage works with relocated depot - shell: julia --color=yes --project=@sysimage -Jsysimage.so {0} + shell: julia --color=yes --project=sysimage -Jsysimage.so {0} run: | using TimeZones println(TimeZones._COMPILED_DIR[]) From b70192c95ee1269a37393deab76d1d544c4263ff Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 15:24:33 -0600 Subject: [PATCH 16/19] Validate test failure --- .github/workflows/CI.yml | 2 ++ src/TimeZones.jl | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 205df36d..682d314f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -99,6 +99,7 @@ jobs: Pkg.add(PackageSpec(name="TimeZones", rev=ENV["SHA"])) using TimeZones + # TODO: Use shared project environments when the minimum version of Julia is 1.8 (e.g. `@sysimage`) sysimage: name: System Image - Julia ${{ matrix.version }} - ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -130,6 +131,7 @@ jobs: Pkg.add(PackageSpec(name="PackageCompiler", version="2")) using PackageCompiler create_sysimage(; project="sysimage", sysimage_path="sysimage.so") + # create_sysimage(; project=joinpath(first(DEPOT_PATH), "environments", "sysimage"), sysimage_path="sysimage.so") - name: Validate sysimage works shell: julia --color=yes --project=sysimage -Jsysimage.so {0} run: | diff --git a/src/TimeZones.jl b/src/TimeZones.jl index ce7032b8..dbe34cc8 100644 --- a/src/TimeZones.jl +++ b/src/TimeZones.jl @@ -48,8 +48,9 @@ function __init__() # Backwards compatibility for TZJData versions below v1.3.1. The portion of the # code which determines the `pkg_dir` could be replaced by `pkgdir(TZJData)` however # the `pkgdir` function doesn't work well with relocated system images. - pkg = Base.identify_package(TZJData, "TZJData") - pkg_dir = dirname(dirname(Base.locate_package(pkg))) + # pkg = Base.identify_package(TZJData, "TZJData") + # pkg_dir = dirname(dirname(Base.locate_package(pkg))) + pkg_dir = pkgdir(TZJData) artifact_dict = Artifacts.parse_toml(joinpath(pkg_dir, "Artifacts.toml")) hash = Base.SHA1(artifact_dict["tzjdata"]["git-tree-sha1"]) Artifacts.artifact_path(hash) From 73da68afd6d40266b3d56a1df8f71c038a8ff9c5 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 15:35:01 -0600 Subject: [PATCH 17/19] fixup! Test for sysimage --- .github/workflows/CI.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 682d314f..d17438d8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -111,8 +111,12 @@ jobs: - "1" # Latest release os: - ubuntu-latest + tzjdata-version: + - "1.3.0" # Version which does not support `artifact_dir` + - "1" env: JULIA_DEPOT_PATH: build-depot + TZJDATA_VERSION: ${{ matrix.tzjdata-version }} steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 @@ -123,6 +127,7 @@ jobs: shell: julia --color=yes --project=sysimage {0} run: | using Pkg + Pkg.add(PackageSpec(name="TZJData", version=ENV["TZJDATA_VERSION"])) Pkg.add(PackageSpec(name="TimeZones", rev=ENV["SHA"])) - name: Create sysimage shell: julia --color=yes {0} From 549fdfd67eb771d116bf4e62e6feb68bc63f25d5 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 15:42:18 -0600 Subject: [PATCH 18/19] Back to working --- src/TimeZones.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/TimeZones.jl b/src/TimeZones.jl index dbe34cc8..ce7032b8 100644 --- a/src/TimeZones.jl +++ b/src/TimeZones.jl @@ -48,9 +48,8 @@ function __init__() # Backwards compatibility for TZJData versions below v1.3.1. The portion of the # code which determines the `pkg_dir` could be replaced by `pkgdir(TZJData)` however # the `pkgdir` function doesn't work well with relocated system images. - # pkg = Base.identify_package(TZJData, "TZJData") - # pkg_dir = dirname(dirname(Base.locate_package(pkg))) - pkg_dir = pkgdir(TZJData) + pkg = Base.identify_package(TZJData, "TZJData") + pkg_dir = dirname(dirname(Base.locate_package(pkg))) artifact_dict = Artifacts.parse_toml(joinpath(pkg_dir, "Artifacts.toml")) hash = Base.SHA1(artifact_dict["tzjdata"]["git-tree-sha1"]) Artifacts.artifact_path(hash) From 8d430e1292216f1f3b110c72df9a0ef43aa1bfd7 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Fri, 20 Dec 2024 15:48:37 -0600 Subject: [PATCH 19/19] Make job name unique --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d17438d8..759345e8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -101,7 +101,7 @@ jobs: # TODO: Use shared project environments when the minimum version of Julia is 1.8 (e.g. `@sysimage`) sysimage: - name: System Image - Julia ${{ matrix.version }} - ${{ matrix.os }} + name: System Image - Julia ${{ matrix.version }} - TZJData ${{ matrix.tzjdata-version }} - ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false