Skip to content

Linux support #95

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

Merged
merged 101 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
6b6b5c2
wip
chtenb Dec 20, 2024
105b334
Restore some windows props
chtenb Jan 8, 2025
e352956
Fix copying behavior
chtenb Jan 8, 2025
3f48ca7
fix copy command
chtenb Jan 8, 2025
4951e66
Remove .exe and .dll suffixes
chtenb Jan 8, 2025
b361458
Do not check all files for crlf
chtenb Jan 8, 2025
e4e67ac
typo
chtenb Jan 8, 2025
b979afa
Also patch rpath of executables
chtenb Jan 8, 2025
bf02b33
Renable some windows includes
chtenb Jan 8, 2025
5c72e88
test
chtenb Jan 8, 2025
642b37a
Fix build issues on windows
chtenb Jan 9, 2025
65aacf0
remove debug output
chtenb Jan 9, 2025
5f92aa8
guard kernel32 refs
chtenb Jan 9, 2025
01ab875
fixup
chtenb Jan 9, 2025
8fdf181
Comment test sources
chtenb Jan 9, 2025
8ea18d6
Merge remote-tracking branch 'github/linux' into linux
chtenb Jan 9, 2025
d21aea2
Adjust patching
chtenb Jan 9, 2025
3dc946d
Make tests pass when never deallocating graphs
chtenb Jan 10, 2025
0a6cf86
Clean up scripts and update upgrade instructions
chtenb Jan 10, 2025
533b142
Update readme
chtenb Jan 10, 2025
ae6c959
Update readme
chtenb Jan 10, 2025
cb28c52
Use version 11.0.0
chtenb Jan 10, 2025
d7801e9
Test agclose in ConsoleApplication
chtenb Jan 13, 2025
ceaf6e1
Implement Close() in RootGraph to be able to manually trigger destruc…
chtenb Jan 20, 2025
d3ef45b
Add two agclose reproductions
chtenb Jan 20, 2025
750dd8b
Add native test
chtenb Jan 20, 2025
da6891b
simplify repros
chtenb Jan 21, 2025
8758c7b
temp
chtenb Jan 21, 2025
1813b47
attempt linux ci
chtenb Jan 21, 2025
0c5db62
fix
chtenb Jan 21, 2025
f05d778
whitespace fix
chtenb Jan 21, 2025
c1ebf83
formatting
chtenb Jan 21, 2025
1913eca
fix
chtenb Jan 21, 2025
06d5c45
debug
chtenb Jan 21, 2025
c29705b
debug
chtenb Jan 21, 2025
d8ea78f
debug
chtenb Jan 21, 2025
3e80082
debug
chtenb Jan 21, 2025
9ba9b7c
Merge remote-tracking branch 'origin/master' into linux
chtenb Apr 25, 2025
394db7f
Build twice
chtenb Apr 25, 2025
c9d0b0e
test
chtenb Apr 25, 2025
c68a2a6
Add libgts install
chtenb Apr 25, 2025
c4ee3c5
update
chtenb Apr 28, 2025
3d50fd0
fix
chtenb Apr 28, 2025
1b51991
minor fix
chtenb Apr 29, 2025
06463dd
minor fix
chtenb Apr 29, 2025
ff429da
reenable free in marshaling
chtenb Apr 29, 2025
c643205
Fix symlinks in linux files
chtenb Apr 29, 2025
70797bb
reenable closing graphs
chtenb Apr 29, 2025
cb1470f
make more consistent
chtenb Apr 29, 2025
5a718d8
replace cp -r with cp -a
chtenb Apr 30, 2025
70aa94a
Normalize .so versions
chtenb Apr 30, 2025
9286b9d
fixup
chtenb Apr 30, 2025
a47b82b
update
chtenb Apr 30, 2025
244c65c
change ci
chtenb May 1, 2025
d5c07c3
update
chtenb May 1, 2025
87cd93c
rename
chtenb May 1, 2025
74e5191
update
chtenb May 1, 2025
72522c2
rename
chtenb May 1, 2025
1dd5635
rename
chtenb May 1, 2025
31c4d0c
update
chtenb May 6, 2025
e5b1b18
add rid logic
chtenb May 13, 2025
bf69601
Remove net48
chtenb May 19, 2025
3cc4a30
Rename NugetTest to NugetOrgTest
chtenb May 19, 2025
3b6e075
.
chtenb May 19, 2025
5f9d25f
update readme
chtenb May 19, 2025
770be1d
Split tests into separate sln
chtenb May 19, 2025
641e806
update ci
chtenb May 19, 2025
2bc0e42
Move nuget org tests to subdir
chtenb May 19, 2025
8df58fc
Fix nuget org tests
chtenb May 19, 2025
20c5cea
Disable nuget.org tests for now
chtenb May 19, 2025
e6395ab
format
chtenb May 19, 2025
10051ff
format tests
chtenb May 19, 2025
74853e6
Upload correct artefact
chtenb May 19, 2025
e60e51e
fix
chtenb May 19, 2025
cb7cef9
Move checks to workflow
chtenb May 19, 2025
b4f7f3e
update
chtenb May 19, 2025
a50feeb
run static checks on windows
chtenb May 19, 2025
3fe94a8
crlf
chtenb May 19, 2025
cf864ac
Introduce justfile
chtenb May 20, 2025
266b41e
use justfile in actions
chtenb May 20, 2025
bb390af
fix
chtenb May 20, 2025
ccdd383
simplify
chtenb May 20, 2025
009a951
.
chtenb May 20, 2025
61d46cd
.
chtenb May 20, 2025
11b6dcb
.
chtenb May 20, 2025
fb7892a
asdf
chtenb May 20, 2025
45ee40a
change checks
chtenb May 20, 2025
7330bae
update
chtenb May 20, 2025
ef4e4ee
remove all bash scripts
chtenb May 20, 2025
415b0b7
Embed debug symbols
chtenb May 20, 2025
5d3bb75
naming convention
chtenb May 22, 2025
04c0e59
package version logic
chtenb May 27, 2025
581853d
fixup
chtenb May 27, 2025
41138c2
fix
chtenb May 27, 2025
67de038
fix
chtenb May 27, 2025
03d52ba
fix
chtenb May 27, 2025
374518f
fix
chtenb May 27, 2025
c52bf54
fix
chtenb May 27, 2025
d7aea6e
use exit
chtenb May 27, 2025
ea7175c
trim
chtenb May 27, 2025
317407c
add readme
chtenb May 27, 2025
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
40 changes: 40 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Static checks

