Skip to content

Commit

Permalink
Merge pull request #64 from efcore/net5.0
Browse files Browse the repository at this point in the history
Net5.0
  • Loading branch information
simon-reynolds authored Mar 21, 2021
2 parents 3d11f66 + 3f89459 commit 6fcff34
Show file tree
Hide file tree
Showing 108 changed files with 7,095 additions and 11,516 deletions.
8 changes: 4 additions & 4 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
]
},
"fake-cli": {
"version": "5.20.0",
"version": "5.20.4-alpha.1642",
"commands": [
"fake"
]
},
"paket": {
"version": "5.245.1",
"version": "6.0.0-beta8",
"commands": [
"paket"
]
Expand All @@ -33,10 +33,10 @@
]
},
"fsharp-analyzers": {
"version": "0.4.0",
"version": "0.7.0",
"commands": [
"fsharp-analyzers"
]
}
}
}
}
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM fsharp:netcore
FROM mcr.microsoft.com/dotnet/sdk:5.0

# Copy endpoint specific user settings into container to specify
# .NET Core should be used as the runtime.
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,30 @@ on: [push, pull_request]

jobs:
build:

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
dotnet: [3.1.100]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
- uses: actions/checkout@v2
- name: Use .NET Core 2.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.1.x'
- name: Use .NET Core 3.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- name: Use .NET Core 5.0 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
dotnet-version: '5.0.x'

- name: Build
if: runner.os != 'Windows'
run: |
chmod +x ./build.sh
chmod +x ./build.sh
./build.sh
env:
# Work around https://github.com/actions/setup-dotnet/issues/29
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ dist/
.ionide/

# Test coverage files
coverage/
coverage.xml
coverage.*.xml

Expand Down
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.1.5-alpha1]

## [Unreleased]
### Added
- F# migrations
- F# scaffolding
4 changes: 2 additions & 2 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This package will be published to NuGet at some point. In the meantime, it must

1. Clone this repository
1. From the command line, run `./build.sh` (Linux/Mac) or `.\build.cmd` (Windows)
1. The built NuGet package will be located in the `dist` folder in the root of the repository, named something like `EntityFrameworkCore.FSharp.3.1.5-alpha1.nupkg`
1. The built NuGet package will be located in the `dist` folder in the root of the repository, named something like `EntityFrameworkCore.FSharp.5.0.3-alpha1.nupkg`

## Create a new dotnet project and install dotnet tools

