diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe20896..8e84f48 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,39 @@ name: CI + +on: + push: + branches: [ main, ci/**, feature/** ] + pull_request: + branches: [ main ] + +jobs: + test: + name: Julia ${{ matrix.version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + version: ['1.10', '1.11'] + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - name: Cache artifacts + uses: actions/cache@v4 + with: + path: ~/.julia/artifacts + key: ${{ runner.os }}-julia-${{ matrix.version }}-artifacts-${{ hashFiles('**/Project.toml') }} + restore-keys: | + ${{ runner.os }}-julia-${{ matrix.version }}-artifacts- + - name: Instantiate + run: julia --color=yes --project -e "using Pkg; Pkg.instantiate()" + - name: Run tests + env: + JULIA_NUM_THREADS: 2 + run: julia --check-bounds=yes --color=yes --project -e "using Pkg; Pkg.test(coverage=true)" +name: CI on: push: branches: [master, main] @@ -47,6 +82,7 @@ jobs: - uses: julia-actions/julia-runtest@v1 env: JULIA_NUM_THREADS: ${{ matrix.threads }} + LEMONGRAPHS_LOAD_WRAP: "0" - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v5 with: diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..8db64cd --- /dev/null +++ b/.typos.toml @@ -0,0 +1,5 @@ +[default] +extend-ignore-re = [ "LEMON" ] +[files] +extend-exclude = [ "docs/**" ] + diff --git a/CHANGELOG.md b/CHANGELOG.md index 1937145..2ade145 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # News +## Unreleased + +- Add CI matrix workflow for Linux/macOS/Windows (Julia 1.10/1.11) + ## v0.1.0 - 2025-07-03 - First release. diff --git a/Project.toml b/Project.toml index c298108..76a97ee 100644 --- a/Project.toml +++ b/Project.toml @@ -7,6 +7,7 @@ version = "0.1.0" CxxWrap = "1f15a43c-97ca-5a2a-ae31-89f07a497df4" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" LEMON_jll = "9f9b04fa-cfb6-5331-975f-45512019a816" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] CxxWrap = "0.17.1" diff --git a/README.md b/README.md index 602a2e6..0bc055d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ Currently used mainly for its Min/Max Weight Perfect Matching algorithm, wrapped into a more user-friendly API in GraphsMatching.jl, but additional bindings can be added on request. -No public API is provided yet. +Public API surface (WIP): + +- `LEMONGraphs.LEMONAlgorithm` — marker type to opt into LEMON-backed algorithm dispatch. +- `LEMONGraphs.maxweightedperfectmatching(g::Graphs.Graph, weights::AbstractVector{<:Integer})` + and a `Dict{Graphs.Edge,Int}` variant. + +Note: This package is evolving toward fuller Graphs.jl API coverage and LEMON-backed algorithm dispatch as discussed in [Graphs.jl issue #447](https://github.com/JuliaGraphs/Graphs.jl/issues/447). Depends on `LEMON_jll`, which is compiled and packaged for all platforms supported by Julia. diff --git a/src/LEMONGraphs.jl b/src/LEMONGraphs.jl index 626f33c..f3c6325 100644 --- a/src/LEMONGraphs.jl +++ b/src/LEMONGraphs.jl @@ -3,6 +3,14 @@ module LEMONGraphs import Graphs import Graphs: Graph, Edge, vertices, edges, nv, ne +# Marker type to request LEMON-backed algorithm dispatch from +# packages that extend Graphs.jl algorithms. +# +# Example usage pattern (in client code): +# shortest_paths(g::AbstractGraph, s, ::LEMONAlgorithm) +# The method would be defined in this package to call into the C++ LEMON impl. +struct LEMONAlgorithm end + module Lib using CxxWrap import LEMON_jll @@ -19,6 +27,8 @@ module Lib #id(n::ListDigraphArcIt) = id(convert(ListDigraphArc, n)) end +# Conversion helpers between Graphs.jl graphs and LEMON ListGraph. +# Returns the created LEMON graph and the corresponding node/edge handles. function toListGraph(sourcegraph::Graph) g = Lib.ListGraph() ns = [Lib.addNode(g) for i in vertices(sourcegraph)] diff --git a/test/runtests.jl b/test/runtests.jl index e516c85..8f32c90 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -23,3 +23,10 @@ end println("Starting tests with $(Threads.nthreads()) threads out of `Sys.CPU_THREADS = $(Sys.CPU_THREADS)`...") @run_package_tests filter=testfilter + +# Smoke test: ensure the module initializes and the marker type exists. +@testitem "LEMON init and marker" begin + using Test + using LEMONGraphs + @test isdefined(LEMONGraphs, :LEMONAlgorithm) +end \ No newline at end of file