Skip to content

Commit b67511d

Browse files
authored
Improve CI and tag new version (#46)
* Add CI updates. * Add Aqua * Makes Aqua a breaking test (ambiguities). To fix * Fix spelling
1 parent 8f15977 commit b67511d

18 files changed

+215
-84
lines changed

.github/workflows/CompatHelper.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,43 @@
1-
name: CompatHelper
21
on:
32
schedule:
43
- cron: 0 0 * * *
54
workflow_dispatch:
5+
permissions:
6+
contents: write
7+
pull-requests: write
68
jobs:
79
CompatHelper:
810
runs-on: ubuntu-latest
911
steps:
10-
- name: Pkg.add("CompatHelper")
11-
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
12-
- name: CompatHelper.main()
12+
- name: Check if Julia is already available in the PATH
13+
id: julia_in_path
14+
run: which julia
15+
continue-on-error: true
16+
- name: Install Julia, but only if it is not already available in the PATH
17+
uses: julia-actions/setup-julia@v1
18+
with:
19+
version: "1"
20+
arch: ${{ runner.arch }}
21+
if: steps.julia_in_path.outcome != 'success'
22+
- name: "Add the General registry via Git"
23+
run: |
24+
import Pkg
25+
ENV["JULIA_PKG_SERVER"] = ""
26+
Pkg.Registry.add("General")
27+
shell: julia --color=yes {0}
28+
- name: "Install CompatHelper"
29+
run: |
30+
import Pkg
31+
name = "CompatHelper"
32+
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
33+
version = "3"
34+
Pkg.add(; name, uuid, version)
35+
shell: julia --color=yes {0}
36+
- name: "Run CompatHelper"
37+
run: |
38+
import CompatHelper
39+
CompatHelper.main()
40+
shell: julia --color=yes {0}
1341
env:
1442
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1543
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
16-
run: julia -e 'using CompatHelper; CompatHelper.main()'

.github/workflows/SpellCheck.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Spell Check
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
typos-check:
7+
name: Spell Check with Typos
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout Actions Repository
11+
uses: actions/checkout@v4
12+
- name: Check spelling
13+
uses: crate-ci/typos@v1.18.0

.github/workflows/TagBot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ on:
44
types:
55
- created
66
workflow_dispatch:
7+
inputs:
8+
lookback:
9+
default: "3"
10+
permissions:
11+
actions: read
12+
checks: read
13+
contents: write
14+
deployments: read
15+
issues: read
16+
discussions: read
17+
packages: read
18+
pages: read
19+
pull-requests: read
20+
repository-projects: read
21+
security-events: read
22+
statuses: read
723
jobs:
824
TagBot:
925
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'

.github/workflows/ci.yml

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,81 @@
11
name: CI
22
on:
3+
pull_request:
4+
branches:
5+
- main
6+
- dev
7+
paths-ignore:
8+
- "docs/**"
39
push:
410
branches:
511
- main
6-
tags: '*'
7-
pull_request:
8-
concurrency:
9-
# Skip intermediate builds: always.
10-
# Cancel intermediate builds: only if it is a pull request build.
11-
group: ${{ github.workflow }}-${{ github.ref }}
12-
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
12+
paths-ignore:
13+
- "docs/**"
1314
jobs:
15+
formatter:
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
julia-version: [1]
20+
julia-arch: [x86]
21+
os: [ubuntu-latest]
22+
steps:
23+
- uses: julia-actions/setup-julia@latest
24+
with:
25+
version: ${{ matrix.julia-version }}
26+
27+
- uses: actions/checkout@v4
28+
- name: Install JuliaFormatter and format
29+
# This will use the latest version by default but you can set the version like so:
30+
#
31+
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
32+
run: |
33+
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="1.0.50"))'
34+
julia -e 'using JuliaFormatter; format(".", verbose=true)'
35+
- name: Format check
36+
run: |
37+
julia -e '
38+
out = Cmd(`git diff`) |> read |> String
39+
if out == ""
40+
exit(0)
41+
else
42+
@error "Some files have not been formatted !!!"
43+
write(stdout, out)
44+
exit(1)
45+
end'
1446
test:
1547
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
1648
runs-on: ${{ matrix.os }}
1749
strategy:
1850
fail-fast: false
1951
matrix:
2052
version:
21-
- '1.10'
22-
- 'nightly'
53+
- "1.8"
54+
- "1" # automatically expands to the latest stable 1.x release of Julia
55+
- nightly
2356
os:
2457
- ubuntu-latest
25-
- macOS-latest
26-
- windows-latest
2758
arch:
2859
- x64
2960
- x86
30-
exclude:
61+
include:
62+
# test macOS and Windows with latest Julia only
3163
- os: macOS-latest
32-
arch: x86
64+
arch: x64
65+
version: 1
66+
- os: windows-latest
67+
arch: x64
68+
version: 1
3369
- os: windows-latest
3470
arch: x86
71+
version: 1
3572
steps:
36-
- uses: actions/checkout@v3
73+
- uses: actions/checkout@v4
3774
- uses: julia-actions/setup-julia@v1
3875
with:
3976
version: ${{ matrix.version }}
4077
arch: ${{ matrix.arch }}
41-
- uses: actions/cache@v1
78+
- uses: actions/cache@v4
4279
env:
4380
cache-name: cache-artifacts
4481
with:
@@ -51,14 +88,14 @@ jobs:
5188
- uses: julia-actions/julia-buildpkg@v1
5289
- uses: julia-actions/julia-runtest@v1
5390
- uses: julia-actions/julia-processcoverage@v1
54-
- uses: codecov/codecov-action@v1
91+
- uses: codecov/codecov-action@v4
5592
with:
5693
file: lcov.info
5794
docs:
5895
name: Documentation
5996
runs-on: ubuntu-latest
6097
steps:
61-
- uses: actions/checkout@v3
98+
- uses: actions/checkout@v4
6299
- uses: julia-actions/setup-julia@v1
63100
with:
64101
version: "1"
@@ -69,8 +106,9 @@ jobs:
69106
Pkg.instantiate()'
70107
- run: |
71108
julia --project=docs -e '
72-
using Documenter: doctest
109+
using Documenter: DocMeta, doctest
73110
using ConstraintDomains
111+
DocMeta.setdocmeta!(ConstraintDomains, :DocTestSetup, :(using ConstraintDomains); recursive=true)
74112
doctest(ConstraintDomains)'
75113
- run: julia --project=docs docs/make.jl
76114
env:

