Skip to content

Commit 7c6b8e9

Browse files
fixes
1 parent 3fd025f commit 7c6b8e9

File tree

2 files changed

+58
-273
lines changed

2 files changed

+58
-273
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 252 deletions
Original file line numberDiff line numberDiff line change
@@ -76,39 +76,9 @@ jobs:
7676
dotnet build DataProvider/Nimblesite.DataProvider.SQLite.Cli -c Debug
7777
7878
- name: Test DataProvider (with coverage enforcement)
79-
run: |
80-
for proj in DataProvider/Nimblesite.DataProvider.Tests DataProvider/Nimblesite.DataProvider.Example.Tests; do
81-
THRESHOLD=$(jq -r ".projects[\"$proj\"].threshold // .default_threshold" coverage-thresholds.json)
82-
INCLUDE=$(jq -r ".projects[\"$proj\"].include // empty" coverage-thresholds.json)
83-
echo "==> Testing $proj (threshold: ${THRESHOLD}%)"
84-
rm -rf "$proj/TestResults"
85-
if [ -n "$INCLUDE" ]; then
86-
dotnet test "$proj" --configuration Release \
87-
--settings coverlet.runsettings \
88-
--collect:"XPlat Code Coverage" \
89-
--results-directory "$proj/TestResults" \
90-
--verbosity normal \
91-
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Include="$INCLUDE"
92-
else
93-
dotnet test "$proj" --configuration Release \
94-
--settings coverlet.runsettings \
95-
--collect:"XPlat Code Coverage" \
96-
--results-directory "$proj/TestResults" \
97-
--verbosity normal
98-
fi
99-
COBERTURA=$(find "$proj/TestResults" -name "coverage.cobertura.xml" -type f | head -1)
100-
if [ -z "$COBERTURA" ]; then echo "FAIL: No coverage file for $proj"; exit 1; fi
101-
LINE_RATE=$(sed -n 's/.*line-rate="\([0-9.]*\)".*/\1/p' "$COBERTURA" | head -1)
102-
COVERAGE=$(echo "$LINE_RATE * 100" | bc -l)
103-
COVERAGE_FMT=$(printf "%.2f" $COVERAGE)
104-
echo " Coverage: ${COVERAGE_FMT}% | Threshold: ${THRESHOLD}%"
105-
BELOW=$(echo "$COVERAGE < $THRESHOLD" | bc -l)
106-
if [ "$BELOW" = "1" ]; then
107-
echo " FAIL: ${COVERAGE_FMT}% is BELOW threshold ${THRESHOLD}%"
108-
exit 1
109-
fi
110-
echo " PASS"
111-
done
79+
run: >-
80+
make _test_dotnet DOTNET_TEST_PROJECTS="DataProvider/Nimblesite.DataProvider.Tests
81+
DataProvider/Nimblesite.DataProvider.Example.Tests"
11282
11383
- name: Upload test results
11484
uses: actions/upload-artifact@v4
@@ -178,196 +148,22 @@ jobs:
178148
- name: Build Rust
179149
run: cd Lql/lql-lsp-rust && cargo build
180150

