Skip to content

Commit 235a3ee

Browse files
committed
Merge branch 'dev' into codex/refactor-bufferreader-and-bufferwriter-for-number-handling
2 parents 4d018cb + ce004d7 commit 235a3ee

File tree

187 files changed

+19636
-754
lines changed

Some content is hidden

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

187 files changed

+19636
-754
lines changed

.config/dotnet-tools.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"gitversion.tool": {
6+
"version": "6.4.0",
7+
"commands": [
8+
"dotnet-gitversion"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}

.github/workflows/ci.yml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,46 @@ jobs:
2222
run: dotnet restore LiteDB.sln
2323

2424
- name: Build
25-
run: dotnet build LiteDB.sln --configuration Release --no-restore
25+
run: dotnet build LiteDB.sln --configuration Release --no-restore /p:DefineConstants=TESTING
2626

2727
- name: Test
2828
timeout-minutes: 5
29-
run: dotnet test LiteDB.sln --configuration Release --no-build --verbosity normal --settings tests.runsettings --logger "trx;LogFileName=TestResults.trx" --logger "console;verbosity=detailed"
29+
run: dotnet test LiteDB.sln --configuration Release --no-build --verbosity normal --settings tests.runsettings --logger "trx;LogFileName=TestResults.trx" --logger "console;verbosity=detailed" /p:DefineConstants=TESTING
30+
31+
repro-runner:
32+
runs-on: ubuntu-latest
33+
needs: build
34+
35+
steps:
36+
- name: Check out repository
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Set up .NET SDK
42+
uses: actions/setup-dotnet@v4
43+
with:
44+
dotnet-version: 8.0.x
45+
46+
- name: Restore
47+
run: dotnet restore LiteDB.sln
48+
49+
- name: Build
50+
run: dotnet build LiteDB.sln --configuration Release --no-restore
51+
52+
- name: List repros
53+
run: dotnet run --project LiteDB.ReproRunner/LiteDB.ReproRunner.Cli -- list --strict
54+
55+
- name: Validate manifests
56+
run: dotnet run --project LiteDB.ReproRunner/LiteDB.ReproRunner.Cli -- validate
57+
58+
# Execute every repro and emit a JSON summary that downstream automation can inspect.
59+
- name: Run repro suite
60+
run: dotnet run --project LiteDB.ReproRunner/LiteDB.ReproRunner.Cli -- run --all --report repro-summary.json
61+
62+
# Publish the summary so other jobs or manual reviewers can review the latest outcomes.
63+
- name: Upload repro summary
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: repro-summary
67+
path: repro-summary.json

.github/workflows/publish-prerelease.yml

Lines changed: 63 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- dev
7+
paths:
8+
- 'LiteDB/**'
79

810
jobs:
911
publish:
@@ -22,28 +24,72 @@ jobs:
2224
with:
2325
dotnet-version: 8.0.x
2426

27+
- name: Restore .NET tools
28+
run: dotnet tool restore
29+
30+
- name: Compute semantic version
31+
id: gitversion
32+
shell: bash
33+
run: |
34+
set -euo pipefail
35+
JSON=$(dotnet tool run dotnet-gitversion /output json)
36+
echo "$JSON"
37+
38+
NUGET_VERSION=$(echo "$JSON" | jq -r '.NuGetVersion')
39+
FULL_SEMVER=$(echo "$JSON" | jq -r '.FullSemVer')
40+
SHORT_SHA=$(echo "$JSON" | jq -r '.ShortSha')
41+
MAJOR_MINOR_PATCH=$(echo "$JSON" | jq -r '.MajorMinorPatch')
42+
PR_LABEL=$(echo "$JSON" | jq -r '.PreReleaseLabel')
43+
PR_NUMBER=$(echo "$JSON" | jq -r '.PreReleaseNumber')
44+
45+
if [[ "$PR_LABEL" != "" && "$PR_LABEL" != "null" ]]; then
46+
printf -v PR_PADDED '%04d' "$PR_NUMBER"
47+
RELEASE_VERSION_PADDED="${MAJOR_MINOR_PATCH}-${PR_LABEL}.${PR_PADDED}"
48+
else
49+
RELEASE_VERSION_PADDED="$MAJOR_MINOR_PATCH"
50+
fi
51+
52+
echo "nugetVersion=$NUGET_VERSION" >> "$GITHUB_OUTPUT"
53+
echo "fullSemVer=$FULL_SEMVER" >> "$GITHUB_OUTPUT"
54+
echo "releaseVersionPadded=$RELEASE_VERSION_PADDED" >> "$GITHUB_OUTPUT"
55+
echo "informational=${NUGET_VERSION}+${SHORT_SHA}" >> "$GITHUB_OUTPUT"
56+
2557
- name: Restore
2658
run: dotnet restore LiteDB.sln
2759

28-
- name: Build
29-
run: dotnet build LiteDB.sln --configuration Release --no-restore
30-
3160
- name: Test
3261
timeout-minutes: 5
33-
run: dotnet test LiteDB.sln --configuration Release --no-build --verbosity normal --settings tests.runsettings --logger "trx;LogFileName=TestResults.trx" --logger "console;verbosity=detailed"
62+
run: dotnet test LiteDB.sln --configuration Release --verbosity normal --settings tests.runsettings --logger "trx;LogFileName=TestResults.trx" --logger "console;verbosity=detailed" /p:DefineConstants=TESTING
63+
64+
- name: Upload test results
65+
uses: actions/upload-artifact@v4
66+
if: always()
67+
with:
68+
name: test-results
69+
path: "**/*TestResults*.trx"
70+
71+
- name: Upload hang dumps (if any)
72+
uses: actions/upload-artifact@v4
73+
if: always()
74+
with:
75+
name: hangdumps
76+
path: |
77+
hangdumps
78+
**/TestResults/**/*.dmp
79+
if-no-files-found: ignore
80+
81+
- name: Build
82+
if: success()
83+
run: dotnet build LiteDB/LiteDB.csproj --configuration Release --no-restore /p:ContinuousIntegrationBuild=true
3484

3585
- name: Pack
36-
run: |
37-
dotnet pack LiteDB/LiteDB.csproj --configuration Release --no-build -o artifacts
86+
if: success()
87+
run: dotnet pack LiteDB/LiteDB.csproj --configuration Release --no-build -o artifacts /p:ContinuousIntegrationBuild=true
3888

39-
- name: Capture package version
40-
id: version
89+
# if delete all nuget packages which are named ``0.0.0-detached.nupkg`` (leftover from detached builds)
90+
- name: Clean up detached packages
4191
run: |
42-
PACKAGE_PATH=$(ls artifacts/LiteDB.*.nupkg | head -n 1)
43-
PACKAGE_FILENAME=$(basename "$PACKAGE_PATH")
44-
PACKAGE_VERSION=${PACKAGE_FILENAME#LiteDB.}
45-
PACKAGE_VERSION=${PACKAGE_VERSION%.nupkg}
46-
echo "package_version=${PACKAGE_VERSION}" >> "$GITHUB_OUTPUT"
92+
find artifacts -name "0.0.0-detached.nupkg" -delete
4793
4894
- name: Retrieve secrets from Bitwarden
4995
uses: bitwarden/sm-action@v2
@@ -54,16 +100,9 @@ jobs:
54100
265b2fb6-2cf0-4859-9bc8-b24c00ab4378 > NUGET_API_KEY
55101
56102
- name: Push package to NuGet
103+
if: success()
104+
env:
105+
PACKAGE_VERSION: ${{ steps.gitversion.outputs.nugetVersion }}
57106
run: |
107+
echo "Pushing LiteDB version $PACKAGE_VERSION"
58108
dotnet nuget push "artifacts/*.nupkg" --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate
59-
60-
- name: Publish GitHub prerelease
61-
uses: softprops/action-gh-release@v2
62-
with:
63-
tag_name: v${{ steps.version.outputs.package_version }}
64-
name: LiteDB ${{ steps.version.outputs.package_version }}
65-
generate_release_notes: true
66-
prerelease: true
67-
files: artifacts/*.nupkg
68-
env:
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
name: Publish release
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
tags:
8-
- v*
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: Branch, tag, or SHA to release from
8+
default: master
9+
required: true
10+
publish_nuget:
11+
description: Push packages to NuGet
12+
type: boolean
13+
default: false
14+
publish_github:
15+
description: Create or update GitHub release
16+
type: boolean
17+
default: false
918

1019
jobs:
1120
publish:
12-
if: startsWith(github.ref, 'refs/tags/v')
1321
runs-on: ubuntu-latest
1422
permissions:
1523
contents: write
@@ -19,36 +27,63 @@ jobs:
1927
uses: actions/checkout@v4
2028
with:
2129
fetch-depth: 0
30+
ref: ${{ inputs.ref }}
2231

2332
- name: Set up .NET SDK
2433
uses: actions/setup-dotnet@v4
2534
with:
2635
dotnet-version: 8.0.x
2736

37+
- name: Restore .NET tools
38+
run: dotnet tool restore
39+
40+
- name: Compute semantic version
41+
id: gitversion
42+
shell: bash
43+
run: |
44+
set -euo pipefail
45+
JSON=$(dotnet tool run dotnet-gitversion /output json)
46+
echo "$JSON"
47+
48+
NUGET_VERSION=$(echo "$JSON" | jq -r '.NuGetVersion')
49+
FULL_SEMVER=$(echo "$JSON" | jq -r '.FullSemVer')
50+
SHORT_SHA=$(echo "$JSON" | jq -r '.ShortSha')
51+
MAJOR_MINOR_PATCH=$(echo "$JSON" | jq -r '.MajorMinorPatch')
52+
PR_LABEL=$(echo "$JSON" | jq -r '.PreReleaseLabel')
53+
PR_NUMBER=$(echo "$JSON" | jq -r '.PreReleaseNumber')
54+
55+
if [[ "$PR_LABEL" != "" && "$PR_LABEL" != "null" ]]; then
56+
printf -v PR_PADDED '%04d' "$PR_NUMBER"
57+
RELEASE_VERSION_PADDED="${MAJOR_MINOR_PATCH}-${PR_LABEL}.${PR_PADDED}"
58+
else
59+
RELEASE_VERSION_PADDED="$MAJOR_MINOR_PATCH"
60+
fi
61+
62+
echo "nugetVersion=$NUGET_VERSION" >> "$GITHUB_OUTPUT"
63+
echo "fullSemVer=$FULL_SEMVER" >> "$GITHUB_OUTPUT"
64+
echo "releaseVersionPadded=$RELEASE_VERSION_PADDED" >> "$GITHUB_OUTPUT"
65+
echo "informational=${NUGET_VERSION}+${SHORT_SHA}" >> "$GITHUB_OUTPUT"
66+
2867
- name: Restore
2968
run: dotnet restore LiteDB.sln
3069

3170
- name: Build
32-
run: dotnet build LiteDB.sln --configuration Release --no-restore
71+
run: dotnet build LiteDB.sln --configuration Release --no-restore /p:ContinuousIntegrationBuild=true
3372

3473
- name: Test
35-
timeout-minutes: 5
74+
timeout-minutes: 8
3675
run: dotnet test LiteDB.sln --configuration Release --no-build --verbosity normal --settings tests.runsettings --logger "trx;LogFileName=TestResults.trx" --logger "console;verbosity=detailed"
3776

3877
- name: Pack
39-
run: |
40-
dotnet pack LiteDB/LiteDB.csproj --configuration Release --no-build -o artifacts
78+
run: dotnet pack LiteDB/LiteDB.csproj --configuration Release --no-build -o artifacts /p:ContinuousIntegrationBuild=true
4179

42-
- name: Capture package version
43-
id: version
80+
# if delete all nuget packages which are named ``0.0.0-detached.nupkg`` (leftover from detached builds)
81+
- name: Clean up detached packages
4482
run: |
45-
PACKAGE_PATH=$(ls artifacts/LiteDB.*.nupkg | head -n 1)
46-
PACKAGE_FILENAME=$(basename "$PACKAGE_PATH")
47-
PACKAGE_VERSION=${PACKAGE_FILENAME#LiteDB.}
48-
PACKAGE_VERSION=${PACKAGE_VERSION%.nupkg}
49-
echo "package_version=${PACKAGE_VERSION}" >> "$GITHUB_OUTPUT"
83+
find artifacts -name "0.0.0-detached.nupkg" -delete
5084
5185
- name: Retrieve secrets from Bitwarden
86+
if: ${{ inputs.publish_nuget }}
5287
uses: bitwarden/sm-action@v2
5388
with:
5489
access_token: ${{ secrets.BW_ACCESS_TOKEN }}
@@ -57,15 +92,21 @@ jobs:
5792
265b2fb6-2cf0-4859-9bc8-b24c00ab4378 > NUGET_API_KEY
5893
5994
- name: Push package to NuGet
95+
if: ${{ inputs.publish_nuget }}
96+
env:
97+
PACKAGE_VERSION: ${{ steps.gitversion.outputs.nugetVersion }}
6098
run: |
99+
echo "Pushing LiteDB version $PACKAGE_VERSION"
61100
dotnet nuget push "artifacts/*.nupkg" --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate
62101
63102
- name: Publish GitHub release
103+
if: ${{ inputs.publish_github }}
64104
uses: softprops/action-gh-release@v2
65105
with:
66-
tag_name: v${{ steps.version.outputs.package_version }}
67-
name: LiteDB ${{ steps.version.outputs.package_version }}
106+
tag_name: v${{ steps.gitversion.outputs.releaseVersionPadded }}
107+
name: LiteDB ${{ steps.gitversion.outputs.releaseVersionPadded }}
68108
generate_release_notes: true
69109
files: artifacts/*.nupkg
110+
target_commitish: ${{ github.sha }}
70111
env:
71112
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)