Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define QuantumPropagators.VERSION #65

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,35 @@ jobs:
run: wget https://raw.githubusercontent.com/JuliaQuantumControl/JuliaQuantumControl/master/typos.toml
- name: Spell Check
uses: crate-ci/typos@master
- name: Version Check
shell: julia {0}
run: |
using Pkg
VERSION = VersionNumber(Pkg.TOML.parsefile("Project.toml")["version"])
BRANCH = ENV["GITHUB_REF_NAME"]
if ENV["GITHUB_EVENT_NAME"] == "pull_request"
# For pull_request events, return the head (aka., "from") branch,
# not the base (aka., "to") branch.
BRANCH = ENV["GITHUB_HEAD_REF"]
end
if startswith(BRANCH, "release-")
if (length(VERSION.prerelease) == length(VERSION.build))
println("Version $VERSION on release branch OK")
else
@error "Invalid version $VERSION on release branch"
exit(1)
end
elseif (ENV["GITHUB_REF_TYPE"] == "branch") && (BRANCH != "master")
if ("dev" in VERSION.prerelease) || ("dev" in VERSION.build)
println("Version $VERSION OK with dev-suffix on $BRANCH")
else
@error "Invalid version $VERSION on branch $BRANCH: must contain dev suffix"
exit(1)
end
else
println("Version $VERSION OK on $BRANCH")
end
exit(0)
- name: Get codestyle settings
run: wget https://raw.githubusercontent.com/JuliaQuantumControl/JuliaQuantumControl/master/.JuliaFormatter.toml
- name: Install JuliaFormatter and format
Expand Down
1 change: 1 addition & 0 deletions docs/generate_api.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ end
_parentmodule(m, pkg) = parentmodule(m)
_parentmodule(m::TimerOutputs.TimerOutput, pkg) = pkg
_parentmodule(m::Number, pkg) = pkg
_parentmodule(m::VersionNumber, pkg) = pkg


"""Return a list of Module instances for all the sub-modules of `pkg`.
Expand Down
10 changes: 10 additions & 0 deletions src/QuantumPropagators.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
module QuantumPropagators


const VERSION = let
project = joinpath(dirname(dirname(pathof(QuantumPropagators))), "Project.toml")
Base.include_dependency(project) # Retrigger precompilation when Project.toml changes
toml = read(project, String)
m = match(r"(*ANYCRLF)^version\s*=\s\"(.*)\"$"m, toml)
VersionNumber(m[1])
end


include("arnoldi.jl") # submodule Arnoldi
include("specrad.jl") # submodule SpectralRange
include("cheby.jl") # submodule Cheby
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ using SafeTestsets
# Note: comment outer @testset to stop after first @safetestset failure
@time @testset verbose = true "QuantumPropagators" begin

@test v"0.1.0" < QuantumPropagators.VERSION < v"1.0.0"

println("\n* Doctests:")
@time @safetestset "Doctests" begin
using QuantumPropagators, Test, Documenter
Expand Down