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
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:18
env:
POSTGRES_PASSWORD: eventsourcing-test
ports:
- 55432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 20

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore
run: dotnet restore src/EventSourcing.slnx
- name: Build
run: dotnet build src/EventSourcing.slnx --no-restore --configuration Release /p:ContinuousIntegrationBuild=true
- name: Test
env:
TEST_POSTGRES_CONNECTION_STRING: Host=localhost;Port=55432;Username=postgres;Password=eventsourcing-test
TEST_POSTGRES_REQUIRED: 'true'
run: |
for project in $(find src -name '*.Test.csproj'); do
dotnet test --project "$project" --no-build --configuration Release || exit 1
done
90 changes: 90 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Publish NuGet packages

on:
release:
types: [ published ]

env:
# Versions are defined in the project files. A GitHub pre-release gets a version suffix, a full release does not.
IsPreRelease: ${{ github.event.release.prerelease }}
VersionSuffix: -ci.${{ github.run_number }}

jobs:
build:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:18
env:
POSTGRES_PASSWORD: eventsourcing-test
ports:
- 55432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 20

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore
run: dotnet restore src/EventSourcing.slnx
- name: Build
run: dotnet build src/EventSourcing.slnx --no-restore --configuration Release /p:ContinuousIntegrationBuild=true
- name: Test
env:
TEST_POSTGRES_CONNECTION_STRING: Host=localhost;Port=55432;Username=postgres;Password=eventsourcing-test
TEST_POSTGRES_REQUIRED: 'true'
run: |
for project in $(find src -name '*.Test.csproj'); do
dotnet test --project "$project" --no-build --configuration Release || exit 1
done
- name: Pack
run: |
for project in \
src/EventSourcing/EventSourcing.csproj \
src/EventSourcing.Commands/EventSourcing.Commands.csproj \
src/EventSourcing.Persistence.EntityFramework/EventSourcing.Persistence.EntityFramework.csproj \
src/EventSourcing.Persistence.EntityFramework.Postgres/EventSourcing.Persistence.EntityFramework.Postgres.csproj \
src/EventSourcing.Persistence.EntityFramework.SqlServer/EventSourcing.Persistence.EntityFramework.SqlServer.csproj \
src/EventSourcing.Persistence.EntityFramework.Sqlite/EventSourcing.Persistence.EntityFramework.Sqlite.csproj \
src/Bluehands.StructuralDiff/Bluehands.StructuralDiff.csproj
do
dotnet pack "$project" --no-build --configuration Release --output artifacts || exit 1
done
- name: Verify standalone diff package
shell: pwsh
run: ./src/Bluehands.StructuralDiff.Test/Test-Package.ps1 -PackageDirectory artifacts -WorkingDirectory "$env:RUNNER_TEMP/diff-package-smoke"
- uses: actions/upload-artifact@v4
with:
name: packages
path: artifacts/*nupkg

publish:
needs: build
runs-on: ubuntu-latest
environment: nuget
permissions:
id-token: write # required for NuGet trusted publishing (OIDC)

steps:
- uses: actions/download-artifact@v4
with:
name: packages
path: artifacts
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: NuGet login (trusted publishing)
id: login
uses: NuGet/login@v1
with:
user: ${{ secrets.NUGET_USER }}
- name: Push
run: dotnet nuget push "artifacts/*.nupkg" --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ parameters:
type: boolean
default: true

trigger:
- main
trigger: none
pr: none

pool:
vmImage: 'ubuntu-latest'
Expand Down
Loading