on:
push: { branches: [ master ] }
pull_request: { branches: [ master ] }
release: { types: [published] } # runs on “Publish release” button
workflow_dispatch: # lets you run it by hand

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
name: Checkout Code

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Restore Tools
run: dotnet tool restore

- name: Check if line endings are CRLF
run: |
bash -c "git grep -rlIP -- ':!GraphvizWrapper/graphvizfiles/*' ':!*.sh' | xargs unix2dos"
git diff --exit-code

- name: Check if README is up-to-date
run: git diff --exit-code -- README.md

- name: Check if code is formatted
run: dotnet format whitespace --verify-no-changes -v diag Rubjerg.Graphviz.sln

- name: Check if code is formatted
run: dotnet format whitespace --verify-no-changes -v diag Rubjerg.Graphviz.Tests.sln

- name: Check for loose ends
run: |
bash -c "! git grep 'FIX''NOW'"
77 changes: 77 additions & 0 deletions .github/workflows/ci-pack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# .github/workflows/ci-pack.yml
name: CI-Pack

on:
push: { branches: [ master ] }
pull_request: { branches: [ master ] }
release: { types: [published] } # runs on “Publish release” button
workflow_dispatch: # lets you run it by hand

jobs:
win-build:
uses: ./.github/workflows/win-build.yml

