Skip to content

Commit

Permalink
New question: JuliaMinCIVersion
Browse files Browse the repository at this point in the history
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
  • Loading branch information
abelsiqueira committed Aug 29, 2024
1 parent ef39470 commit bcde9de
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 13 additions & 1 deletion copier.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Constants
JULIA_LTS_VERSION:
when: false
type: str
default: 1.6

# Essential questions
PackageName:
type: str
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/debug/Data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion template/.github/workflows/Test.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
version:
- "{{ JuliaMinVersion }}"
- "{{ JuliaMinCIVersion }}"
- "1"
os:
- ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions test/test-bad-usage-and-errors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bcde9de

Please sign in to comment.