181-
- name: Test LQL .NET (with coverage enforcement)
182-
run: |
183-
for proj in Lql/Nimblesite.Lql.Tests; do
184-
THRESHOLD=$(jq -r ".projects[\"$proj\"].threshold // .default_threshold" coverage-thresholds.json)
185-
INCLUDE=$(jq -r ".projects[\"$proj\"].include // empty" coverage-thresholds.json)
186-
echo "==> Testing $proj (threshold: ${THRESHOLD}%)"
187-
rm -rf "$proj/TestResults"
188-
if [ -n "$INCLUDE" ]; then
189-
dotnet test "$proj" --configuration Release \
190-
--settings coverlet.runsettings \
191-
--collect:"XPlat Code Coverage" \
192-
--results-directory "$proj/TestResults" \
193-
--verbosity normal \
194-
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Include="$INCLUDE"
195-
else
196-
dotnet test "$proj" --configuration Release \
197-
--settings coverlet.runsettings \
198-
--collect:"XPlat Code Coverage" \
199-
--results-directory "$proj/TestResults" \
200-
--verbosity normal
201-
fi
202-
COBERTURA=$(find "$proj/TestResults" -name "coverage.cobertura.xml" -type f | head -1)
203-
if [ -z "$COBERTURA" ]; then echo "FAIL: No coverage file for $proj"; exit 1; fi
204-
LINE_RATE=$(sed -n 's/.*line-rate="\([0-9.]*\)".*/\1/p' "$COBERTURA" | head -1)
205-
COVERAGE=$(echo "$LINE_RATE * 100" | bc -l)
206-
COVERAGE_FMT=$(printf "%.2f" $COVERAGE)
207-
echo " Coverage: ${COVERAGE_FMT}% | Threshold: ${THRESHOLD}%"
208-
BELOW=$(echo "$COVERAGE < $THRESHOLD" | bc -l)
209-
if [ "$BELOW" = "1" ]; then
210-
echo " FAIL: ${COVERAGE_FMT}% is BELOW threshold ${THRESHOLD}%"
211-
exit 1
212-
fi
213-
echo " PASS"
214-
done
215-
216-
- name: Test LQL F# Type Provider (with coverage enforcement)
217-
run: |
218-
proj="Lql/Nimblesite.Lql.TypeProvider.FSharp.Tests"
219-
THRESHOLD=$(jq -r ".projects[\"$proj\"].threshold // .default_threshold" coverage-thresholds.json)
220-
INCLUDE=$(jq -r ".projects[\"$proj\"].include // empty" coverage-thresholds.json)
221-
echo "==> Testing $proj (threshold: ${THRESHOLD}%)"
222-
rm -rf "$proj/TestResults"
223-
if [ -n "$INCLUDE" ]; then
224-
dotnet test "$proj" --configuration Release \
225-
--settings coverlet.runsettings \
226-
--collect:"XPlat Code Coverage" \
227-
--results-directory "$proj/TestResults" \
228-
--verbosity normal \
229-
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Include="$INCLUDE"
230-
else
231-
dotnet test "$proj" --configuration Release \
232-
--settings coverlet.runsettings \
233-
--collect:"XPlat Code Coverage" \
234-
--results-directory "$proj/TestResults" \
235-
--verbosity normal
236-
fi
237-
COBERTURA=$(find "$proj/TestResults" -name "coverage.cobertura.xml" -type f | head -1)
238-
if [ -z "$COBERTURA" ]; then echo "FAIL: No coverage file for $proj"; exit 1; fi
239-
LINE_RATE=$(sed -n 's/.*line-rate="\([0-9.]*\)".*/\1/p' "$COBERTURA" | head -1)
240-
COVERAGE=$(echo "$LINE_RATE * 100" | bc -l)
241-
COVERAGE_FMT=$(printf "%.2f" $COVERAGE)
242-
echo " Coverage: ${COVERAGE_FMT}% | Threshold: ${THRESHOLD}%"
243-
BELOW=$(echo "$COVERAGE < $THRESHOLD" | bc -l)
244-
if [ "$BELOW" = "1" ]; then
245-
echo " FAIL: ${COVERAGE_FMT}% is BELOW threshold ${THRESHOLD}%"
246-
exit 1
247-
fi
248-
echo " PASS"
249-
250-
- name: Test LQL Rust (with coverage enforcement)
251-
run: |
252-
THRESHOLD=$(jq -r '.projects["Lql/lql-lsp-rust"].threshold // .default_threshold' coverage-thresholds.json)
253-
echo "==> Testing Lql/lql-lsp-rust (threshold: ${THRESHOLD}%)"
254-
cd Lql/lql-lsp-rust && cargo tarpaulin --workspace --skip-clean 2>&1 | tee /tmp/_dp_tarpaulin_out.txt
255-
COVERAGE=$(grep -oE '[0-9]+\.[0-9]+% coverage' /tmp/_dp_tarpaulin_out.txt | tail -1 | grep -oE '[0-9]+\.[0-9]+')
256-
if [ -z "$COVERAGE" ]; then echo "FAIL: Could not parse tarpaulin coverage"; exit 1; fi
257-
echo " Coverage: ${COVERAGE}% | Threshold: ${THRESHOLD}%"
258-
BELOW=$(echo "$COVERAGE < $THRESHOLD" | bc -l)
259-
if [ "$BELOW" = "1" ]; then
260-
echo " FAIL: ${COVERAGE}% is BELOW threshold ${THRESHOLD}%"
261-
exit 1
262-
fi
263-
echo " PASS"
264-
265-
- name: Test Migration (with coverage enforcement)
266-
run: |
267-
proj="Migration/Nimblesite.DataProvider.Migration.Tests"
268-
THRESHOLD=$(jq -r ".projects[\"$proj\"].threshold // .default_threshold" coverage-thresholds.json)
269-
INCLUDE=$(jq -r ".projects[\"$proj\"].include // empty" coverage-thresholds.json)
270-
echo "==> Testing $proj (threshold: ${THRESHOLD}%)"
271-
rm -rf "$proj/TestResults"
272-
if [ -n "$INCLUDE" ]; then
273-
dotnet test "$proj" --configuration Release \
274-
--settings coverlet.runsettings \
275-
--collect:"XPlat Code Coverage" \
276-
--results-directory "$proj/TestResults" \
277-
--verbosity normal \
278-
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Include="$INCLUDE"
279-
else
280-
dotnet test "$proj" --configuration Release \
281-
--settings coverlet.runsettings \
282-
--collect:"XPlat Code Coverage" \
283-
--results-directory "$proj/TestResults" \
284-
--verbosity normal
285-
fi
286-
COBERTURA=$(find "$proj/TestResults" -name "coverage.cobertura.xml" -type f | head -1)
287-
if [ -z "$COBERTURA" ]; then echo "FAIL: No coverage file for $proj"; exit 1; fi
288-
LINE_RATE=$(sed -n 's/.*line-rate="\([0-9.]*\)".*/\1/p' "$COBERTURA" | head -1)
289-
COVERAGE=$(echo "$LINE_RATE * 100" | bc -l)
290-
COVERAGE_FMT=$(printf "%.2f" $COVERAGE)
291-
echo " Coverage: ${COVERAGE_FMT}% | Threshold: ${THRESHOLD}%"
292-
BELOW=$(echo "$COVERAGE < $THRESHOLD" | bc -l)
293-
if [ "$BELOW" = "1" ]; then
294-
echo " FAIL: ${COVERAGE_FMT}% is BELOW threshold ${THRESHOLD}%"
295-
exit 1
296-
fi
297-
echo " PASS"
298-
299-
- name: Test Sync SQLite (with coverage enforcement)
300-
run: |
301-
for proj in Sync/Nimblesite.Sync.Tests Sync/Nimblesite.Sync.SQLite.Tests; do
302-
THRESHOLD=$(jq -r ".projects[\"$proj\"].threshold // .default_threshold" coverage-thresholds.json)
303-
INCLUDE=$(jq -r ".projects[\"$proj\"].include // empty" coverage-thresholds.json)
304-
echo "==> Testing $proj (threshold: ${THRESHOLD}%)"
305-
rm -rf "$proj/TestResults"
306-
if [ -n "$INCLUDE" ]; then
307-
dotnet test "$proj" --configuration Release \
308-
--settings coverlet.runsettings \
309-
--collect:"XPlat Code Coverage" \
310-
--results-directory "$proj/TestResults" \
311-
--verbosity normal \
312-
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Include="$INCLUDE"
313-
else
314-
dotnet test "$proj" --configuration Release \
315-
--settings coverlet.runsettings \
316-
--collect:"XPlat Code Coverage" \
317-
--results-directory "$proj/TestResults" \
318-
--verbosity normal
319-
fi
320-
COBERTURA=$(find "$proj/TestResults" -name "coverage.cobertura.xml" -type f | head -1)
321-
if [ -z "$COBERTURA" ]; then echo "FAIL: No coverage file for $proj"; exit 1; fi
322-
LINE_RATE=$(sed -n 's/.*line-rate="\([0-9.]*\)".*/\1/p' "$COBERTURA" | head -1)
323-
COVERAGE=$(echo "$LINE_RATE * 100" | bc -l)
324-
COVERAGE_FMT=$(printf "%.2f" $COVERAGE)
325-
echo " Coverage: ${COVERAGE_FMT}% | Threshold: ${THRESHOLD}%"
326-
BELOW=$(echo "$COVERAGE < $THRESHOLD" | bc -l)
327-
if [ "$BELOW" = "1" ]; then
328-
echo " FAIL: ${COVERAGE_FMT}% is BELOW threshold ${THRESHOLD}%"
329-
exit 1
330-
fi
331-
echo " PASS"
332-
done
333-
334-
- name: Test Sync Postgres (with coverage enforcement)
335-
run: |
336-
for proj in Sync/Nimblesite.Sync.Postgres.Tests Sync/Nimblesite.Sync.Integration.Tests Sync/Nimblesite.Sync.Http.Tests; do
337-
THRESHOLD=$(jq -r ".projects[\"$proj\"].threshold // .default_threshold" coverage-thresholds.json)
338-
INCLUDE=$(jq -r ".projects[\"$proj\"].include // empty" coverage-thresholds.json)
339-
echo "==> Testing $proj (threshold: ${THRESHOLD}%)"
340-
rm -rf "$proj/TestResults"
341-
if [ -n "$INCLUDE" ]; then
342-
dotnet test "$proj" --configuration Release \
343-
--settings coverlet.runsettings \
344-
--collect:"XPlat Code Coverage" \
345-
--results-directory "$proj/TestResults" \
346-
--verbosity normal \
347-
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Include="$INCLUDE"
348-
else
349-
dotnet test "$proj" --configuration Release \
350-
--settings coverlet.runsettings \
351-
--collect:"XPlat Code Coverage" \
352-
--results-directory "$proj/TestResults" \
353-
--verbosity normal
354-
fi
355-
COBERTURA=$(find "$proj/TestResults" -name "coverage.cobertura.xml" -type f | head -1)
356-
if [ -z "$COBERTURA" ]; then echo "FAIL: No coverage file for $proj"; exit 1; fi
357-
LINE_RATE=$(sed -n 's/.*line-rate="\([0-9.]*\)".*/\1/p' "$COBERTURA" | head -1)
358-
COVERAGE=$(echo "$LINE_RATE * 100" | bc -l)
359-
COVERAGE_FMT=$(printf "%.2f" $COVERAGE)
360-
echo " Coverage: ${COVERAGE_FMT}% | Threshold: ${THRESHOLD}%"
361-
BELOW=$(echo "$COVERAGE < $THRESHOLD" | bc -l)
362-
if [ "$BELOW" = "1" ]; then
363-
echo " FAIL: ${COVERAGE_FMT}% is BELOW threshold ${THRESHOLD}%"
364-
exit 1
365-
fi
366-
echo " PASS"
367-
done
151+
- name: Test LQL + Migration + Sync (with coverage enforcement)
152+
run: >-
153+
make _test_dotnet DOTNET_TEST_PROJECTS="Lql/Nimblesite.Lql.Tests
154+
Lql/Nimblesite.Lql.TypeProvider.FSharp.Tests
155+
Migration/Nimblesite.DataProvider.Migration.Tests
156+
Sync/Nimblesite.Sync.Tests
157+
Sync/Nimblesite.Sync.SQLite.Tests
158+
Sync/Nimblesite.Sync.Postgres.Tests
159+
Sync/Nimblesite.Sync.Integration.Tests
160+
Sync/Nimblesite.Sync.Http.Tests"
368161
env:
369162
TESTCONTAINERS_RYUK_DISABLED: false
370163

