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

Add a CI job for nightly #2433

Merged
merged 5 commits into from
Jan 27, 2021
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
39 changes: 39 additions & 0 deletions .github/workflows/nightly_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: nightly_ci
on:
push:
branches:
- master
- /^release-.*$/
pull_request:
types: [opened, synchronize, reopened]
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- version: 'nightly'
os: ubuntu-latest
arch: x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
depwarn: error
7 changes: 7 additions & 0 deletions src/Containers/DenseAxisArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -412,3 +412,10 @@ function Base.show(io::IO, array::DenseAxisArray)
println(io, ":")
return Base.print_array(io, array)
end

# TODO(odow): deprecate this at some point? We have to implement it here because
# it used to work in Julia 1.5. In Julia 1.6, the Base implementation changed to
# assume `x` was 1-indexed. It doesn't make sense to repeat a DenseAxisArray,
# but some users may depend on it's functionality so we have a work-around
# instead of just breaking code.
Base.repeat(x::DenseAxisArray; kwargs...) = repeat(x.data; kwargs...)
2 changes: 2 additions & 0 deletions src/quad_expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ mutable struct GenericQuadExpr{CoefType,VarType} <: AbstractJuMPScalar
terms::OrderedDict{UnorderedPair{VarType}, CoefType}
end

Base.ndims(::GenericQuadExpr) = 0

