From 1453921b1ded295bd1b237633a1c3a1a4b0a42bc Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 09:15:02 +1200 Subject: [PATCH 01/12] Add GitHub actions workflow to run tests --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++++++++ test/MOI_wrapper.jl | 2 +- test/lp.jl | 2 +- test/runtests.jl | 8 ++++++-- test/sdp.jl | 4 ++-- 5 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8119ed3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI +on: + push: + branches: [master] + pull_request: + types: [opened, synchronize, reopened] +# needed to allow julia-actions/cache to delete old caches that it has created +permissions: + actions: write + contents: read +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: ['1.10'] + os: [ubuntu-latest] + arch: [x64] + steps: + - uses: actions/checkout@v4 + - uses: matlab-actions/setup-matlab@v2 + with: + release: R2024a + - shell: bash + run: | + wget https://github.com/sqlp/sedumi/releases/download/v1.3.8/sedumi.tgz + tar -xf sedumi.tgz + ls -l + - uses: matlab-actions/run-command@v2 + with: + command: cd("sedumi"), install_sedumi + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v4 + with: + file: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/test/MOI_wrapper.jl b/test/MOI_wrapper.jl index 4def97a..a65d69f 100644 --- a/test/MOI_wrapper.jl +++ b/test/MOI_wrapper.jl @@ -44,7 +44,7 @@ function test_runtests() model.optimizer, MathOptInterface.Bridges.Variable.ZerosBridge{Float64}, ) - MOI.set(model, MOI.Silent(), true) + # MOI.set(model, MOI.Silent(), true) MOI.Test.runtests( model, MOI.Test.Config( diff --git a/test/lp.jl b/test/lp.jl index 91c4012..e2f26a6 100644 --- a/test/lp.jl +++ b/test/lp.jl @@ -14,7 +14,7 @@ using SeDuMi 1.0 0.5 0.0 1.0 ] b = [5.0, 3.0] - sol, dual, status = sedumi(A, b, c, fid = 0) + sol, dual, status = sedumi(A, b, c) @test sol ≈ sparse([1, 2], [1, 1], [47 / 24, 25 // 12], 4, 1) @test dual ≈ [1 / 8, -1 / 4] @test iszero(status["pinf"]) diff --git a/test/runtests.jl b/test/runtests.jl index be48bd2..71b3507 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,6 +3,10 @@ # Use of this source code is governed by an MIT-style license that can be found # in the LICENSE.md file or at https://opensource.org/licenses/MIT. +using MATLAB +@show mat"ver" + include("lp.jl") -include("sdp.jl") -include("MOI_wrapper.jl") + +# include("sdp.jl") +# include("MOI_wrapper.jl") diff --git a/test/sdp.jl b/test/sdp.jl index adb7a51..84abb97 100644 --- a/test/sdp.jl +++ b/test/sdp.jl @@ -27,7 +27,7 @@ using SeDuMi b = [1.0, 0.0] c = [0.0, 1.0, 0.0, 0.0, 1.0] primal, dual, info = - sedumi(A, b, c, SeDuMi.Cone(0, 1, [], [], [2]), fid = 0) + sedumi(A, b, c, SeDuMi.Cone(0, 1, [], [], [2])) @test primal ≈ [1, 1, -1, -1, 1] @test dual ≈ [2.0, 0.0] @test info["pinf"] == 0.0 @@ -44,7 +44,7 @@ using SeDuMi b = [1.0, 0.0] c = [1.0, 0.0, 0.0, 1.0] primal, dual, info = - sedumi(A, b, c, SeDuMi.Cone(0, 0, [], [], [2]), fid = 0) + sedumi(A, b, c, SeDuMi.Cone(0, 0, [], [], [2])) @test isempty(primal) @test dual == [1.0, -1.0] @test info["pinf"] == 1.0 From 0ec17d8453cfc24c2e1b791835256cb4f5f9016f Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 10:36:11 +1200 Subject: [PATCH 02/12] Update --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8119ed3..7d32498 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v4 - uses: matlab-actions/setup-matlab@v2 with: - release: R2024a + release: R2021b - shell: bash run: | wget https://github.com/sqlp/sedumi/releases/download/v1.3.8/sedumi.tgz From 9eb8a44a220a0ddc5fb1731b0b7eee6a463a6eea Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 10:39:59 +1200 Subject: [PATCH 03/12] Update --- .github/workflows/ci.yml | 6 ++++++ test/sdp.jl | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d32498..7acbd7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,11 @@ on: branches: [master] pull_request: types: [opened, synchronize, reopened] +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} # needed to allow julia-actions/cache to delete old caches that it has created permissions: actions: write @@ -24,6 +29,7 @@ jobs: release: R2021b - shell: bash run: | + sudo apt-get install csh wget https://github.com/sqlp/sedumi/releases/download/v1.3.8/sedumi.tgz tar -xf sedumi.tgz ls -l diff --git a/test/sdp.jl b/test/sdp.jl index 84abb97..15d3ae8 100644 --- a/test/sdp.jl +++ b/test/sdp.jl @@ -26,8 +26,7 @@ using SeDuMi ] b = [1.0, 0.0] c = [0.0, 1.0, 0.0, 0.0, 1.0] - primal, dual, info = - sedumi(A, b, c, SeDuMi.Cone(0, 1, [], [], [2])) + primal, dual, info = sedumi(A, b, c, SeDuMi.Cone(0, 1, [], [], [2])) @test primal ≈ [1, 1, -1, -1, 1] @test dual ≈ [2.0, 0.0] @test info["pinf"] == 0.0 @@ -43,8 +42,7 @@ using SeDuMi ] b = [1.0, 0.0] c = [1.0, 0.0, 0.0, 1.0] - primal, dual, info = - sedumi(A, b, c, SeDuMi.Cone(0, 0, [], [], [2])) + primal, dual, info = sedumi(A, b, c, SeDuMi.Cone(0, 0, [], [], [2])) @test isempty(primal) @test dual == [1.0, -1.0] @test info["pinf"] == 1.0 From 8e637246a1670421f165ed6856f307504b4fc513 Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 10:44:50 +1200 Subject: [PATCH 04/12] Update --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7acbd7d..4f464d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - uses: actions/checkout@v4 - uses: matlab-actions/setup-matlab@v2 with: - release: R2021b + release: R2024a - shell: bash run: | sudo apt-get install csh From e234fee0a213d5481e3cb0ff6fb977087dced997 Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 10:52:21 +1200 Subject: [PATCH 05/12] Update --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f464d4..aea5218 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: ls -l - uses: matlab-actions/run-command@v2 with: - command: cd("sedumi"), install_sedumi + command: cd("sedumi"), install_sedumi -rebuild - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} From 51e9af8becb8e808336bf344bf5b78aeaa724f4e Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 11:01:00 +1200 Subject: [PATCH 06/12] Update --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aea5218..5c13f93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,24 +27,34 @@ jobs: - uses: matlab-actions/setup-matlab@v2 with: release: R2024a - - shell: bash - run: | - sudo apt-get install csh - wget https://github.com/sqlp/sedumi/releases/download/v1.3.8/sedumi.tgz - tar -xf sedumi.tgz - ls -l - - uses: matlab-actions/run-command@v2 - with: - command: cd("sedumi"), install_sedumi -rebuild + # - shell: bash + # run: | + # sudo apt-get install csh + # wget https://github.com/sqlp/sedumi/releases/download/v1.3.8/sedumi.tgz + # tar -xf sedumi.tgz + # ls -l + # - uses: matlab-actions/run-command@v2 + # with: + # command: cd("sedumi"), install_sedumi - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: julia-actions/cache@v2 - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 - - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v4 - with: - file: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} + # - uses: julia-actions/cache@v2 + - name: Set MATLAB environment variables + run: | + echo "MATLAB_ROOT=$MATLAB_ROOT" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$MATLAB_ROOT/bin/glnxa64:$LD_LIBRARY_PATH" >> $GITHUB_ENV + - shell: julia --color=yes {0} + run: | + import Pkg + Pkg.add("MATLAB") + using MATLAB + mat"disp(\"Hello from MATLAB via Julia\")" + # - uses: julia-actions/julia-buildpkg@v1 + # - uses: julia-actions/julia-runtest@v1 + # - uses: julia-actions/julia-processcoverage@v1 + # - uses: codecov/codecov-action@v4 + # with: + # file: lcov.info + # token: ${{ secrets.CODECOV_TOKEN }} From b2a508b137bf3093de6fe1aa0021417c124460b8 Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 11:05:15 +1200 Subject: [PATCH 07/12] Update --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c13f93..5a07ab3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,10 +41,10 @@ jobs: version: ${{ matrix.version }} arch: ${{ matrix.arch }} # - uses: julia-actions/cache@v2 - - name: Set MATLAB environment variables - run: | - echo "MATLAB_ROOT=$MATLAB_ROOT" >> $GITHUB_ENV - echo "LD_LIBRARY_PATH=$MATLAB_ROOT/bin/glnxa64:$LD_LIBRARY_PATH" >> $GITHUB_ENV + # - name: Set MATLAB environment variables + # run: | + # echo "MATLAB_ROOT=$MATLAB_ROOT" >> $GITHUB_ENV + # echo "LD_LIBRARY_PATH=$MATLAB_ROOT/bin/glnxa64:$LD_LIBRARY_PATH" >> $GITHUB_ENV - shell: julia --color=yes {0} run: | import Pkg From 3983c620fb0cfdbb62456a275742236256c0a509 Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 11:13:53 +1200 Subject: [PATCH 08/12] Update --- .github/workflows/ci.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a07ab3..6669f47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,16 +41,24 @@ jobs: version: ${{ matrix.version }} arch: ${{ matrix.arch }} # - uses: julia-actions/cache@v2 - # - name: Set MATLAB environment variables - # run: | - # echo "MATLAB_ROOT=$MATLAB_ROOT" >> $GITHUB_ENV - # echo "LD_LIBRARY_PATH=$MATLAB_ROOT/bin/glnxa64:$LD_LIBRARY_PATH" >> $GITHUB_ENV + - name: Set MATLAB environment variables + run: | + echo "MATLAB_ROOT=/opt/hostedtoolcache/MATLAB/2024.1.999/x64" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$MATLAB_ROOT/bin/glnxa64:$LD_LIBRARY_PATH" >> $GITHUB_ENV - shell: julia --color=yes {0} run: | - import Pkg - Pkg.add("MATLAB") - using MATLAB - mat"disp(\"Hello from MATLAB via Julia\")" + const libeng = Ref{Ptr{Cvoid}}() + const eng_open = Ref{Ptr{Cvoid}}() + libeng_path = joinpath(ENV["MATLAB_ROOT"], "bin", "glnxa64", "libeng") + libeng[] = Libdl.dlopen(libeng_path, Libdl.RTLD_GLOBAL) + eng_open[] = Libdl.dlsym(libeng[], :engOpen) + ep = ccall( + eng_open[], + Ptr{Cvoid}, + (Ptr{UInt8},), + "-nodisplay -nosplash -nodesktop", + ) + @show ep # - uses: julia-actions/julia-buildpkg@v1 # - uses: julia-actions/julia-runtest@v1 # - uses: julia-actions/julia-processcoverage@v1 From 1f061ac26586ee9c12dbd8a30a6cc9714408e12b Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 11:17:00 +1200 Subject: [PATCH 09/12] Update --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6669f47..ed6c402 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,7 @@ jobs: echo "LD_LIBRARY_PATH=$MATLAB_ROOT/bin/glnxa64:$LD_LIBRARY_PATH" >> $GITHUB_ENV - shell: julia --color=yes {0} run: | + import Libdl const libeng = Ref{Ptr{Cvoid}}() const eng_open = Ref{Ptr{Cvoid}}() libeng_path = joinpath(ENV["MATLAB_ROOT"], "bin", "glnxa64", "libeng") From 5b679f55cf9a59b8eed452222631299ab01be6fb Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 11:27:13 +1200 Subject: [PATCH 10/12] Update --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed6c402..7ddb417 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,8 +51,11 @@ jobs: const libeng = Ref{Ptr{Cvoid}}() const eng_open = Ref{Ptr{Cvoid}}() libeng_path = joinpath(ENV["MATLAB_ROOT"], "bin", "glnxa64", "libeng") + @show libeng_path libeng[] = Libdl.dlopen(libeng_path, Libdl.RTLD_GLOBAL) + @show libeng[] eng_open[] = Libdl.dlsym(libeng[], :engOpen) + @show eng_open[] ep = ccall( eng_open[], Ptr{Cvoid}, From 109c813a0d4e98f132defd9f5e5b72df2ec598cc Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 11:30:55 +1200 Subject: [PATCH 11/12] Update --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ddb417..86ad3b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,6 +56,8 @@ jobs: @show libeng[] eng_open[] = Libdl.dlsym(libeng[], :engOpen) @show eng_open[] + libeng = libeng_path + @ccall libeng.engOpen("-nodisplay -nosplash -nodesktop"::Ptr{UInt8})::Ptr{Cvoid} ep = ccall( eng_open[], Ptr{Cvoid}, From de07280cc2a6233d4897efc68270e840aae8d2a1 Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 17 Apr 2025 11:33:32 +1200 Subject: [PATCH 12/12] Update --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86ad3b3..0080713 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,8 +56,7 @@ jobs: @show libeng[] eng_open[] = Libdl.dlsym(libeng[], :engOpen) @show eng_open[] - libeng = libeng_path - @ccall libeng.engOpen("-nodisplay -nosplash -nodesktop"::Ptr{UInt8})::Ptr{Cvoid} + @ccall libeng_path.engOpen("-nodisplay -nosplash -nodesktop"::Ptr{UInt8})::Ptr{Cvoid} ep = ccall( eng_open[], Ptr{Cvoid},