Skip to content

Commit 075f2d4

Browse files
committed
ci: add build-csharp and test-csharp jobs to CI E2E workflow
Adds missing C# test execution to ci-e2e.yaml. The build-csharp job (ubuntu/macos/windows) builds the FFI dylib and .NET package, while test-csharp runs unit tests and alef e2e tests. Both jobs depend on ffi crate and detect C#/FFI changes to gate execution. Sets library path env vars per OS for runtime DLL/dylib resolution.
1 parent 4559574 commit 075f2d4

1 file changed

Lines changed: 135 additions & 0 deletions

File tree

.github/workflows/ci-e2e.yaml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ jobs:
9494
elixir: ${{ steps.filter.outputs.elixir }}
9595
r: ${{ steps.filter.outputs.r }}
9696
wasm: ${{ steps.filter.outputs.wasm }}
97+
csharp: ${{ steps.filter.outputs.csharp }}
9798
kotlin: ${{ steps.filter.outputs.kotlin }}
9899
swift: ${{ steps.filter.outputs.swift }}
99100
dart: ${{ steps.filter.outputs.dart }}
@@ -184,6 +185,11 @@ jobs:
184185
- 'crates/html-to-markdown-wasm-wasi/**'
185186
- 'e2e/wasm/**'
186187
- 'fixtures/**'
188+
csharp:
189+
- 'packages/csharp/**'
190+
- 'e2e/csharp/**'
191+
- 'crates/html-to-markdown-ffi/**'
192+
- 'fixtures/**'
187193
kotlin:
188194
- 'packages/kotlin-android/**'
189195
- 'crates/html-to-markdown-ffi/**'
@@ -533,6 +539,59 @@ jobs:
533539
if: always() && steps.checkout.outcome == 'success'
534540
uses: kreuzberg-dev/actions/cleanup-rust-cache@v1 # v1
535541

542+
build-csharp:
543+
needs: [changes]
544+
name: "Build: C# (${{ matrix.os }})"
545+
if: |
546+
github.event_name == 'workflow_dispatch' ||
547+
needs.changes.outputs.core == 'true' ||
548+
needs.changes.outputs.csharp == 'true'
549+
runs-on: ${{ matrix.os }}
550+
timeout-minutes: 60
551+
strategy:
552+
fail-fast: false
553+
matrix:
554+
os: [ubuntu-latest, macos-latest, windows-latest]
555+
steps:
556+
- name: Checkout
557+
uses: actions/checkout@v6
558+
id: checkout
559+
560+
- name: Install Task
561+
uses: kreuzberg-dev/actions/install-task@v1 # v1
562+
563+
- name: Setup Rust
564+
uses: kreuzberg-dev/actions/setup-rust@v1 # v1
565+
with:
566+
cache-key-prefix: csharp-${{ matrix.os }}
567+
568+
- name: Setup .NET
569+
uses: actions/setup-dotnet@v5
570+
with:
571+
dotnet-version: '10.0.x'
572+
573+
- name: Build FFI library (Unix)
574+
if: runner.os != 'Windows'
575+
run: cargo build --release -p html-to-markdown-ffi
576+
shell: bash
577+
578+
- name: Build FFI library (Windows)
579+
if: runner.os == 'Windows'
580+
run: cargo build -p html-to-markdown-ffi
581+
shell: bash
582+
583+
- name: Restore C# dependencies
584+
run: dotnet restore packages/csharp/
585+
shell: bash
586+
587+
- name: Build C# package
588+
run: dotnet build packages/csharp/ -c Release
589+
shell: bash
590+
591+
- name: Cleanup Rust cache
592+
if: always() && steps.checkout.outcome == 'success'
593+
uses: kreuzberg-dev/actions/cleanup-rust-cache@v1 # v1
594+
536595
build-java:
537596
needs: [changes]
538597
name: "Build: Java (${{ matrix.os }})"
@@ -904,6 +963,82 @@ jobs:
904963
env:
905964
EXTENSION_PATH: ${{ steps.build-php-extension.outputs.extension-path }}
906965

966+
test-csharp:
967+
needs: [build-csharp, build-ffi, changes]
968+
name: "Test: C# (${{ matrix.os }})"
969+
if: |
970+
always() && !cancelled() && needs.build-csharp.result != 'skipped' &&
971+
(github.event_name == 'workflow_dispatch' ||
972+
needs.changes.outputs.csharp == 'true' ||
973+
needs.changes.outputs.ffi == 'true' ||
974+
needs.changes.outputs.core == 'true')
975+
runs-on: ${{ matrix.os }}
976+
timeout-minutes: 60
977+
strategy:
978+
fail-fast: false
979+
matrix:
980+
os: [ubuntu-latest, macos-latest, windows-latest]
981+
steps:
982+
- name: Checkout
983+
uses: actions/checkout@v6
984+
985+
- name: Install Task
986+
uses: kreuzberg-dev/actions/install-task@v1 # v1
987+
988+
- name: Setup Rust
989+
uses: kreuzberg-dev/actions/setup-rust@v1 # v1
990+
with:
991+
cache-key-prefix: csharp-test-${{ matrix.os }}
992+
993+
- name: Setup .NET
994+
uses: actions/setup-dotnet@v5
995+
with:
996+
dotnet-version: '10.0.x'
997+
998+
- name: Build FFI library (Unix)
999+
if: runner.os != 'Windows'
1000+
run: cargo build --release -p html-to-markdown-ffi
1001+
shell: bash
1002+
1003+
- name: Build FFI library (Windows)
1004+
if: runner.os == 'Windows'
1005+
run: cargo build -p html-to-markdown-ffi
1006+
shell: bash
1007+
1008+
- name: Restore C# dependencies
1009+
run: dotnet restore packages/csharp/
1010+
shell: bash
1011+
1012+
- name: Build C# package
1013+
run: dotnet build packages/csharp/ -c Release
1014+
shell: bash
1015+
1016+
- name: Run C# unit tests
1017+
run: dotnet test packages/csharp/ -c Release
1018+
shell: bash
1019+
1020+
- name: Install alef
1021+
uses: kreuzberg-dev/actions/install-alef@v1 # v1
1022+
1023+
- name: Run E2E tests (Unix)
1024+
if: runner.os != 'Windows'
1025+
run: alef test --e2e --lang csharp
1026+
shell: bash
1027+
env:
1028+
LD_LIBRARY_PATH: ${{ github.workspace }}/target/release:${{ github.workspace }}/target/debug
1029+
DYLD_LIBRARY_PATH: ${{ github.workspace }}/target/release:${{ github.workspace }}/target/debug
1030+
1031+
- name: Run E2E tests (Windows)
1032+
if: runner.os == 'Windows'
1033+
run: alef test --e2e --lang csharp
1034+
shell: bash
1035+
env:
1036+
PATH: ${{ github.workspace }}/target/release;${{ github.workspace }}/target/debug;${{ env.PATH }}
1037+
1038+
- name: Cleanup Rust cache
1039+
if: always()
1040+
uses: kreuzberg-dev/actions/cleanup-rust-cache@v1 # v1
1041+
9071042
test-go:
9081043
needs: [build-ffi, changes]
9091044
name: "Test: Go"

0 commit comments

Comments
 (0)