Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/build-container-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ on:
required: false
type: string
default: eventstore-test-image
image-artifact-name:
required: false
type: string
default: eventstore-image

jobs:
build-container:
Expand Down Expand Up @@ -62,6 +66,9 @@ jobs:
build-args: |
CONTAINER_RUNTIME=${{ inputs.container-runtime }}
RUNTIME=${{ inputs.runtime }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
cache-from: type=gha,scope=${{ format('container-{0}-{1}', inputs.container-runtime, inputs.runtime) }}
cache-to: type=gha,mode=max,scope=${{ format('container-{0}-{1}', inputs.container-runtime, inputs.runtime) }}
secrets: |
Expand Down Expand Up @@ -89,13 +96,26 @@ jobs:
if: ${{ inputs.mode == 'build-only' }}
run: |
docker save eventstore-test -o eventstore-test.tar
- name: Export Container
if: ${{ inputs.mode == 'build-only' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) }}
run: |
docker save eventstore -o eventstore.tar
- name: Publish Test Container
uses: actions/upload-artifact@v7
if: ${{ inputs.mode == 'build-only' }}
with:
name: ${{ inputs.test-image-artifact-name }}
path: eventstore-test.tar
if-no-files-found: error
retention-days: 1
- name: Publish Container
uses: actions/upload-artifact@v7
if: ${{ inputs.mode == 'build-only' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) }}
with:
name: ${{ inputs.image-artifact-name }}
path: eventstore.tar
if-no-files-found: error
retention-days: 1
- name: Download Test Container
uses: actions/download-artifact@v8
if: ${{ inputs.mode == 'test-only' }}
Expand All @@ -110,7 +130,7 @@ jobs:
run: |
docker run \
--env TEST_GROUP="${{ inputs.test-group-name }}" \
--volume $(pwd)/test-results:/build/test-results \
--volume "$(pwd)/test-results:/build/test-results" \
--rm \
eventstore-test
- name: Normalize Test Result Permissions
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/build-container-ubuntu-lts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
runtime: linux-x64
mode: build-only
test-image-artifact-name: eventstore-test-image-noble-linux-x64
image-artifact-name: eventstore-image-noble-linux-x64
secrets: inherit

test:
Expand Down Expand Up @@ -60,3 +61,17 @@ jobs:
test-image-artifact-name: eventstore-test-image-noble-linux-x64
test-group-name: ${{ matrix.test-group-name }}
secrets: inherit

publish-image:
name: Publish Image
if: ${{ github.repository == 'TrogonStack/TrogonEventStore' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) }}
needs:
- build-images
- test
permissions:
contents: read
packages: write
uses: ./.github/workflows/tag-docker-images.yml
with:
image-artifact-name: eventstore-image-noble-linux-x64
secrets: inherit
88 changes: 40 additions & 48 deletions .github/workflows/tag-docker-images.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,54 @@
name: Tag Docker Images
name: Publish Container Image

on:
schedule:
- cron: "0 3 * * *" # Every day at 3am UTC.
workflow_dispatch:
workflow_call:
inputs:
image-artifact-name:
required: true
type: string

jobs:
tag-docker-images:
if: github.repository == 'TrogonStack/TrogonEventStore'
publish-container-image:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Download Container
uses: actions/download-artifact@v8
with:
name: ${{ inputs.image-artifact-name }}
- name: Load Container
run: docker load --input eventstore.tar
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag and Push
uses: EventStore/Automations/tag-docker-images@master
- name: Publish Container
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE: ghcr.io/trogonstack/trogoneventstore
run: |
tags=()

- uses: actions/github-script@v9
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'TrogonStack',
repo: 'EventStore-Client-gRPC-TestData',
workflow_id: 'build.yml',
ref: 'master',
inputs: {
'repository': "'"$GITHUB_REPOSITORY"'",
'version': 'previous-lts'
}
});
if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then
tags+=(ci)
elif [[ "$GITHUB_REF" =~ ^refs/tags/v([0-9]+)\.([0-9]+)\.([0-9]+)(-[0-9A-Za-z.-]+)?$ ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
version="${GITHUB_REF_NAME#v}"
tags+=("$version")

await github.rest.actions.createWorkflowDispatch({
owner: 'TrogonStack',
repo: 'EventStore-Client-gRPC-TestData',
workflow_id: 'build.yml',
ref: 'master',
inputs: {
'repository': "'"$GITHUB_REPOSITORY"'",
'version': 'lts'
}
});
if [[ "$version" == *-* ]]; then
tags+=(preview)
else
tags+=("$major.$minor" "$major" stable)
fi
else
echo "Unsupported image publication ref: $GITHUB_REF" >&2
exit 1
fi

await github.rest.actions.createWorkflowDispatch({
owner: 'TrogonStack',
repo: 'EventStore-Client-gRPC-TestData',
workflow_id: 'build.yml',
ref: 'master',
inputs: {
'repository': "'"$GITHUB_REPOSITORY"'",
'version': 'ci'
}
});
for tag in "${tags[@]}"; do
docker tag eventstore "$IMAGE:$tag"
docker push "$IMAGE:$tag"
done
Original file line number Diff line number Diff line change
Expand Up @@ -670,13 +670,23 @@ private async Task WriteExistingEvents()
throw new Exception("Ephemeral streams cannot be written to.");
}

var numEvents = StreamProps.NumEvents;
for (int i = 0; i < numEvents; i++)
if (StreamProps.NumEvents > 0)
{
await WriteEvent();
await WriteEvents(StreamProps.NumEvents);
}
}

private async Task WriteEvents(int count)
{
var events = new EventData[count];
for (var i = 0; i < count; i++)
{
events[i] = new EventData(Guid.NewGuid(), "type", true, "{}"u8.ToArray(), Array.Empty<byte>());
}

await NodeConnection.AppendToStreamAsync(_stream, ExpectedVersion.Any, events);
}

private async Task WriteEvent(string stream, string eventType, string data, string metadata)
{
data ??= string.Empty;
Expand Down Expand Up @@ -765,10 +775,7 @@ private Task ApplyTombstone()
}

numEventsAdded = LiveProps.NumEventsToAdd;
for (var i = 0; i < numEventsAdded; i++)
{
await WriteEvent();
}
await WriteEvents(numEventsAdded);
}
else if (LiveProps.SoftDeleteStream)
{
Expand Down Expand Up @@ -803,10 +810,7 @@ private Task ApplyTombstone()
else if (LiveProps.FallBehindThenCatchUp)
{
numEventsAdded = NumEventsToFallBehind;
for (var i = 0; i < NumEventsToFallBehind; i++)
{
await WriteEvent();
}
await WriteEvents(NumEventsToFallBehind);

shouldFallBehindThenCatchup = true;
}
Expand Down Expand Up @@ -929,10 +933,9 @@ public async Task SetUp()
}

[Test]
[Retry(3)]
public async Task enumeration_is_correct()
{
var sub = Subscribe();
await using var sub = Subscribe();

if (HardDeleted)
{
Expand Down
Loading