linux-build:
uses: ./.github/workflows/linux-build.yml

pack:
needs: [win-build, linux-build] # ← the two workflow_call jobs
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

# 1) bring the two per-OS packages into this job --------------------
- uses: actions/download-artifact@v4
with: { name: win-bits, path: artifacts/win }
- uses: actions/download-artifact@v4
with: { name: linux-bits, path: artifacts/linux }

# 2) unzip → merge → zip ------------------------------------------
- name: Merge NuGet packages
id: merge
shell: pwsh
run: |
# locate both nupkgs (Rubjerg.Graphviz.<ver>.nupkg)
$winPkg = Get-ChildItem artifacts/win -Filter *.nupkg | Select -First 1
$linuxPkg = Get-ChildItem artifacts/linux -Filter *.nupkg | Select -First 1
if (-not $winPkg -or -not $linuxPkg) { throw "Packages missing" }

# extract <id> and <version> from the file name
if ($winPkg.Name -notmatch '^(.+?)\.(\d+\.\d+\.\d+(?:-[A-Za-z0-9\.-]+)?)\.nupkg$') {
throw "Unexpected package file name $($winPkg.Name)"
}
$id = $Matches[1] # Rubjerg.Graphviz
$version = $Matches[2] # 2.0.2 (or 2.0.2-beta etc.)

$stage = "stage"
Remove-Item $stage -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Path $stage | Out-Null

Expand-Archive $winPkg.FullName -DestinationPath $stage -Force
Expand-Archive $linuxPkg.FullName -DestinationPath $stage -Force

$outFile = "$id.$version.nupkg"
Compress-Archive "$stage\*" $outFile -Force

# expose the path for later steps
"outfile=$outFile" | Out-File -FilePath $env:GITHUB_OUTPUT -Append

# 3) upload the merged package as a build artefact ------------------
- name: Upload final package as artefact
uses: actions/upload-artifact@v4
with:
name: merged-nupkg
path: ${{ steps.merge.outputs.outfile }}
retention-days: 30

# 4) push to NuGet only on a GitHub Release -------------------------
# - name: Push to NuGet.org
# if: github.event_name == 'release'
# env:
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
# run: |
# nuget push "${{ steps.merge.outputs.outfile }}" `
# -Source https://api.nuget.org/v3/index.json `
# -ApiKey $env:NUGET_API_KEY

73 changes: 73 additions & 0 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: linux-build

on:
workflow_call:
outputs:
artifact-name:
description: "Linux bits"
value: linux-bits

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
name: Checkout Code

# Necessary for running neato
- name: Install libgts
run: sudo apt-get update && sudo apt-get install -y libgts-0.7-5

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Restore Tools
run: dotnet tool restore

- name: Restore NuGet Packages
run: dotnet restore Rubjerg.Graphviz.sln

- name: Print PWD
run: pwd

- name: Build App
run: dotnet build Rubjerg.Graphviz.sln --configuration Release --no-restore

- name: Build App Another Time because dot net sucks and cannot see the native dependencies the first time
run: dotnet build Rubjerg.Graphviz.sln --configuration Release --no-restore

- name: Debug Intermediate Output
run: ls -la /home/runner/work/Graphviz.NetWrapper/Graphviz.NetWrapper/Rubjerg.Graphviz/Resources

- name: Debug Build Output
run: ls -la /home/runner/work/Graphviz.NetWrapper/Graphviz.NetWrapper/Rubjerg.Graphviz/bin/x64/Release/netstandard2.0/

- name: Restore (just built) NuGet Packages for Tests
run: dotnet restore Rubjerg.Graphviz.Tests.sln

- name: Build Tests
run: dotnet build Rubjerg.Graphviz.Tests.sln --configuration Release --no-restore

- name: Debug Test Build Output
run: ls -la /home/runner/work/Graphviz.NetWrapper/Graphviz.NetWrapper/Rubjerg.Graphviz.Test/bin/x64/Release/net8.0/