"""
GenericQuadExpr(
aff::GenericAffExpr{V,K},
Expand Down
12 changes: 6 additions & 6 deletions test/Containers/DenseAxisArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ using Test
@test sprint(show, correct_answer) == """
1-dimensional DenseAxisArray{Float64,1,...} with index sets:
Dimension 1, 2:3
And data, a 2-element Array{Float64,1}:
And data, a 2-element $(Vector{Float64}):
2.0
3.0"""

Expand Down Expand Up @@ -84,7 +84,7 @@ And data, a 2-element Array{Float64,1}:
@test sprint(show, correct_answer) == """
1-dimensional DenseAxisArray{Float64,1,...} with index sets:
Dimension 1, $([:a, :b])
And data, a 2-element Array{Float64,1}:
And data, a 2-element $(Vector{Float64}):
2.0
3.0"""
plus1(x) = x + 1
Expand Down Expand Up @@ -113,7 +113,7 @@ And data, a 2-element Array{Float64,1}:
2-dimensional DenseAxisArray{$Int,2,...} with index sets:
Dimension 1, 2:3
Dimension 2, $([:a, :b])
And data, a 2×2 Array{$Int,2}:
And data, a 2×2 $(Matrix{Int}):
1 2
3 4"""
end
Expand Down Expand Up @@ -145,14 +145,14 @@ And data, a 2×2 Array{$Int,2}:
Dimension 2, $([:a, :b])
Dimension 3, -1:0
Dimension 4, ["a", "b"]
And data, a 2×2×2×2 Array{Float64,4}"""
And data, a 2×2×2×2 $(Array{Float64,4})"""
@test sprint(show, A) == """
4-dimensional DenseAxisArray{Float64,4,...} with index sets:
Dimension 1, 2:3
Dimension 2, $([:a, :b])
Dimension 3, -1:0
Dimension 4, ["a", "b"]
And data, a 2×2×2×2 Array{Float64,4}:
And data, a 2×2×2×2 $(Array{Float64,4}):
[:, :, -1, "a"] =
1.0 0.0
0.0 0.0
Expand All @@ -179,7 +179,7 @@ And data, a 2×2×2×2 Array{Float64,4}:
A[] = 1
@test sprint(show, A) == """
0-dimensional DenseAxisArray{$Int,0,...} with index sets:
And data, a 0-dimensional Array{$Int,0}:
And data, a 0-dimensional $(Array{Int,0}):
1"""
end

Expand Down
8 changes: 4 additions & 4 deletions test/Containers/SparseAxisArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ using Test
d = @inferred SA(Dict((:a,) => 1, (:b,) => 2))
@testset "Printing" begin
@test sprint(summary, d) == """
SparseAxisArray{$Int,1,Tuple{Symbol}} with 2 entries"""
$(SparseAxisArray{Int,1,Tuple{Symbol}}) with 2 entries"""
@test sprint(show, "text/plain", d) == """
SparseAxisArray{$Int,1,Tuple{Symbol}} with 2 entries:
$(SparseAxisArray{Int,1,Tuple{Symbol}}) with 2 entries:
[a] = 1
[b] = 2"""
end
Expand Down Expand Up @@ -94,9 +94,9 @@ SparseAxisArray{$Int,1,Tuple{Symbol}} with 2 entries:
@test_throws BoundsError(d, (:a,)) d[:a]
@testset "Printing" begin
@test sprint(summary, d) == """
SparseAxisArray{Float64,2,Tuple{Symbol,Char}} with 2 entries"""
$(SparseAxisArray{Float64,2,Tuple{Symbol,Char}}) with 2 entries"""
@test sprint(show, "text/plain", d) == """
SparseAxisArray{Float64,2,Tuple{Symbol,Char}} with 2 entries:
$(SparseAxisArray{Float64,2,Tuple{Symbol,Char}}) with 2 entries:
[b, v] = 0.5
[a, u] = 2.0"""
end
Expand Down
4 changes: 2 additions & 2 deletions test/constraint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,8 @@ function test_Model_all_constraints_vector(::Any, ::Any)
)
@test isempty(aff_constraints)
err = ErrorException(
"`GenericAffExpr{Float64,VarType} where VarType` is not a " *
"concrete type. Did you miss a type parameter?",
"`$(GenericAffExpr{Float64})` is not a concrete type. Did you miss a " *
"type parameter?",
)
@test_throws err try
num_constraints(
Expand Down
6 changes: 6 additions & 0 deletions test/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ function expressions_test(
z = @inferred (x * x)^3
@test z.pow == 6
end

@testset "ndims(::QuadExpr)" begin
model = ModelType()
@variable(model, x)
@test ndims(x^2 + 1) == 0
end
end

@testset "Expressions for JuMP.Model" begin
Expand Down
2 changes: 1 addition & 1 deletion test/nlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ end
MOI.initialize(d, [:Grad])
expected_exception = ErrorException(
"Expected return type of Float64 from a user-defined function, " *
"but got GenericAffExpr{Float64,VariableRef}. Make sure your " *
"but got $(GenericAffExpr{Float64,VariableRef}). Make sure your " *
"user-defined function only depends on variables passed as " *
"arguments.",
)
Expand Down
18 changes: 9 additions & 9 deletions test/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -508,12 +508,12 @@ Subject to
A JuMP Model
Maximization problem with:
Variables: 13
Objective function type: GenericAffExpr{Float64,$VariableType}
`GenericAffExpr{Float64,$VariableType}`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint
`GenericQuadExpr{Float64,$VariableType}`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint
`Array{$VariableType,1}`-in-`MathOptInterface.PositiveSemidefiniteConeTriangle`: 2 constraints
`Array{$VariableType,1}`-in-`MathOptInterface.PositiveSemidefiniteConeSquare`: 2 constraints
`Array{GenericAffExpr{Float64,$VariableType},1}`-in-`MathOptInterface.SecondOrderCone`: 1 constraint
Objective function type: $(GenericAffExpr{Float64,VariableType})
`$(GenericAffExpr{Float64,VariableType})`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint
`$(GenericQuadExpr{Float64,VariableType})`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint
`$(Array{VariableType,1})`-in-`MathOptInterface.PositiveSemidefiniteConeTriangle`: 2 constraints
`$(Array{VariableType,1})`-in-`MathOptInterface.PositiveSemidefiniteConeSquare`: 2 constraints
`$(Array{GenericAffExpr{Float64,VariableType},1})`-in-`MathOptInterface.SecondOrderCone`: 1 constraint
`$VariableType`-in-`MathOptInterface.EqualTo{Float64}`: 1 constraint
`$VariableType`-in-`MathOptInterface.GreaterThan{Float64}`: 4 constraints
`$VariableType`-in-`MathOptInterface.LessThan{Float64}`: 4 constraints
Expand Down Expand Up @@ -579,7 +579,7 @@ c & x\\\\
A JuMP Model
Feasibility problem with:
Variables: 2
`GenericQuadExpr{Float64,$VariableType}`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint
`$(GenericQuadExpr{Float64,VariableType})`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint
`$VariableType`-in-`MathOptInterface.Integer`: 1 constraint
`$VariableType`-in-`MathOptInterface.ZeroOne`: 1 constraint
Model mode: AUTOMATIC
Expand All @@ -600,7 +600,7 @@ Names registered in the model: x, y""",
A JuMP Model
Feasibility problem with:
Variable: 1
`GenericAffExpr{Float64,$VariableType}`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint
`$(GenericAffExpr{Float64,VariableType})`-in-`MathOptInterface.LessThan{Float64}`: 1 constraint
Model mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.
Expand Down Expand Up @@ -665,7 +665,7 @@ Subject to
A JuMP Model
Maximization problem with:
Variables: 13
Objective function type: GenericAffExpr{Float64,$VariableType}
Objective function type: $(GenericAffExpr{Float64,VariableType})
Constraints: 3
Names registered in the model: a, a1, b, b1, c, c1, fi, u, x, y, z""",
repl = :show,
Expand Down