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
6 changes: 3 additions & 3 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"version": 1,
"isRoot": true,
"tools": {
"paket": {
"version": "11.0.0",
"dotnet-outdated-tool": {
"version": "4.8.1",
"commands": [
"paket"
"dotnet-outdated"
]
},
"fsdocs-tool": {
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,5 @@ jobs:

- name: Install local tools
run: dotnet tool restore
- name: Paket Restore
run: dotnet paket restore
- name: Build and Test
run: dotnet run --project build/build.fsproj
74 changes: 74 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Publish NuGet packages

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- name: Setup .NET SDKs and .NET 8 runtime
uses: actions/setup-dotnet@v6
with:
dotnet-version: 8.0.x
global-json-file: global.json
- name: Install local tools
run: dotnet tool restore
- name: Build NuGet packages
run: dotnet run --project build/build.fsproj -- NuGet
- name: Verify tag version and packages
env:
TAG: ${{ github.ref_name }}
run: |
version="${TAG#v}"
if [[ "$version" =~ ^([0-9]+\.[0-9]+\.[0-9]+)\.0$ ]]; then version="${BASH_REMATCH[1]}"; fi
for package in FsUnit FsUnit.xUnit Fs30Unit.MsTest; do
test -f "bin/${package}.${version}.nupkg" || {
echo "Missing bin/${package}.${version}.nupkg (tag ${TAG} must match RELEASE_NOTES.md)" >&2
exit 1
}
done
for package in FsUnit FsUnit.xUnit Fs30Unit.MsTest; do
test -f "bin/${package}.${version}.snupkg" || {
echo "Missing bin/${package}.${version}.snupkg (tag ${TAG} must match RELEASE_NOTES.md)" >&2
exit 1
}
done
- uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: |
bin/*.nupkg
bin/*.snupkg
if-no-files-found: error

publish:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: nuget-packages
path: artifacts
# Configure a NuGet Trusted Publisher for fsprojects/FsUnit and this workflow (publish.yml).
# Store the NuGet.org account username (not email) in the NUGET_USER GitHub secret.
- name: NuGet login (Trusted Publishing)
id: nuget-login
uses: NuGet/login@v1
with:
user: ${{ secrets.NUGET_USER }}
- name: Push packages to NuGet.org
env:
NUGET_API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }}
run: |
for package in artifacts/*.nupkg; do
dotnet nuget push "$package" --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate
done
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ output/
# Test results produced by build
TestResults.xml

# Paket dependency manager
paket-files
.paket/

# Nuget outputs
nuget/*.nupkg
release.cmd
Expand Down
15 changes: 15 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project>
<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
<Authors>Ray Vernagus; Daniel Mohl; Sergey Tihon; Constantin Tews</Authors>
<PackageProjectUrl>https://github.com/fsprojects/FsUnit</PackageProjectUrl>
<RepositoryUrl>https://github.com/fsprojects/FsUnit</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>logo.png</PackageIcon>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Copyright>Copyright 2012-2026</Copyright>
</PropertyGroup>
</Project>
3 changes: 0 additions & 3 deletions FsUnit.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<Folder Name="/global/">
<File Path="build.cmd" />
<File Path="build.sh" />
<File Path="paket.dependencies" />
<File Path="paket.lock" />
<File Path="RELEASE_NOTES.md" />
</Folder>
<Folder Name="/global/docs/">
Expand All @@ -21,7 +19,6 @@
<File Path="docs/content/MsTest.fsx" />
<File Path="docs/content/NUnit.fsx" />
<File Path="docs/content/operators.md" />
<File Path="docs/content/Paket.fsx" />
<File Path="docs/content/release-notes.md" />
<File Path="docs/content/xUnit.fsx" />
</Folder>
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ A few things to keep in mind:

## Build Instructions
- Find and run either `./build.sh` or `build.cmd` (depending on your platform).
- Restore local tools with `dotnet tool restore`; use `dotnet outdated` to review or update NuGet dependencies.
- Push a `v<version>` tag matching the latest entry in `RELEASE_NOTES.md` to build and publish all six NuGet packages.
- Configure a NuGet.org Trusted Publisher for `fsprojects/FsUnit` and `.github/workflows/publish.yml`; add the NuGet account username (not email) as the `NUGET_USER` GitHub secret.

## Maintainer(s)

Expand Down
1 change: 0 additions & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
cls

dotnet tool restore
dotnet paket restore
dotnet run --project build/build.fsproj -- %*
1 change: 0 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash

dotnet tool restore
dotnet paket restore
dotnet run --project build/build.fsproj -- "$@"
35 changes: 15 additions & 20 deletions build/build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@
| Csproj -> AssemblyInfoFile.createCSharp ((folderName @@ "Properties") @@ "AssemblyInfo.cs") attributes
| Vbproj -> AssemblyInfoFile.createVisualBasic ((folderName @@ "My Project") @@ "AssemblyInfo.vb") attributes))

// Copies binaries from default VS location to expected bin folder
// But keeps a subdirectory structure for each project in the
// src folder to support multiple project outputs
Target.create "CopyBinaries" (fun _ ->
!! "src/**/*.??proj"
|> Seq.map (fun f -> ((Path.GetDirectoryName f) @@ "bin/Release", "bin" @@ (Path.GetFileNameWithoutExtension f)))
|> Seq.iter (fun (fromDir, toDir) -> Shell.copyDir toDir fromDir (fun _ -> true)))

// --------------------------------------------------------------------------------------
// Clean build results
Expand Down Expand Up @@ -172,21 +165,23 @@
Target.create "RunTests" ignore

// --------------------------------------------------------------------------------------
// Build a NuGet package
// Build NuGet packages with the .NET SDK

Target.create "NuGet" (fun _ ->
Paket.pack (fun p ->
{ p with
ToolType = ToolType.CreateLocalTool()
OutputPath = "bin"
Version = version
ReleaseNotes = String.toLines release.Notes }))
// MSBuild splits -p: values on ',' and ';'; environment variables are read as properties verbatim.
Environment.setEnvironVar "PackageReleaseNotes" (String.toLines release.Notes)

let pack projectPath extraProperties =
let result =
DotNet.exec id "pack" $"%s{projectPath} -c Release -o bin -p:Version=%s{version} %s{extraProperties}"

if not result.OK then
failwithf "Package build failed for %s: %A" projectPath result.Errors
[ "src/FsUnit.NUnit/FsUnit.NUnit.fsproj"
"src/FsUnit.Xunit/FsUnit.Xunit.fsproj"
"src/FsUnit.MsTestUnit/FsUnit.MsTest.fsproj" ]
|> List.iter (fun projectPath -> pack projectPath ""))

Target.create "PublishNuget" (fun _ ->
Paket.push (fun p ->
{ p with
ToolType = ToolType.CreateLocalTool()
WorkingDir = "bin" }))


// --------------------------------------------------------------------------------------
Expand All @@ -205,7 +200,7 @@
Shell.cleanDir tempDocsDir
Repository.cloneSingleBranch "" cloneUrl "gh-pages" tempDocsDir

Repository.fullclean tempDocsDir

Check warning on line 203 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

This construct is deprecated. Please use fullClean instead. This method will be removed in FAKE next major release

Check warning on line 203 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This construct is deprecated. Please use fullClean instead. This method will be removed in FAKE next major release

Check warning on line 203 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This construct is deprecated. Please use fullClean instead. This method will be removed in FAKE next major release
Shell.copyRecursive "output" tempDocsDir true |> Trace.tracefn "%A"
Staging.stageAll tempDocsDir
Commit.exec tempDocsDir (sprintf "Update generated documentation for version %s" version)
Expand All @@ -217,21 +212,21 @@
Target.create "All" ignore
Target.create "Release" ignore

"Clean"

Check warning on line 215 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

The result of this expression has type 'string' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.

Check warning on line 215 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The result of this expression has type 'string' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.

Check warning on line 215 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The result of this expression has type 'string' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.
==> "AssemblyInfo"
==> "CheckFormat"
==> "Build"
==> "CopyBinaries"
==> "RunTests"
==> "All"

"Build"

Check warning on line 222 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

The result of this expression has type 'string' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.

Check warning on line 222 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The result of this expression has type 'string' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.

Check warning on line 222 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The result of this expression has type 'string' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.
==> "NUnit"
==> "xUnit"
==> "MsTest"
==> "RunTests"


"All"

Check warning on line 229 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

The result of this expression has type 'string' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.

Check warning on line 229 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The result of this expression has type 'string' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.

Check warning on line 229 in build/build.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The result of this expression has type 'string' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.
==> "NuGet"
==> "GenerateDocs"
==> "ReleaseDocs"
Expand Down
1 change: 0 additions & 1 deletion build/build.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<PackageReference Include="Fake.DotNet.Cli" Version="6.1.4" />
<PackageReference Include="Fake.DotNet.MSBuild" Version="6.1.4" />
<PackageReference Include="Fake.DotNet.AssemblyInfoFile" Version="6.1.4" />
<PackageReference Include="Fake.DotNet.Paket" Version="6.1.4" />
<PackageReference Include="Fake.DotNet.Fsi" Version="6.1.4" />
<PackageReference Include="Fake.Tools.Git" Version="6.1.4" />
<PackageReference Include="Fake.Api.GitHub" Version="6.1.4" />
Expand Down
4 changes: 2 additions & 2 deletions docs/FsUnitTyped.fsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(*** hide ***)
// This block of code is omitted in the generated HTML documentation. Use
// it to define helpers that you do not want to show in the documentation.
#r "../packages/NUnit/lib/net8.0/nunit.framework.dll"
#r "../bin/FsUnit.NUnit/net8.0/FsUnit.NUnit.dll"
#r "../tests/FsUnit.NUnit.Test/bin/Release/net8.0/nunit.framework.dll"
#r "../tests/FsUnit.NUnit.Test/bin/Release/net8.0/FsUnit.NUnit.dll"

(**
What is FsUnitTyped?
Expand Down
8 changes: 3 additions & 5 deletions docs/MsTest.fsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(*** hide ***)
// This block of code is omitted in the generated HTML documentation. Use
// it to define helpers that you do not want to show in the documentation.
#r "../packages/MSTest.TestFramework/lib/netstandard2.0/Microsoft.VisualStudio.TestPlatform.TestFramework.dll"
#r "../packages/NHamcrest/lib/netstandard2.0/NHamcrest.dll"
#r "../bin/FsUnit.MsTest/netstandard2.0/FsUnit.MsTest.dll"
#r "../tests/FsUnit.MsTest.Test/bin/Release/net8.0/MSTest.TestFramework.dll"
#r "../tests/FsUnit.MsTest.Test/bin/Release/net8.0/NHamcrest.dll"
#r "../tests/FsUnit.MsTest.Test/bin/Release/net8.0/FsUnit.MsTest.dll"

(**
FsUnit for MsTest
Expand All @@ -15,8 +15,6 @@ FsUnit for MsTest
<div class="well well-small" id="nuget">
The FsUnit library for MsTest can be <a href="https://www.nuget.org/packages/Fs30Unit.MsTest/">installed from NuGet</a>:
<pre>PM> Install-Package Fs30Unit.MsTest</pre>
Sample FsUnit tests for MsTest can be <a href="https://www.nuget.org/packages/Fs30Unit.MsTest.Sample/">installed from NuGet</a>:
<pre>PM> Install-Package Fs30Unit.MsTest.Sample</pre>
</div>
</div>
<div class="span1"></div>
Expand Down
6 changes: 2 additions & 4 deletions docs/NUnit.fsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(*** hide ***)
// This block of code is omitted in the generated HTML documentation. Use
// it to define helpers that you do not want to show in the documentation.
#r "../packages/NUnit/lib/net8.0/nunit.framework.dll"
#r "../bin/FsUnit.NUnit/net8.0/FsUnit.NUnit.dll"
#r "../tests/FsUnit.NUnit.Test/bin/Release/net8.0/nunit.framework.dll"
#r "../tests/FsUnit.NUnit.Test/bin/Release/net8.0/FsUnit.NUnit.dll"

open NUnit.Framework
(**
Expand All @@ -15,8 +15,6 @@ FsUnit for NUnit
<div class="well well-small" id="nuget">
The FsUnit library for NUnit can be <a href="https://nuget.org/packages/FsUnit">installed from NuGet</a>:
<pre>PM> Install-Package FsUnit</pre>
Sample FsUnit tests for NUnit can be <a href="https://nuget.org/packages/FsUnit.Sample">installed from NuGet</a>:
<pre>PM> Install-Package FsUnit.Sample</pre>
</div>
</div>
<div class="span1"></div>
Expand Down
16 changes: 8 additions & 8 deletions docs/index.fsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(*** hide ***)
// This block of code is omitted in the generated HTML documentation. Use
// it to define helpers that you do not want to show in the documentation.
#r "../packages/NUnit/lib/net8.0/nunit.framework.dll"
#r "../bin/FsUnit.NUnit/net8.0/FsUnit.NUnit.dll"
#r "../tests/FsUnit.NUnit.Test/bin/Release/net8.0/nunit.framework.dll"
#r "../tests/FsUnit.NUnit.Test/bin/Release/net8.0/FsUnit.NUnit.dll"

open FsUnit

Expand Down Expand Up @@ -161,12 +161,12 @@ Supplying an expression that will result in a non-union type as well as supplyin
*)
type TestUnion = First | Second of int | Third of string

First |> should be (ofCase<@ First @>)
First |> should be (ofCase<@ First, Second @>) // checks if on the cases matches the given case
Second 5 |> should be (ofCase<@ Second 10 @>) // note, the actual value is not checked!
First |> should not' (be ofCase<@ Second 5 @>)
5 |> should be (ofCase<@ Second 5 @>) // will throw an exception
Second 5 |> should be (ofCase<@ int @>) // will throw an exception
First |> should be (ofCase <@ First @>)
First |> should be (ofCase <@ First, Second @>) // checks if on the cases matches the given case
Second 5 |> should be (ofCase <@ Second 10 @>) // note, the actual value is not checked!
First |> should not' (be ofCase <@ Second 5 @>)
5 |> should be (ofCase <@ Second 5 @>) // will throw an exception
Second 5 |> should be (ofCase <@ int @>) // will throw an exception

(**

Expand Down
10 changes: 5 additions & 5 deletions docs/xUnit.fsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
(*** hide ***)
// This block of code is omitted in the generated HTML documentation. Use
// it to define helpers that you do not want to show in the documentation.
#r "../packages/xunit.extensibility.core/lib/netstandard1.1/xunit.core.dll"
#r "../packages/NHamcrest/lib/netstandard2.0/NHamcrest.dll"
#r "../bin/FsUnit.Xunit/netstandard2.0/FsUnit.Xunit.dll"
#r "../tests/FsUnit.Xunit.Test/bin/Release/net8.0/xunit.v3.core.dll"
#r "../tests/FsUnit.Xunit.Test/bin/Release/net8.0/xunit.v3.common.dll"
#r "../tests/FsUnit.Xunit.Test/bin/Release/net8.0/xunit.v3.assert.dll"
#r "../tests/FsUnit.Xunit.Test/bin/Release/net8.0/NHamcrest.dll"
#r "../tests/FsUnit.Xunit.Test/bin/Release/net8.0/FsUnit.Xunit.dll"

(**
FsUnit for xUnit
Expand All @@ -15,8 +17,6 @@ FsUnit for xUnit
<div class="well well-small" id="nuget">
The FsUnit library for xUnit can be <a href="https://nuget.org/packages/FsUnit.xUnit">installed from NuGet</a>:
<pre>PM> Install-Package FsUnit.xUnit</pre>
Sample FsUnit tests for xUnit can be <a href="https://nuget.org/packages/FsUnit.xUnit.Sample">installed from NuGet</a>:
<pre>PM> Install-Package FsUnit.xUnit.Sample</pre>
</div>
</div>
<div class="span1"></div>
Expand Down
3 changes: 3 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"sdk": {
"version": "10.0.401",
"rollForward": "latestPatch"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
21 changes: 0 additions & 21 deletions paket.dependencies

This file was deleted.

Loading
Loading