Skip to content

Add isolated parallel database environments #40

Add isolated parallel database environments

Add isolated parallel database environments #40

Workflow file for this run

name: CI
on:
push:
branches: ["master", "develop", "feature/**", "release/**", "hotfix/**"]
tags: ["*"]
pull_request:
branches: ["master", "develop"]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
submodules: recursive
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets', '.config/dotnet-tools.json') }}
restore-keys: |
nuget-${{ runner.os }}-
- name: Restore .NET tools
run: dotnet tool restore
- name: Restore solution
run: dotnet restore ./src/NEventStore.Persistence.Sql.Core.sln --verbosity m
- name: Run GitVersion and patch assembly info
shell: pwsh
run: |
dotnet tool run dotnet-gitversion /targetpath "${{ github.workspace }}" /output json /updateAssemblyInfo | Out-Null
dotnet tool run dotnet-gitversion /targetpath "${{ github.workspace }}/dependencies/NEventStore" /updateAssemblyInfo | Out-Null
- name: Build solution
run: dotnet build ./src/NEventStore.Persistence.Sql.Core.sln -c Release --no-restore /p:ContinuousIntegrationBuild=True
test-sql-databases:
needs: build
name: Test (Linux, ${{ matrix.tfm }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tfm: [net8.0, net9.0, net10.0]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
submodules: recursive
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets', '.config/dotnet-tools.json') }}
restore-keys: |
nuget-${{ runner.os }}-
- name: Start CI database environment
shell: bash
run: bash ./docker/start-environment.sh ci
- name: Run tests for ${{ matrix.tfm }}
run: dotnet test ./src/NEventStore.Persistence.Sql.Core.sln -c Release -f ${{ matrix.tfm }} --logger "trx;LogFileName=test-results-${{ matrix.tfm }}.trx"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results-${{ matrix.tfm }}
path: "**/test-results-${{ matrix.tfm }}.trx"
if-no-files-found: ignore
retention-days: 14
- name: Stop CI database environment
if: always()
shell: bash
run: bash ./docker/stop-environment.sh ci --remove-data