- name: Run Unittests
run: bash run-tests-netcore.sh Rubjerg.Graphviz.Test/Rubjerg.Graphviz.Test.csproj

- name: Run Transitive Tests
run: bash run-tests-netcore.sh Rubjerg.Graphviz.TransitiveTest/Rubjerg.Graphviz.TransitiveTest.csproj

- name: Locate nupkg
id: pkg
run: |
pkg=$(find . -name "Rubjerg.Graphviz.*.nupkg" | head -1)
echo "package=$pkg" >> "$GITHUB_OUTPUT"

- uses: actions/upload-artifact@v4
with:
name: linux-bits
path: ${{ steps.pkg.outputs.package }}
retention-days: 3
91 changes: 0 additions & 91 deletions .github/workflows/main.yml

This file was deleted.

69 changes: 69 additions & 0 deletions .github/workflows/win-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This is a basic workflow to help you get started with Actions

name: win-build

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch

on:
workflow_call:
outputs:
artifact-name:
description: "Windows bits"
value: win-bits

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
name: Checkout Code

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2

- name: Setup NuGet.exe for use with actions
uses: NuGet/setup-nuget@v1.0.5

- name: Restore Tools
run: dotnet tool restore

- name: Restore NuGet Packages
run: nuget restore Rubjerg.Graphviz.sln

- name: Build App
run: msbuild Rubjerg.Graphviz.sln /p:Configuration=Release

- name: Restore (just built) NuGet Packages for Tests
run: nuget restore Rubjerg.Graphviz.Tests.sln

- name: Build Tests
run: msbuild Rubjerg.Graphviz.Tests.sln /p:Configuration=Release

- name: Run Unittests (.NET 8)
run: bash run-tests-netcore.sh Rubjerg.Graphviz.Test\Rubjerg.Graphviz.Test.csproj

- name: Run Transitive Tests (.NET 8)
run: bash run-tests-netcore.sh Rubjerg.Graphviz.TransitiveTest\Rubjerg.Graphviz.TransitiveTest.csproj


# Locate the package that GeneratePackageOnBuild just produced
- name: Locate nupkg
id: pkg
shell: pwsh
run: |
# search everywhere under Rubjerg.Graphviz\bin\ for the first package
$pkg = Get-ChildItem Rubjerg.Graphviz\bin -Recurse -Filter "Rubjerg.Graphviz.*.nupkg" -File |
Where-Object { $_.Name -notlike "*.symbols.nupkg" } |
Select-Object -First 1

if (-not $pkg) { throw "Rubjerg.Graphviz nupkg not found" }

"package=$($pkg.FullName)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append

# Upload that single file
- uses: actions/upload-artifact@v4
with:
name: win-bits
path: ${{ steps.pkg.outputs.package }}
retention-days: 3
1 change: 1 addition & 0 deletions ConsoleApplication/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin
x64
*.vcxproj.user
*.svg
26 changes: 18 additions & 8 deletions ConsoleApplication/ConsoleApplication.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
#include <iostream>
#include <conio.h>
#include "GraphvizWrapper.h"
#include <string.h>

#ifdef _WIN32
#include <windows.h>
#else
#include <dlfcn.h>
#endif

#include "../GraphvizWrapper/GraphvizWrapper.h"

using namespace std;

int main()
{
int main() {
cout << "Make sure to set the current working directory to the repository root!" << endl;
cout << "Running tests..." << endl;

cout << test_agread() << endl;
cout << test_agmemread() << endl;
cout << test_rj_agmemread() << endl;
cout << missing_label_repro() << endl;
cout << stackoverflow_repro() << endl;

cout << "Press key to exit..";
auto c = _getch();
cout << agclose_repro() << endl;

cout << "Press Enter to exit...";
cin.get(); // Portable replacement for _getch()

return 0;
}

Loading
Loading