From 843394f0f548ca64eddbf3d8b1a362e29e7c5308 Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Thu, 29 Aug 2024 11:07:01 +0200 Subject: [PATCH] New question: JuliaMinCIVersion Creates a constant JULIA_LTS_VERSION for internal use. Changes the deafult of JuliaMinVersion to use the constant. Create JuliaMinCIVersion. It defaults to lts if JuliaMinVersion is equal to JULIA_LTS_VERSION. Otherwise, if defaults to JuliaMinVersion. Closes #400 --- CHANGELOG.md | 1 + copier.yml | 14 +++++++++++++- src/debug/Data.jl | 1 + template/.github/workflows/Test.yml.jinja | 2 +- test/test-bad-usage-and-errors.jl | 1 + test/utils.jl | 1 + 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b4d2e9b..b692de01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning]. - The minimum Julia version is also guessed now (#225) - The package owner is also guessed now (#225) - The indentation is also guessed now (#225) +- New question: JuliaMinCIVersion, which defines which Julia version to use in the CI (#400) ### Changed diff --git a/copier.yml b/copier.yml index 31048107..5cca6076 100644 --- a/copier.yml +++ b/copier.yml @@ -1,3 +1,9 @@ +# Constants +JULIA_LTS_VERSION: + when: false + type: str + default: 1.6 + # Essential questions PackageName: type: str @@ -34,7 +40,7 @@ AuthorEmail: JuliaMinVersion: type: str help: Minimum Julia version (Used in Project.toml and CI. The suggestion below is the LTS version) - default: 1.6 + default: "{{ JULIA_LTS_VERSION }}" License: type: str @@ -70,6 +76,12 @@ AddPrecommit: help: Pre-commit (Whether to add pre-commit.org. It runs before every commit fixing your formatting and preventing bad practices) # CI +JuliaMinCIVersion: + when: "{{ AnswerStrategy == 'ask' }}" + type: str + help: Minimum Julia version used in the tests (lts defaults to the Long Term Support version) + default: "{% if JuliaMinVersion == JULIA_LTS_VERSION %}lts{% else %}{{ JuliaMinVersion }}{% endif %}" + AddMacToCI: when: "{{ AnswerStrategy == 'ask' }}" type: bool diff --git a/src/debug/Data.jl b/src/debug/Data.jl index 58cc1a9d..b1b7a99f 100644 --- a/src/debug/Data.jl +++ b/src/debug/Data.jl @@ -36,6 +36,7 @@ const strategy_ask = merge(strategy_recommended, Dict("AnswerStrategy" => "ask") const optional_questions_with_default = Dict( "AddPrecommit" => true, + "JuliaMinCIVersion" => "lts", "AddMacToCI" => true, "AddWinToCI" => true, "RunJuliaNightlyOnCI" => true, diff --git a/template/.github/workflows/Test.yml.jinja b/template/.github/workflows/Test.yml.jinja index 6e83089e..893f592f 100644 --- a/template/.github/workflows/Test.yml.jinja +++ b/template/.github/workflows/Test.yml.jinja @@ -22,7 +22,7 @@ jobs: fail-fast: false matrix: version: - - "{{ JuliaMinVersion }}" + - "{{ JuliaMinCIVersion }}" - "1" os: - ubuntu-latest diff --git a/test/test-bad-usage-and-errors.jl b/test/test-bad-usage-and-errors.jl index 439903c9..ae7f3e29 100644 --- a/test/test-bad-usage-and-errors.jl +++ b/test/test-bad-usage-and-errors.jl @@ -22,6 +22,7 @@ end @testset "It works if the dst_path is ." begin mkdir("some_folder2") cd("some_folder2") do + @show readdir(".") # Should not throw BestieTemplate.generate( C.template_path, diff --git a/test/utils.jl b/test/utils.jl index 53fb09e3..35d7444b 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -81,6 +81,7 @@ _random(::Val{:License}, value) = rand(["Apache-2.0", "GPL-3.0", "MIT", "MPL-2.0 _random(::Val{:Indentation}, value) = rand(2:8) _random(::Val{:PackageUUID}, value) = [x in C.hex ? rand(C.hex) : x for x in value] |> join _random(::Val{:JuliaMinVersion}, value) = "1.$(rand(0:20))" +_random(::Val{:JuliaMinCIVersion}, value) = rand() < 0.2 ? "lts" : "1.$(rand(0:20))" """ Constants used in the tests