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
47 changes: 47 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
actions:
patterns:
- actions/*
- DragoAnt/*
- NuGet/*

- package-ecosystem: nuget
directory: /src
schedule:
interval: weekly
groups:
microsoft:
patterns:
- Microsoft.*
- System.*
- Npgsql.*
testing:
patterns:
- xunit*
- Verify*
- FluentAssertions
ignore:
# Versions after 32.0.0 require a paid maintenance subscription.
- dependency-name: Verify
versions:
- '>32.0.0'
- dependency-name: Verify.XunitV3
versions:
- '>32.0.0'
# 8.x requires a commercial license.
- dependency-name: FluentAssertions
update-types:
- version-update:semver-major
# One version line per target framework (Directory.Packages.props); a major bump would break the older TFMs.
- dependency-name: Microsoft.*
update-types:
- version-update:semver-major
- dependency-name: Npgsql.*
update-types:
- version-update:semver-major
47 changes: 0 additions & 47 deletions .github/workflows/build_and_publish_nuget.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: ci

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build:
name: Build and test
uses: DragoAnt/.github/.github/workflows/dotnet-build.yml@c9f20c11ebd297193a910d965d33bdf37c0d6c42 # main
with:
version: 0.0.0-ci.${{ github.run_number }}
solution: src/DragoAnt.EntityFrameworkCore.slnx
99 changes: 99 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: release

on:
release:
types:
- published

permissions:
contents: read

concurrency:
group: release-${{ github.event.release.tag_name }}
cancel-in-progress: false

jobs:
version:
name: Version from tag
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Validate tag
id: version
env:
TAG: ${{ github.event.release.tag_name }}
PRERELEASE: ${{ github.event.release.prerelease }}
run: |
version="${TAG#[vV]}"
ident='(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)'
semver="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-$ident(\.$ident)*)?$"
if ! [[ "$version" =~ $semver ]]; then
echo "::error::release tag '$TAG' is not a SemVer version (vMAJOR.MINOR.PATCH[-prerelease], no build metadata)"
exit 1
fi
if [[ "$version" == 9999.* ]]; then
echo "::error::9999.x is the local development version and is never published"
exit 1
fi
if [[ "$PRERELEASE" == "true" && "$version" != *-* ]]; then
echo "::error::the release is marked pre-release but '$TAG' has no -suffix"
exit 1
fi
if [[ "$PRERELEASE" != "true" && "$version" == *-* ]]; then
echo "::error::'$TAG' is a pre-release version; tick 'Set as a pre-release' on the release"
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Package version: $version"

build:
name: Build, test, pack
needs: version
uses: DragoAnt/.github/.github/workflows/dotnet-build.yml@c9f20c11ebd297193a910d965d33bdf37c0d6c42 # main
with:
version: ${{ needs.version.outputs.version }}
pack: true
solution: src/DragoAnt.EntityFrameworkCore.slnx

publish:
name: Publish to nuget.org
needs: build
runs-on: ubuntu-24.04
timeout-minutes: 10
environment:
name: nuget
url: https://www.nuget.org/profiles/${{ vars.NUGET_USER || 'DragoAnt' }}
permissions:
id-token: write
steps:
- name: Download packages
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ needs.build.outputs.packages-artifact }}
path: packages

- name: NuGet login (Trusted Publishing)
id: login
continue-on-error: true
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0
with:
user: ${{ vars.NUGET_USER || 'DragoAnt' }}

- name: Push
env:
OIDC_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
FALLBACK_KEY: ${{ secrets.NUGET_ORG_API_KEY }}
run: |
if [ -n "$OIDC_KEY" ]; then
key="$OIDC_KEY"
echo "Pushing with a short-lived nuget.org Trusted Publishing key."
elif [ -n "$FALLBACK_KEY" ]; then
key="$FALLBACK_KEY"
echo "::warning::nuget.org Trusted Publishing login failed, falling back to the NUGET_ORG_API_KEY secret. Add a Trusted Publishing policy on nuget.org (this repository, workflow file of this workflow, environment 'nuget') and delete the secret."
else
echo "::error::nuget.org Trusted Publishing login failed and no NUGET_ORG_API_KEY secret is available. Add a Trusted Publishing policy on nuget.org for this repository, this workflow file and environment 'nuget' (or set the NUGET_USER variable if the policy owner is not 'DragoAnt')."
exit 1
fi
dotnet nuget push "packages/*.nupkg" --api-key "$key" --source https://api.nuget.org/v3/index.json --skip-duplicate
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Contributing

Issues and pull requests are welcome. For anything larger than a small fix, open an issue first so the approach can be agreed before you write the code.

## Build and test

You need the .NET SDK pinned in [global.json](./global.json), plus the .NET 8 and .NET 9 runtimes so the tests run for every target framework. Then run the same steps as CI:

```sh
dotnet restore src/DragoAnt.EntityFrameworkCore.slnx
dotnet build src/DragoAnt.EntityFrameworkCore.slnx -c Release --no-restore
dotnet test --solution src/DragoAnt.EntityFrameworkCore.slnx -c Release --no-build
```

Tests use xUnit v3 on Microsoft.Testing.Platform v2, with FluentAssertions 7 and Verify snapshots. The `*.SqlServer.Tests` suites need SQL Server on `localhost,14330` and run only when you add `-p:RunSqlServerTests=true` to the build and test commands. When a snapshot changes on purpose, review the `*.received.*` file and replace the matching `*.verified.*` file with it.

## Build kit

The shared MSBuild settings come from [DragoAnt.MSBuildKit](https://github.com/DragoAnt/MSBuildKit), committed under `src/.toolkit/`; don't edit it by hand. Move to another kit release with its update script and commit the result:

```sh
sh src/.toolkit/update.sh --root src --version 0.2.0 # or: pwsh src/.toolkit/update.ps1 -Root src -Version 0.2.0
```

Repository settings live in `src/Directory.Build.props` (target frameworks, copyright), `src/Directory.Version.props` (the next release's `VersionPrefix`) and `src/Directory.Packages.props` (package versions the kit does not provide).

## Pull requests

- Branch from `master` and target `master`.
- Add or update tests for every behavior change.
- Keep the build warning-free: warnings are treated as errors.
- The `ci` workflow must pass on the pull request.

Releases are published to nuget.org by the maintainers from a GitHub release.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# EntityFramework Core extensions

[![CI](https://img.shields.io/github/actions/workflow/status/DragoAnt/Extensions.EntityFrameworkCore/ci.yml?branch=master)](https://github.com/DragoAnt/Extensions.EntityFrameworkCore/actions/workflows/ci.yml)

```sh
dotnet add package DragoAnt.EntityFrameworkCore.StaticMigrations
```

Part of [DragoAnt](https://github.com/DragoAnt) open-source .NET libraries.
10 changes: 10 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"sdk": {
"version": "10.0.401",
"rollForward": "latestMinor",
"allowPrerelease": false
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}

This file was deleted.

Loading