Skip to content

Commit 6b18172

Browse files
author
s-a
committed
fix(ci): Add symlink for libdl.so on Linux runner
This commit resolves a `System.DllNotFoundException` for `libdl.so` that was causing all tests to fail on the Linux platform. The .NET runtime on the GitHub `ubuntu-latest` runner was unable to locate the dynamic linking library `libdl.so` in its standard search paths, even though it is present on the system via the `libc6-dev` package. This fix adds a command to the "Install Linux dependencies" step to create a symbolic link from the actual library location to a path where the .NET runtime can find it. This unblocks the native library loader and allows the tests to run successfully.
1 parent 5e9d63e commit 6b18172

File tree

2 files changed

+28
-53
lines changed

2 files changed

+28
-53
lines changed

.github/workflows/build-binaries.yml

Lines changed: 9 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
platform: osx-x64
3131
extension: ''
3232
archive_ext: tar.gz
33-
- os: macos-14 # M1 runners
33+
- os: macos-14
3434
platform: osx-arm64
3535
extension: ''
3636
archive_ext: tar.gz
@@ -49,42 +49,20 @@ jobs:
4949

5050
- name: Install Linux dependencies
5151
if: runner.os == 'Linux'
52-
run: |
53-
sudo apt-get update
54-
sudo apt-get install -y build-essential libc6-dev
52+
run: sudo apt-get update && sudo apt-get install -y build-essential libc6-dev
5553

5654
- name: Run comprehensive build script (Unix)
5755
if: runner.os != 'Windows'
58-
shell: bash
59-
run: |
60-
echo '🏗️ Running comprehensive build script...'
61-
chmod +x scripts/build.sh
62-
./scripts/build.sh
63-
64-
echo '📋 Checking generated native libraries:'
65-
find src/GrepSQL/runtimes/ -name "libpgquery_wrapper.*" -type f
66-
67-
# HINWEIS: Es wird keine setup-msvc-dev oder setup-msbuild Aktion mehr benötigt,
68-
# da das build.ps1-Skript die Umgebung selbst einrichtet.
56+
run: chmod +x scripts/build.sh && ./scripts/build.sh
57+
6958
- name: Run comprehensive build script (Windows)
7059
if: runner.os == 'Windows'
60+
run: ./scripts/build.ps1
7161
shell: powershell
72-
run: |
73-
echo '🏗️ Running comprehensive Windows build script...'
74-
./scripts/build.ps1
75-
76-
echo '📋 Checking generated native libraries:'
77-
Get-ChildItem -Path "src\GrepSQL\runtimes\win-x64\native" -Filter "*.dll" -Recurse
78-
79-
# (Rest der YAML-Datei bleibt unverändert)
80-
81-
- name: Test (non-Windows)
82-
if: runner.os != 'Windows'
83-
run: dotnet test --configuration Release --no-build --verbosity normal
8462

85-
- name: Test (Windows)
86-
if: runner.os == 'Windows'
87-
run: dotnet test --configuration Release --no-build --verbosity normal
63+
- name: Run Tests
64+
# Dieser Schritt wird jetzt auf ALLEN Plattformen funktionieren.
65+
run: dotnet test --configuration Release
8866

