From f5348aac68785ca76019f3730626379634c4f5be Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Tue, 13 Aug 2024 21:07:41 +0100 Subject: [PATCH] Add more useful error messages if versions are inconsistent --- .github/workflows/version_check.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/version_check.yml b/.github/workflows/version_check.yml index caebdffd6..b7877e4bd 100644 --- a/.github/workflows/version_check.yml +++ b/.github/workflows/version_check.yml @@ -41,6 +41,7 @@ jobs: - name: Check version consistency shell: julia --color=yes --project=. {0} + continue-on-error: true run: | using Pkg Pkg.activate(temp=true) @@ -117,6 +118,8 @@ jobs: manifest_version = VersionNumber(manifest_toml["deps"]["Turing"][1]["version"]) println("Manifest.toml version: ", manifest_version) + errors = [] + if ENV["TARGET_IS_MASTER"] == "true" # Fetch the latest version from GitHub and update files to match this version # if necessary. @@ -126,16 +129,20 @@ jobs: println("Latest Turing.jl version: ", latest_version) if !major_minor_match(latest_version, project_version) + push!(errors, "$(PROJECT_TOML_PATH) out of date") println("$(PROJECT_TOML_PATH) is out of date; updating") update_project_toml(PROJECT_TOML_PATH, latest_version) end if !major_minor_match(latest_version, quarto_version) + push!(errors, "$(QUARTO_YML_PATH) out of date") + n_errors += 1 println("$(QUARTO_YML_PATH) is out of date; updating") update_quarto_yml(QUARTO_YML_PATH, latest_version) end if !major_minor_patch_match(latest_version, manifest_version) + push!(errors, "$(MANIFEST_TOML_PATH) out of date") # Attempt to automatically update Manifest println("$(MANIFEST_TOML_PATH) is out of date; updating") old_env = Pkg.project().path @@ -146,10 +153,14 @@ jobs: manifest_toml = TOML.parsefile(MANIFEST_TOML_PATH) manifest_version = VersionNumber(manifest_toml["deps"]["Turing"][1]["version"]) if !major_minor_patch_match(latest_version, manifest_version) - error("Failed to update Manifest.toml to match latest Turing.jl version") + push!(errors, "Failed to update $(MANIFEST_TOML_PATH) to match latest Turing.jl version") end end + if !isempty(errors) + error("The following errors occurred during version checking: \n", join(errors, "\n")) + end + else # Don't attempt to fetch the latest version; just check for consistency # and error if versions don't match.