.github/workflows/register.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Register Package
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: Version to register or component to bump
7+
required: true
8+
jobs:
9+
register:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: julia-actions/RegisterAction@latest
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*.jl.cov
33
*.jl.mem
44
/docs/build/
5+
/docs/Manifest.toml
56

67
_git2_*
78
.gitignore

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ TestItems = "0.1"
2323
julia = "1.8"
2424

2525
[extras]
26+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
2627
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2728

2829
[targets]
29-
test = ["Test"]
30+
test = ["Aqua", "Test"]

docs/make.jl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ using ConstraintDomains
22
using Documenter
33

44
makedocs(;
5-
modules=[ConstraintDomains],
6-
authors="Jean-François Baffier",
7-
repo="https://github.com/JuliaConstraints/ConstraintDomains.jl/blob/{commit}{path}#L{line}",
8-
sitename="ConstraintDomains.jl",
9-
format=Documenter.HTML(;
10-
prettyurls=get(ENV, "CI", nothing) == "true",
11-
canonical="https://JuliaConstraints.github.io/ConstraintDomains.jl",
5+
modules = [ConstraintDomains],
6+
authors = "Jean-François Baffier",
7+
repo = "https://github.com/JuliaConstraints/ConstraintDomains.jl/blob/{commit}{path}#L{line}",
8+
sitename = "ConstraintDomains.jl",
9+
format = Documenter.HTML(;
10+
prettyurls = get(ENV, "CI", nothing) == "true",
11+
canonical = "https://JuliaConstraints.github.io/ConstraintDomains.jl",
1212
assets = ["assets/favicon.ico"; "assets/github_buttons.js"; "assets/custom.css"],
1313
),
14-
pages=[
15-
"Home" => "index.md",
16-
],
14+
pages = ["Home" => "index.md"],
1715
)
1816

19-
deploydocs(; repo="github.com/JuliaConstraints/ConstraintDomains.jl.git", devbranch = "main")
17+
deploydocs(;
18+
repo = "github.com/JuliaConstraints/ConstraintDomains.jl.git",
19+
devbranch = "main",
20+
)

src/ConstraintDomains.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ using TestItems
1212
export AbstractDomain
1313
export ContinuousDomain
1414
export DiscreteDomain
15-
export DiscreteSet
15+
# export DiscreteSet # not defined
1616
export ExploreSettings
1717
export RangeDomain
1818

src/common.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ An abstract super type for any domain type. A domain type `D <: AbstractDomain`
44
- `Base.∈(val, ::D)`
55
- `Base.rand(::D)`
66
- `Base.length(::D)` that is the number of elements in a discrete domain, and the distance between bounds or similar for a continuous domain
7-
Addtionally, if the domain is used in a dynamic context, it can extend
7+
Additionally, if the domain is used in a dynamic context, it can extend
88
- `add!(::D, args)`
99
- `delete!(::D, args)`
1010
where `args` depends on `D`'s structure
@@ -78,7 +78,9 @@ Base.rand(d::AbstractDomain) = rand(get_domain(d))
7878

7979
Base.rand(d::Union{Vector{D},Set{D}}) where {D<:AbstractDomain} = map(rand, d)
8080

81-
function Base.rand(d::V) where {D<:AbstractDomain,U<:Union{Vector{D},Set{D}},V<:AbstractVector{U}}
81+
function Base.rand(
82+
d::V,
83+
) where {D<:AbstractDomain,U<:Union{Vector{D},Set{D}},V<:AbstractVector{U}}
8284
return map(rand, d)
8385
end
8486

@@ -89,10 +91,7 @@ end
8991
Extends the `string` method to (a vector of) domains.
9092
"""
9193
function Base.string(D::Vector{<:AbstractDomain})
92-
return replace(
93-
"[$(prod(d -> string(d) * ',', D)[1:end-1])]",
94-
" " => "",
95-
)
94+
return replace("[$(prod(d -> string(d) * ',', D)[1:end-1])]", " " => "")
9695
end
9796
Base.string(d::AbstractDomain) = replace(string(d.domain), " " => "")
9897

src/continuous.jl

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ domain(intervals::Vector{I}) where {I<:Interval} = Intervals(intervals)
2727
Base.length(itv::Intervals)
2828
Return the sum of the length of each interval in `itv`.
2929
"""
30-
Base.length(itv::Intervals) = sum(size, get_domain(itv); init=0)
30+
Base.length(itv::Intervals) = sum(size, get_domain(itv); init = 0)
3131

3232
"""
3333
Base.rand(itv::Intervals)
@@ -67,8 +67,7 @@ function domain_size(itv::Intervals)
6767
end
6868

6969
# TODO - implement
70-
function merge_domains(d1::D, d2::D) where {D<:ContinuousDomain}
71-
end
70+
function merge_domains(d1::D, d2::D) where {D<:ContinuousDomain} end
7271

7372
"""
7473
intersect_domains(d₁, d₂)
@@ -104,7 +103,10 @@ function intersect_domains!(is::IS, i::I, new_itvls) where {IS<:Intervals,I<:Int
104103
end
105104
end
106105

107-
function intersect_domains(d₁::D1, d₂::D2) where {T<:Real,D1<:ContinuousDomain{T}, D2<:ContinuousDomain{T}}
106+
function intersect_domains(
107+
d₁::D1,
108+
d₂::D2,
109+
) where {T<:Real,D1<:ContinuousDomain{T},D2<:ContinuousDomain{T}}
108110
new_itvls = Vector{Interval{T}}()
109111
for i in get_domain(d₂)
110112
intersect_domains!(d₁, i, new_itvls)
@@ -118,26 +120,20 @@ end
118120
119121
Defines the size of an interval as its `span`.
120122
"""
121-
size(i::I) where {I <: Interval} = PatternFolds.span(i)
123+
size(i::I) where {I<:Interval} = PatternFolds.span(i)
122124

123125
function Base.string(d::Intervals)
124-
return replace(
125-
"[$(prod(i -> "$(string(i)[2:end-1]),", d.domain)[1:end-1])]",
126-
" " => "",
127-
)
126+
return replace("[$(prod(i -> "$(string(i)[2:end-1]),", d.domain)[1:end-1])]", " " => "")
128127
end
129128

130-
@testitem "ContinuousDomain" tags = [:domains, :continuous] default_imports=false begin
129+
@testitem "ContinuousDomain" tags = [:domains, :continuous] default_imports = false begin
131130
using ConstraintDomains, Intervals, Test
132131
# import Base:size
133132

134-
d1 = domain(1.0..3.15)
135-
d2 = domain(Interval{Open, Open}(-42.42, 5.0))
133+
d1 = domain(1.0 .. 3.15)
134+
d2 = domain(Interval{Open,Open}(-42.42, 5.0))
136135

137-
domains = [
138-
d1,
139-
d2,
140-
]
136+
domains = [d1, d2]
141137

142138
for d in domains
143139
for x in [1, 2.3, π]

0 commit comments

Comments
 (0)