164+
- name: Test LQL Rust (with coverage enforcement)
165+
run: make _test_rust
166+
371167
- name: Upload test results
372168
uses: actions/upload-artifact@v4
373169
if: always()
@@ -380,9 +176,6 @@ jobs:
380176
name: LQL Extension Tests
381177
runs-on: ubuntu-latest
382178
timeout-minutes: 10
383-
defaults:
384-
run:
385-
working-directory: Lql/LqlExtension
386179
steps:
387180
- uses: actions/checkout@v4
388181

@@ -392,35 +185,10 @@ jobs:
392185
node-version: '20'
393186

394187
- name: Install dependencies
395-
run: npm install --no-audit --no-fund
396-
397-
- name: Run tests with coverage
398-
run: |
399-
npm run compile
400-
rm -rf out-cov && npx nyc instrument out out-cov && rm -rf out && mv out-cov out
401-
xvfb-run -a node ./out/test/runTest.js
402-
npx nyc report --reporter=json-summary --reporter=text
188+
run: cd Lql/LqlExtension && npm install --no-audit --no-fund
403189

404-
- name: Enforce coverage threshold
405-
working-directory: .
406-
run: |
407-
THRESHOLD=$(jq -r '.projects["Lql/LqlExtension"].threshold // .default_threshold' coverage-thresholds.json)
408-
SUMMARY="Lql/LqlExtension/coverage/coverage-summary.json"
409-
if [ ! -f "$SUMMARY" ]; then
410-
SUMMARY="Lql/LqlExtension/.nyc_output/coverage-summary.json"
411-
fi
412-
if [ ! -f "$SUMMARY" ]; then
413-
echo "FAIL: No coverage summary produced for Lql/LqlExtension"
414-
exit 1
415-
fi
416-
COVERAGE=$(jq -r '.total.lines.pct' "$SUMMARY")
417-
echo " Coverage: ${COVERAGE}% | Threshold: ${THRESHOLD}%"
418-
BELOW=$(echo "$COVERAGE < $THRESHOLD" | bc -l)
419-
if [ "$BELOW" = "1" ]; then
420-
echo " FAIL: ${COVERAGE}% is BELOW threshold ${THRESHOLD}%"
421-
exit 1
422-
fi
423-
echo " PASS"
190+
- name: Test Extension (with coverage enforcement)
191+
run: make _test_ts
424192

425193
- name: Package VSIX (dry run)
426-
run: npm run compile && npx vsce package --no-git-tag-version --no-update-package-json
194+
run: cd Lql/LqlExtension && npm run compile && npx vsce package --no-git-tag-version --no-update-package-json

0 commit comments

Comments
 (0)