Expand Down Expand Up @@ -52,7 +52,7 @@ We will use `Paket` for package management, though you can apply the same princi
```
md packages-local
cp {LocationOfLocalRepo}/dist/EntityFrameworkCore.FSharp.3.1.5-alpha1.nupkg ./packages-local
cp {LocationOfLocalRepo}/dist/EntityFrameworkCore.FSharp.5.0.3-alpha1.nupkg ./packages-local
```
1. In our `paket.dependencies` file, reference this and the NuGet package for our desired Entity Framework provider
Expand Down
82 changes: 13 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ EFCore.FSharp | [![NuGet Badge](https://buildstats.info/nuget/EFCore.FSharp)](ht

---

## Usage

Install the package from NuGet and follow our [Getting Started](./GETTING_STARTED.md) guide or our full documentation at [https://efcore.github.io/EFCore.FSharp](https://efcore.github.io/EFCore.FSharp)

Currently created migrations must be manually added to your solution in the correct order. Although migrations are created with sequential file names so a glob can also be used

```xml
<Compile Include="Migrations/*.fs" />
```

---

### Building

```sh
Expand All @@ -28,13 +40,12 @@ $ ./build.sh <optional buildtarget>// on unix
After building the solution, it will create a NuGet package in the `dist` folder.
This can then be referenced as usual.

Currently created migrations must be manually added to your solution in the correct order.

### Developing

Make sure the following **requirements** are installed on your system:

- [dotnet SDK](https://www.microsoft.com/net/download/core) 3.0 or higher
- [dotnet SDK](https://www.microsoft.com/net/download/core) 5.0 or higher

or

Expand Down Expand Up @@ -74,71 +85,4 @@ or
- `FormatCode` - Runs [Fantomas](https://github.com/fsprojects/fantomas) on the solution file.
- `BuildDocs` - Generates Documentation from `docsSrc` and the [XML Documentation Comments](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/) from your libraries in `src`.
- `WatchDocs` - Generates documentation and starts a webserver locally. It will rebuild and hot reload if it detects any changes made to `docsSrc` files, libraries in `src`, or the `docsTool` itself.
- `ReleaseDocs` - Will stage, commit, and push docs generated in the `BuildDocs` target.
- [`Release`](#Releasing) - Task that runs all release type tasks such as `PublishToNuGet`, `GitRelease`, `ReleaseDocs`, and `GitHubRelease`. Make sure to read [Releasing](#Releasing) to setup your environment correctly for releases.
---


### Releasing

- [Create your NuGeT API key](https://docs.microsoft.com/en-us/nuget/nuget-org/publish-a-package#create-api-keys)
- [Add your NuGet API key to paket](https://fsprojects.github.io/Paket/paket-config.html#Adding-a-NuGet-API-key)

```sh
paket config add-token "https://www.nuget.org" 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a
```

- or set the environment variable `NUGET_TOKEN` to your key


- [Create a GitHub OAuth Token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)
- You can then set the environment variable `GITHUB_TOKEN` to upload release notes and artifacts to github
- Otherwise it will fallback to username/password

- Then update the `CHANGELOG.md` with an "Unreleased" section containing release notes for this version, in [KeepAChangelog](https://keepachangelog.com/en/1.1.0/) format.

NOTE: Its highly recommend to add a link to the Pull Request next to the release note that it affects. The reason for this is when the `RELEASE` target is run, it will add these new notes into the body of git commit. GitHub will notice the links and will update the Pull Request with what commit referenced it saying ["added a commit that referenced this pull request"](https://github.com/TheAngryByrd/MiniScaffold/pull/179#ref-commit-837ad59). Since the build script automates the commit message, it will say "Bump Version to x.y.z". The benefit of this is when users goto a Pull Request, it will be clear when and which version those code changes released. Also when reading the `CHANGELOG`, if someone is curious about how or why those changes were made, they can easily discover the work and discussions.

Here's an example of adding an "Unreleased" section to a `CHANGELOG.md` with a `0.1.0` section already released.
```markdown
## [Unreleased]
### Added
- Does cool stuff!
### Fixed
- Fixes that silly oversight
## [0.1.0] - 2017-03-17
First release
### Added
- This release already has lots of features
[Unreleased]: https://github.com/user/MyCoolNewLib.git/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/user/MyCoolNewLib.git/releases/tag/v0.1.0
```
- You can then use the `Release` target, specifying the version number either in the `RELEASE_VERSION` environment
variable, or else as a parameter after the target name. This will:
- update `CHANGELOG.md`, moving changes from the `Unreleased` section into a new `0.2.0` section
- if there were any prerelease versions of 0.2.0 in the changelog, it will also collect their changes into the final 0.2.0 entry
- make a commit bumping the version: `Bump version to 0.2.0` and adds the new changelog section to the commit's body
- publish the package to NuGet
- push a git tag
- create a GitHub release for that git tag

macOS/Linux Parameter:

```sh
./build.sh Release 0.2.0
```

macOS/Linux Environment Variable:

```sh
RELEASE_VERSION=0.2.0 ./build.sh Release
```


2 changes: 0 additions & 2 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
echo Restoring dotnet tools...
dotnet tool restore

dotnet paket install

dotnet fake build -t %*
26 changes: 9 additions & 17 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.Core.TargetOperators
open Fake.Api
open Fake.BuildServer
open Fantomas
open Fantomas.FakeHelpers

BuildServer.install [
AppVeyor.Installer
Travis.Installer
]

let environVarAsBoolOrDefault varName defaultValue =
let truthyConsts = [
"1"
Expand Down Expand Up @@ -58,7 +64,7 @@ let srcAndTest =
let distDir = __SOURCE_DIRECTORY__ @@ "dist"
let distGlob = distDir @@ "*.nupkg"

let coverageThresholdPercent = 20 //80
let coverageThresholdPercent = 50 //80
let coverageReportDir = __SOURCE_DIRECTORY__ @@ "docs" @@ "coverage"


Expand Down Expand Up @@ -267,7 +273,7 @@ module DocsTool =
]
|> watchparser.PrintCommandLineArgumentsFlat

let watch projectpath =
let watch () =
dotnet.watch (fun args ->
{ args with WorkingDirectory = docsToolDir }
) "run" (sprintf "-- watch %s" (watchCLI()))
Expand Down Expand Up @@ -402,7 +408,7 @@ let dotnetBuild ctx =

}) sln

let fsharpAnalyzers ctx =
let fsharpAnalyzers _ =
let argParser = ArgumentParser.Create<FSharpAnalyzers.Arguments>(programName = "fsharp-analyzers")
!! srcGlob
|> Seq.iter(fun proj ->
Expand Down Expand Up @@ -620,18 +626,6 @@ let buildDocs _ =
DocsTool.build ()

let watchDocs _ =
let watchBuild () =
!! srcGlob
|> Seq.map(fun proj -> fun () ->
dotnet.watch
(fun opt ->
opt |> DotNet.Options.withWorkingDirectory (IO.Path.GetDirectoryName proj))
"build"
""
|> ignore
)
|> Seq.iter (invokeAsync >> Async.Catch >> Async.Ignore >> Async.Start)
watchBuild ()
DocsTool.watch ()

let releaseDocs ctx =
Expand Down Expand Up @@ -693,13 +687,11 @@ Target.create "ReleaseDocs" releaseDocs
"UpdateChangelog" ?=> "GenerateAssemblyInfo"
"UpdateChangelog" ==> "PublishToNuGet"

"DotnetBuild" ==> "BuildDocs"
"BuildDocs" ==> "ReleaseDocs"
"BuildDocs" ?=> "PublishToNuget"
"DotnetPack" ?=> "BuildDocs"
"GenerateCoverageReport" ?=> "ReleaseDocs"

"DotnetBuild" ==> "WatchDocs"

"DotnetRestore"
==> "DotnetBuild"
Expand Down
2 changes: 0 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ set -o pipefail
echo "Restoring dotnet tools..."
dotnet tool restore

dotnet paket install

PAKET_SKIP_RESTORE_TARGETS=true FAKE_DETAILED_ERRORS=true dotnet fake build -t "$@"
2 changes: 2 additions & 0 deletions docs/Api_Reference/EFCore.FSharp/EFCore.FSharp.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!doctype html>
<html data-reactroot="" lang="en"><head><title>EFCore.FSharp docs / EFCore.FSharp.html-EFCore.FSharp</title><meta name="viewport" content="width=device-width, initial-scale=1" /><link href="https://efcore.github.io/EFCore.FSharp/content/toggle-bootstrap.min.css?version=637518579427008630" type="text/css" rel="stylesheet" /><link href="https://efcore.github.io/EFCore.FSharp/content/toggle-bootstrap-dark.min.css?version=637518579427008630" type="text/css" rel="stylesheet" /><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css" rel="stylesheet" integrity="sha384-KA6wR/X5RY4zFAHpv/CnoG2UW1uogYfdnP67Uv7eULvTveboZJg0qUpmJZb5VqzN" crossorigin="anonymous" /><link href="https://efcore.github.io/EFCore.FSharp/content/style.css?version=637518579427008630" type="text/css" rel="stylesheet" /></head><body><nav class="navbar navbar-expand-md sticky-top navbar-dark bg-dark"><a class="navbar-brand" href="https://efcore.github.io/EFCore.FSharp/index.html"><i class="fa fa-car text-white mr-2"></i>EFCore.FSharp</a><button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button><div class="collapse navbar-collapse" id="navbarNav"><ul class="navbar-nav mr-auto"><li class="nav-item dropdown"><a id="navbarDropdown-Api_Reference" href="#" data-toggle="dropdown" aria-haspopup class="nav-link dropdown-toggle">Api Reference</a><ul aria-labelledby="dropdownMenu1" class="dropdown-menu border-0 shadow"><li class="dropdown-submenu"><a id="navbarDropdown-EFCore.FSharp" href="#" role="button" data-toggle="dropdown" aria-haspopup class="dropdown-item dropdown-toggle">EFCore.FSharp</a><ul aria-labelledby="dropdownMenu2" class="dropdown-menu border-0 shadow"><li class="nav-item"><a class="dropdown-item" href="https://efcore.github.io/EFCore.FSharp/\Api_Reference\EFCore.FSharp\EFCore.FSharp.html">EFCore.FSharp</a></li></ul></li></ul></li><li class="nav-item dropdown"><a id="navbarDropdown-Explanations" href="#" data-toggle="dropdown" aria-haspopup class="nav-link dropdown-toggle">Explanations</a><ul aria-labelledby="dropdownMenu1" class="dropdown-menu border-0 shadow"><li class="nav-item"><a class="dropdown-item" href="https://efcore.github.io/EFCore.FSharp/\Explanations\Background.html">Background</a></li></ul></li><li class="nav-item dropdown"><a id="navbarDropdown-How_Tos" href="#" data-toggle="dropdown" aria-haspopup class="nav-link dropdown-toggle">How Tos</a><ul aria-labelledby="dropdownMenu1" class="dropdown-menu border-0 shadow"><li class="nav-item"><a class="dropdown-item" href="https://efcore.github.io/EFCore.FSharp/\How_Tos\Scaffold_As_Types.html">Scaffold As Types</a></li></ul></li><li class="nav-item dropdown"><a id="navbarDropdown-Tutorials" href="#" data-toggle="dropdown" aria-haspopup class="nav-link dropdown-toggle">Tutorials</a><ul aria-labelledby="dropdownMenu1" class="dropdown-menu border-0 shadow"><li class="nav-item"><a class="dropdown-item" href="https://efcore.github.io/EFCore.FSharp/\Tutorials\Getting_Started.html">Getting Started</a></li></ul></li></ul><ul class="navbar-nav"><button id="theme-toggle" class=""></button><li class="nav-item"><a class="nav-link" aria-label="EFCore.FSharp Repository on Github" href="https://github.com/efcore/EFCore.FSharp"><i class="fab fa-github fa-lg fa-fw text-light"></i></a></li></ul></div></nav><div class="wrapper d-flex flex-column justify-content-between min-vh-100"><main class="container main mb-4"><div class="container-fluid py-3"><div class="row"><div class="col-12"><h1><a name="EFCore.FSharp" href="#EFCore.FSharp" class="anchor">EFCore.FSharp</a></h1></div></div></div></main><footer class="footer font-small m-0 py-4 bg-dark"><div class="container"><div class="row"><div class="col-12 col-md-4 mb-4 mb-md-0"><div class="text-light"><h2 class="h5">Project Resources</h2><ul class="list-group list-group-flush"><li class="list-group-item bg-dark ml-0 pl-0"><a href="https://github.com/efcore/EFCore.FSharp/blob/master/README.md" class="text-white"><i class="fas fa-book-reader fa-fw mr-2"></i>README</a></li><li class="list-group-item bg-dark ml-0 pl-0"><a href="https://github.com/efcore/EFCore.FSharp/blob/master/CHANGELOG.md" class="text-white"><i class="fas fa-sticky-note fa-fw mr-2"></i>Release Notes / Changelog</a></li><li class="list-group-item bg-dark ml-0 pl-0"><a href="https://github.com/efcore/EFCore.FSharp/blob/master/LICENSE.md" class="text-white"><i class="fas fa-id-card fa-fw mr-2"></i>License</a></li></ul></div></div><div class="col-12 col-md-4 mb-4 mb-md-0"><div class="text-light"><h2 class="h5">Other Links</h2><ul class="list-group list-group-flush"><li class="list-group-item bg-dark ml-0 pl-0"><a href="https://docs.microsoft.com/en-us/dotnet/fsharp/" class="text-white"><i class="fab fa-microsoft fa-fw mr-2"></i>F# Documentation</a></li><li class="list-group-item bg-dark ml-0 pl-0"><a href="https://fsharp.org/guides/slack/" class="text-white"><i class="fab fa-slack fa-fw mr-2"></i>F# Slack</a></li><li class="list-group-item bg-dark ml-0 pl-0"><a href="http://foundation.fsharp.org/" class="text-white"><img class="fsharp-footer-logo mr-2" src="https://fsharp.org/img/logo/fsharp.svg" alt="FSharp Logo" />F# Software Foundation</a></li></ul></div></div><div class="col-12 col-md-4 mb-4 mb-md-0"><div class="text-light"><h2 class="h5">Metadata</h2><ul class="list-group list-group-flush"><li class="list-group-item bg-dark ml-0 pl-0">Generated for version <a class="text-white" href="https://github.com/efcore/EFCore.FSharp/releases/tag/0.0.1-alpha.1">0.0.1-alpha.1</a> on 2021/03/20</li></ul></div></div></div><div class="row"><div class="col text-center"><small class="text-light"><i class="fas fa-copyright mr-1"></i>2021 EFCore.FSharp, All rights reserved</small></div></div></div></footer></div><script src="https://efcore.github.io/EFCore.FSharp/content/themes.js?version=637518579427008630"></script><script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script><script src="https://efcore.github.io/EFCore.FSharp/content/tips.js?version=637518579427008630"></script><script src="https://efcore.github.io/EFCore.FSharp/content/submenu.js?version=637518579427008630"></script><script src="https://efcore.github.io/EFCore.FSharp/content/cleanups.js?version=637518579427008630"></script></body></html>
Loading

0 comments on commit 6fcff34

Please sign in to comment.