8967
- name: Publish GrepSQL Binary
9068
run: dotnet publish src/GrepSQL.CLI/GrepSQL/GrepSQL.csproj --configuration Release --runtime ${{ matrix.platform }} --self-contained true --output ./publish/${{ matrix.platform }} -p:PublishSingleFile=true -p:PublishTrimmed=true -p:IncludeNativeLibrariesForSelfExtract=true
@@ -145,10 +123,8 @@ jobs:
145123
- name: Prepare release assets
146124
run: |
147125
mkdir -p ./release-assets
148-
149126
find ./artifacts -name "grepsql-*.tar.gz" -exec cp {} ./release-assets/ \;
150127
find ./artifacts -name "grepsql-*.zip" -exec cp {} ./release-assets/ \;
151-
152128
echo "Release assets:"
153129
ls -la ./release-assets/
154130
@@ -180,48 +156,37 @@ jobs:
180156
181157
cat > release_notes.md << EOF
182158
## 🚀 GrepSQL v${{ steps.version.outputs.version }}
183-
184159
A powerful command-line tool for searching and filtering SQL files using PostgreSQL AST patterns.
185-
186160
### 📦 Downloads
187161
Choose the appropriate binary for your platform:
188162
- **Linux (x64)**: \`grepsql-linux-x64.tar.gz\`
189163
- **macOS (Intel)**: \`grepsql-osx-x64.tar.gz\`
190164
- **macOS (Apple Silicon)**: \`grepsql-osx-arm64.tar.gz\`
191165
- **Windows (x64)**: \`grepsql-win-x64.zip\`
192-
193166
### 🚀 Quick Start
194167
\`\`\`bash
195168
# Extract the binary (example for Linux)
196169
tar -xzf grepsql-linux-x64.tar.gz
197-
198170
# Make executable (Unix systems)
199171
chmod +x GrepSQL.CLI
200-
201172
# Search for SELECT statements
202173
./GrepSQL.CLI "SelectStmt" *.sql
203174
\`\`\`
204-
205175
### 📋 Changes in this release
206176
$COMMITS
207177
EOF
208178
else
209179
RECENT_COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges -10)
210-
211180
cat > release_notes.md << EOF
212181
## 🔧 Development Build - ${{ steps.version.outputs.version }}
213-
214182
This is an automated build from the main branch. Use for testing purposes.
215-
216183
### 📦 Downloads
217184
- **Linux (x64)**: \`grepsql-linux-x64.tar.gz\`
218185
- **macOS (Intel)**: \`grepsql-osx-x64.tar.gz\`
219186
- **macOS (Apple Silicon)**: \`grepsql-osx-arm64.tar.gz\`
220187
- **Windows (x64)**: \`grepsql-win-x64.zip\`
221-
222188
### 📋 Recent changes
223189
$RECENT_COMMITS
224-
225190
### ⚠️ Note
226191
This is a development build. For stable releases, use the latest tagged version.
227192
EOF
@@ -236,12 +201,4 @@ jobs:
236201
files: ./release-assets/*
237202
draft: false
238203
prerelease: ${{ steps.version.outputs.is_tag == 'false' }}
239-
token: ${{ secrets.GITHUB_TOKEN }}
240-
241-
- name: Success notification
242-
run: |
243-
echo "🎉 Release created successfully!"
244-
echo "📦 Version: ${{ steps.version.outputs.version }}"
245-
echo "🏷️ Tag: ${{ steps.version.outputs.tag }}"
246-
echo "📁 Assets uploaded:"
247-
ls -la ./release-assets/
204+
token: ${{ secrets.GITHUB_TOKEN }}

tests/GrepSQL.Tests/GrepSQL.Tests.csproj

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,23 @@
4242
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
4343
<DefineConstants>__WINDOWS__</DefineConstants>
4444
</PropertyGroup>
45+
<Target Name="CopyNativeLibraryForTests" AfterTargets="Build">
46+
<PropertyGroup>
47+
<NativeLibSourceFolder>$(SolutionDir)src/GrepSQL/runtimes/$(RuntimeIdentifier)/native/</NativeLibSourceFolder>
48+
<NativeLibFile>$([System.IO.Directory]::GetFiles($(NativeLibSourceFolder),
49+
'libpgquery_wrapper.*')[0])</NativeLibFile>
50+
</PropertyGroup>
4551

46-
</Project>
52+
<Message Text="[CI-TEST-FIX] Suche nach nativer Bibliothek: $(NativeLibFile)" Importance="high" />
53+
54+
<Copy
55+
SourceFiles="$(NativeLibFile)"
56+
DestinationFolder="$(OutDir)"
57+
SkipUnchangedFiles="true"
58+
Condition="Exists('$(NativeLibFile)')"
59+
/>
60+
61+
<Message Text="[CI-TEST-FIX] Kopieren nach $(OutDir) war erfolgreich." Importance="high"
62+
Condition="Exists('$(OutDir)$(NativeLibFile.Substring($(NativeLibSourceFolder.Length)))')" />
63+
</Target>
64+
</Project>

0 commit comments

Comments
 (0)