Skip to content

CI: add GitHub Actions matrix #5

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[default]
extend-ignore-re = [ "LEMON" ]
[files]
extend-exclude = [ "docs/**" ]

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
10 changes: 10 additions & 0 deletions src/LEMONGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)]
Expand Down
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading