Skip to content

Commit f720a41

Browse files
authored
Linux support (#95)
Adds linux support, drops .NET Framework support
1 parent 2dae62b commit f720a41

File tree

114 files changed

+1939
-728
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1939
-728
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,4 @@ dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_
208208
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
209209
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
210210
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
211-
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
211+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case

.github/workflows/checks.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Static checks
2+
3+
on:
4+
push: { branches: [ master ] }
5+
pull_request: { branches: [ master ] }
6+
release: { types: [published] } # runs on “Publish release” button
7+
workflow_dispatch: # lets you run it by hand
8+
9+
jobs:
10+
build:
11+
runs-on: windows-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
name: Checkout Code
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup .NET
19+
uses: actions/setup-dotnet@v3
20+
with:
21+
dotnet-version: 8.0.x
22+
23+
- name: Setup Just
24+
uses: extractions/setup-just@v3
25+
26+
- name: Run static checks
27+
shell: bash
28+
run: just check-all

.github/workflows/ci-pack.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# .github/workflows/ci-pack.yml
2+
name: CI-Pack
3+
4+
on:
5+
push: { branches: [ master ] }
6+
pull_request: { branches: [ master ] }
7+
release: { types: [published] } # runs on “Publish release” button
8+
workflow_dispatch: # lets you run it by hand
9+
10+
jobs:
11+
win-build:
12+
uses: ./.github/workflows/win-build.yml
13+
14+
linux-build:
15+
uses: ./.github/workflows/linux-build.yml
16+
17+
pack:
18+
needs: [win-build, linux-build] # ← the two workflow_call jobs
19+
runs-on: windows-latest
20+
21+
steps:
22+
# 1) bring the two per-OS packages into this job --------------------
23+
- uses: actions/download-artifact@v4
24+
with: { name: win-bits, path: artifacts/win }
25+
- uses: actions/download-artifact@v4
26+
with: { name: linux-bits, path: artifacts/linux }
27+
28+
# 2) unzip → merge → zip ------------------------------------------
29+
- name: Merge NuGet packages
30+
id: merge
31+
shell: pwsh
32+
run: |
33+
# locate both nupkgs (Rubjerg.Graphviz.<ver>.nupkg)
34+
$winPkg = Get-ChildItem artifacts/win -Filter *.nupkg | Select -First 1
35+
$linuxPkg = Get-ChildItem artifacts/linux -Filter *.nupkg | Select -First 1
36+
if (-not $winPkg -or -not $linuxPkg) { throw "Packages missing" }
37+
38+
# extract <id> and <version> from the file name
39+
if ($winPkg.Name -notmatch '^(.+?)\.(\d+\.\d+\.\d+(?:-[A-Za-z0-9\.-]+)?)\.nupkg$') {
40+
throw "Unexpected package file name $($winPkg.Name)"
41+
}
42+
$id = $Matches[1] # Rubjerg.Graphviz
43+
$version = $Matches[2] # 2.0.2 (or 2.0.2-beta etc.)
44+
45+
$stage = "stage"
46+
Remove-Item $stage -Recurse -Force -ErrorAction SilentlyContinue
47+
New-Item -ItemType Directory -Path $stage | Out-Null
48+
49+
Expand-Archive $winPkg.FullName -DestinationPath $stage -Force
50+
Expand-Archive $linuxPkg.FullName -DestinationPath $stage -Force
51+
52+
$outFile = "$id.$version.nupkg"
53+
Compress-Archive "$stage\*" $outFile -Force
54+
55+
# expose the path for later steps
56+
"outfile=$outFile" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
57+
58+
# 3) upload the merged package as a build artefact ------------------
59+
- name: Upload final package as artefact
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: merged-nupkg
63+
path: ${{ steps.merge.outputs.outfile }}
64+
retention-days: 30
65+
66+
# 4) push to NuGet only on a GitHub Release -------------------------
67+
# - name: Push to NuGet.org
68+
# if: github.event_name == 'release'
69+
# env:
70+
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
71+
# run: |
72+
# nuget push "${{ steps.merge.outputs.outfile }}" `
73+
# -Source https://api.nuget.org/v3/index.json `
74+
# -ApiKey $env:NUGET_API_KEY
75+

.github/workflows/linux-build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: linux-build
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
artifact-name:
7+
description: "Linux bits"
8+
value: linux-bits
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
name: Checkout Code
17+
with:
18+
fetch-depth: 0
19+
20+
# Necessary for running neato
21+
- name: Install libgts
22+
run: sudo apt-get update && sudo apt-get install -y libgts-0.7-5
23+
24+
- name: Setup .NET
25+
uses: actions/setup-dotnet@v3
26+
with:
27+
dotnet-version: 8.0.x
28+
29+
- name: Setup Just
30+
uses: extractions/setup-just@v3
31+
32+
- name: Build and test
33+
run: just
34+
35+
- name: Check diff
36+
run: just check-diff
37+
38+
- name: Locate nupkg
39+
id: pkg
40+
run: just locate-nupkg "$GITHUB_OUTPUT"
41+
42+
- uses: actions/upload-artifact@v4
43+
with:
44+
name: linux-bits
45+
path: ${{ steps.pkg.outputs.package }}
46+
retention-days: 3

.github/workflows/main.yml

Lines changed: 0 additions & 91 deletions
This file was deleted.

.github/workflows/win-build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: win-build
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
8+
on:
9+
workflow_call:
10+
outputs:
11+
artifact-name:
12+
description: "Windows bits"
13+
value: win-bits
14+
15+
jobs:
16+
build:
17+
runs-on: windows-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
name: Checkout Code
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Add msbuild to PATH
25+
uses: microsoft/[email protected]
26+
27+
- name: Setup NuGet.exe for use with actions
28+
uses: NuGet/[email protected]
29+
30+
- name: Setup Just
31+
uses: extractions/setup-just@v3
32+
33+
- name: Build and test
34+
run: just
35+
36+
- name: Check diff
37+
run: just check-diff
38+
39+
- name: Locate nupkg
40+
id: pkg
41+
run: just locate-nupkg $env:GITHUB_OUTPUT
42+
43+
- uses: actions/upload-artifact@v4
44+
with:
45+
name: win-bits
46+
path: ${{ steps.pkg.outputs.package }}
47+
retention-days: 3

ConsoleApplication/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
bin
12
x64
23
*.vcxproj.user
34
*.svg
Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
#include <iostream>
2-
#include <conio.h>
3-
#include "GraphvizWrapper.h"
2+
#include <string.h>
3+
4+
#ifdef _WIN32
5+
#include <windows.h>
6+
#else
7+
#include <dlfcn.h>
8+
#endif
9+
10+
#include "../GraphvizWrapper/GraphvizWrapper.h"
411

512
using namespace std;
613

7-
int main()
8-
{
14+
int main() {
915
cout << "Make sure to set the current working directory to the repository root!" << endl;
1016
cout << "Running tests..." << endl;
11-
17+
1218
cout << test_agread() << endl;
1319
cout << test_agmemread() << endl;
1420
cout << test_rj_agmemread() << endl;
1521
cout << missing_label_repro() << endl;
1622
cout << stackoverflow_repro() << endl;
17-
18-
cout << "Press key to exit..";
19-
auto c = _getch();
23+
cout << agclose_repro() << endl;
24+
25+
cout << "Press Enter to exit...";
26+
cin.get(); // Portable replacement for _getch()
27+
28+
return 0;
2029
}
30+

0 commit comments

Comments
 (0)