-
Notifications
You must be signed in to change notification settings - Fork 0
371 lines (315 loc) · 13.4 KB
/
dotnet.yml
File metadata and controls
371 lines (315 loc) · 13.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
name: FastFind.NET Build & Deploy
on:
# Manual trigger - Always available for direct execution
workflow_dispatch:
inputs:
push_to_nuget:
description: 'Push packages to NuGet (even without version tag)'
required: false
default: false
type: boolean
# Automatic trigger - Only when version changes or workflow updates
push:
branches: [ "main" ]
paths:
- 'src/Directory.Build.props' # Version changes trigger deployment
- '.github/workflows/**' # Workflow updates
# Pull request validation - Build validation only (tests run locally)
pull_request:
branches: [ "main" ]
paths:
- 'src/**'
- '.github/workflows/**'
env:
DOTNET_VERSION: '10.0.x'
SOLUTION_PATH: 'src/FastFind.sln'
jobs:
# 🔍 PR 빌드 검증
validate:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/Directory.Packages.props', '**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore ${{ env.SOLUTION_PATH }}
- name: Build solution
run: dotnet build ${{ env.SOLUTION_PATH }} --configuration Release --no-restore
# 🐧 Linux 테스트 (PR + push to main)
test-linux:
runs-on: ubuntu-latest
if: >
github.event_name == 'pull_request' ||
(github.event_name == 'push' && github.ref == 'refs/heads/main')
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/Directory.Packages.props', '**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Build Unix Tests
run: dotnet build src/FastFind.Unix.Tests/FastFind.Unix.Tests.csproj --configuration Release
- name: Run Linux Tests
run: dotnet test src/FastFind.Unix.Tests/FastFind.Unix.Tests.csproj --configuration Release --no-build --logger "trx;LogFileName=test-results.trx" --results-directory ./test-results
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: linux-test-results
path: ./test-results/
# 🍎 macOS 테스트 (수동 트리거 전용 — 비용 최소화)
test-macos:
runs-on: macos-latest
if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/Directory.Packages.props', '**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Build Unix Tests
run: dotnet build src/FastFind.Unix.Tests/FastFind.Unix.Tests.csproj --configuration Release
- name: Run macOS Tests
run: dotnet test src/FastFind.Unix.Tests/FastFind.Unix.Tests.csproj --configuration Release --no-build --filter "Category!=Performance" --logger "trx;LogFileName=test-results.trx" --results-directory ./test-results
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: macos-test-results
path: ./test-results/
# 🐳 Linux 호환성 테스트 (수동 트리거 전용)
test-linux-compat:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
strategy:
matrix:
container: ['mcr.microsoft.com/dotnet/sdk:10.0']
container:
image: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
- name: Build & Test
run: |
dotnet build src/FastFind.Unix.Tests/FastFind.Unix.Tests.csproj --configuration Release
dotnet test src/FastFind.Unix.Tests/FastFind.Unix.Tests.csproj --configuration Release --no-build
# 📦 빌드 및 배포 (테스트는 로컬에서만 수행)
pack-and-publish:
runs-on: ubuntu-latest
if: >
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) ||
(github.event_name == 'workflow_dispatch')
strategy:
matrix:
project:
- path: 'src/FastFind/FastFind.csproj'
name: 'FastFind.Core'
- path: 'src/FastFind.Windows/FastFind.Windows.csproj'
name: 'FastFind.Windows'
- path: 'src/FastFind.SQLite/FastFind.SQLite.csproj'
name: 'FastFind.SQLite'
- path: 'src/FastFind.Unix/FastFind.Unix.csproj'
name: 'FastFind.Unix'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for version comparison
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/Directory.Packages.props', '**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore ${{ env.SOLUTION_PATH }}
- name: Build ${{ matrix.project.name }}
run: dotnet build ${{ matrix.project.path }} --configuration Release --no-restore
- name: Pack ${{ matrix.project.name }}
run: dotnet pack ${{ matrix.project.path }} --configuration Release --no-build --output nupkg
- name: List generated packages
run: ls -la nupkg/
- name: Validate package
run: |
for package in nupkg/*.nupkg; do
echo "Validating package: $package"
dotnet nuget verify "$package" || echo "Package verification failed for $package"
done
- name: Extract Version from Directory.Build.props
id: version
run: |
# Extract current version from Directory.Build.props
CURRENT_VERSION=$(grep -oP '<Version>\K[^<]+' src/Directory.Build.props || echo "1.0.0")
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
echo "📦 Current version: ${CURRENT_VERSION}"
# Create version tag format
echo "VERSION_TAG=v${CURRENT_VERSION}" >> $GITHUB_OUTPUT
- name: Check Version Change and Deploy Conditions
id: deploy_check
run: |
CURRENT_VERSION="${{ steps.version.outputs.CURRENT_VERSION }}"
VERSION_CHANGED="false"
SHOULD_DEPLOY="false"
REASON="no_trigger"
echo "🔍 Checking deployment conditions..."
# Check if Directory.Build.props was changed in this push
if [ "${{ github.event_name }}" == "push" ] && [ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]; then
if git diff --name-only ${{ github.event.before }}..${{ github.sha }} | grep -q "src/Directory.Build.props"; then
echo "✅ Directory.Build.props was changed in this push"
VERSION_CHANGED="true"
# Get previous version for comparison
PREVIOUS_VERSION=$(git show ${{ github.event.before }}:src/Directory.Build.props | grep -oP '<Version>\K[^<]+' || echo "0.0.0")
echo "📊 Previous version: ${PREVIOUS_VERSION}"
echo "📊 Current version: ${CURRENT_VERSION}"
if [ "${PREVIOUS_VERSION}" != "${CURRENT_VERSION}" ]; then
echo "🚀 Version changed from ${PREVIOUS_VERSION} to ${CURRENT_VERSION}"
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
SHOULD_DEPLOY="true"
REASON="version_change_on_main"
else
echo "⚠️ Version changed but not on main branch"
REASON="version_change_not_main"
fi
else
echo "ℹ️ Directory.Build.props changed but version remained the same"
REASON="props_change_no_version"
fi
else
echo "ℹ️ Directory.Build.props was not changed"
fi
fi
# Manual trigger override
if [ "${{ github.event.inputs.push_to_nuget }}" == "true" ]; then
echo "🔧 Manual deployment trigger activated"
SHOULD_DEPLOY="true"
REASON="manual_trigger"
fi
# Check if version already exists on NuGet (optional - can be enabled later)
# We'll skip this for now to allow re-publishing same version if needed
echo "SHOULD_DEPLOY=${SHOULD_DEPLOY}" >> $GITHUB_OUTPUT
echo "REASON=${REASON}" >> $GITHUB_OUTPUT
echo "VERSION_CHANGED=${VERSION_CHANGED}" >> $GITHUB_OUTPUT
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
echo "📋 Deployment Decision:"
echo " Should Deploy: ${SHOULD_DEPLOY}"
echo " Reason: ${REASON}"
echo " Version: ${CURRENT_VERSION}"
- name: Push ${{ matrix.project.name }} to NuGet
if: steps.deploy_check.outputs.SHOULD_DEPLOY == 'true'
run: |
echo "🚀 Deploying ${{ matrix.project.name }} v${{ steps.deploy_check.outputs.CURRENT_VERSION }} to NuGet"
echo "📋 Reason: ${{ steps.deploy_check.outputs.REASON }}"
echo "📦 Packages in nupkg/:"
ls -la nupkg/
echo "📤 Pushing to NuGet..."
dotnet nuget push ./nupkg/*.nupkg \
--source https://api.nuget.org/v3/index.json \
--api-key ${{ secrets.NUGET_API_KEY }} \
--skip-duplicate \
--no-symbols
echo "✅ NuGet deployment completed for ${{ matrix.project.name }} v${{ steps.deploy_check.outputs.CURRENT_VERSION }}"
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: nuget-packages-${{ matrix.project.name }}
path: nupkg/*.nupkg
retention-days: 30
create-release:
needs: [pack-and-publish]
runs-on: ubuntu-latest
if: needs.pack-and-publish.outputs.SHOULD_DEPLOY == 'true' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for changelog generation
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Get version info
id: version
run: |
if [ "${{ startsWith(github.ref, 'refs/tags/v') }}" == "true" ]; then
VERSION="${{ github.ref_name }}"
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
else
# Extract version from Directory.Build.props
VERSION=$(grep -oP '<Version>\K[^<]+' src/Directory.Build.props || echo "1.0.0")
echo "VERSION=v${VERSION}" >> $GITHUB_OUTPUT
fi
echo "Using version: ${VERSION}"
- name: Generate changelog
id: changelog
run: |
if [ "${{ steps.version.outputs.VERSION }}" != "$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo 'v0.0.0')" ]; then
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo 'HEAD~10')
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
echo "### 📋 Changes from ${PREVIOUS_TAG}" >> $GITHUB_OUTPUT
git log ${PREVIOUS_TAG}..HEAD --oneline --pretty=format:'- %s (%h)' >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
echo "CHANGELOG=### 📋 Changes\nSee commit history for details." >> $GITHUB_OUTPUT
fi
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.VERSION }}
name: FastFind.NET ${{ steps.version.outputs.VERSION }}
body: |
## FastFind.NET ${{ steps.version.outputs.VERSION }}
### 📦 Published Packages
- **FastFind.Core**: Core interfaces, models, cross-platform SIMD string matching
- **FastFind.Windows**: Windows-optimized implementation (MFT, USN Journal)
- **FastFind.Unix**: Linux implementation (Channel BFS, inotify)
- **FastFind.SQLite**: SQLite persistence with FTS5 full-text search
### 🚀 Key Features
- Cross-platform SIMD string matching (Vector256/Vector128 auto-dispatch)
- Memory-optimized string pooling (60-80% reduction)
- Real-time file system monitoring (USN Journal / inotify)
- Windows: NTFS MFT direct access (31K+ files/sec)
- Linux: Channel-based BFS parallel enumeration
- SQLite persistence with FTS5 full-text search
${{ steps.changelog.outputs.CHANGELOG }}
### 📥 Installation
```bash
# Core package
dotnet add package FastFind.Core
# Windows implementation
dotnet add package FastFind.Windows
# SQLite persistence
dotnet add package FastFind.SQLite
```
draft: false
prerelease: ${{ contains(steps.version.outputs.VERSION, '-') }}
files: artifacts/**/*.nupkg
generate_release_notes: true
make_latest: ${{ !contains(steps.version.outputs.VERSION, '-') }}