Skip to content

Commit

Permalink
modernize buildchain
Browse files Browse the repository at this point in the history
- use .NET 8
- use one release notes file per project
- use project reference version ranges
- use publish output of CLI tool to run Integration tests (the old way of using project reference in the test prtoject produced strange bugs)
  • Loading branch information
kMutagene committed Jan 4, 2024
1 parent 1cf4d0a commit 673d680
Show file tree
Hide file tree
Showing 27 changed files with 550 additions and 254 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.x.x
dotnet-version: 8.x.x
- name: make script executable
run: chmod u+x build.sh
- name: Build and test
Expand All @@ -41,7 +41,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.x.x
dotnet-version: 8.x.x
- name: Build and test
working-directory: ./
run: ./build.cmd runtests
14 changes: 7 additions & 7 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.x.x
dotnet-version: 8.x.x
- name: make script executable
run: chmod u+x build.sh
- name: Build and test
Expand All @@ -34,11 +34,11 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.x.x
dotnet-version: 8.x.x
- name: Build and test
working-directory: ./
run: ./build.cmd runtests
Expand All @@ -53,7 +53,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
Expand Down
9 changes: 9 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
### 0.0.1+

Starting from 1.0.0, Versions of the packages in this project are decoupled, meaning this single release notes page does not work anymore.

For the individual package release notes, please refer to these files:
- [ARCExpect](./src/ARCExpect/RELEASE_NOTES.md) - the base validation library
- [ARCValidationPackages](./src/ARCValidationPackages/RELEASE_NOTES.md) - validation package library
- [arc-validate](./src/arc-validate/RELEASE_NOTES.md) - validation CLI tool

### 0.0.1+6c5010d (Released 2023-12-11)
* Additions:
* [[#f034fe0](https://github.com/nfdi4plants/arc-validate/commit/f034fe0b6ff43dc02c050f5576283ee4ef8aa272)] Add demo notebook(s) (to sln file)
Expand Down
114 changes: 99 additions & 15 deletions build/BasicTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,108 @@ open Fake.IO.Globbing.Operators

open ProjectInfo

let setPrereleaseTag = BuildTask.create "SetPrereleaseTag" [] {
printfn "Please enter pre-release package suffix"
let suffix = System.Console.ReadLine()
prereleaseSuffix <- suffix
prereleaseTag <- (sprintf "%s-%s" release.NugetVersion suffix)
isPrerelease <- true
}

let clean = BuildTask.create "Clean" [] {
!! "src/**/bin"
++ "src/**/obj"
++ "tests/**/bin"
++ "tests/**/obj"
++ "pkg"
// let's try if this is not necessary anymore with .net 8!
//!! "src/**/bin"
//++ "src/**/obj"
//++ "tests/**/bin"
//++ "tests/**/obj"
!! "pkg"
++ "publish"
|> Shell.cleanDirs
}


/// Buildtask for setting a prerelease tag (also sets the mutable isPrerelease to true, and the PackagePrereleaseTag of all project infos accordingly.)
let setPrereleaseTag =
BuildTask.create "SetPrereleaseTag" [] {
printfn "Please enter pre-release package suffix"
let suffix = System.Console.ReadLine()
prereleaseSuffix <- suffix
isPrerelease <- true
projects
|> List.iter (fun p ->
p.PackagePrereleaseTag <- (sprintf "%s-%s" p.PackageVersionTag suffix)
)
//
prereleaseTag <- (sprintf "%s-%s" CoreProject.PackageVersionTag suffix)
}

/// builds the solution file (dotnet build solution.sln)
let buildSolution =
BuildTask.create "BuildSolution" [ clean ] {
solutionFile
|> DotNet.build (fun p ->
let msBuildParams =
{p.MSBuildParams with
Properties = ([
"warnon", "3390"
])
DisableInternalBinLog = true
}
{
p with
MSBuildParams = msBuildParams

}
|> DotNet.Options.withCustomParams (Some "-tl")
)
}

/// builds the individual project files (dotnet build project.*proj)
///
/// The following MSBuild params are set for each project accordingly to the respective ProjectInfo:
///
/// - AssemblyVersion
///
/// - AssemblyInformationalVersion
///
/// - warnon:3390 for xml doc formatting warnings on compilation
let build = BuildTask.create "Build" [clean] {
solutionFile
|> DotNet.build id
projects
|> List.iter (fun pInfo ->
let proj = pInfo.ProjFile
proj
|> DotNet.build (fun p ->
let msBuildParams =
{p.MSBuildParams with
Properties = ([
"AssemblyVersion", pInfo.AssemblyVersion
"InformationalVersion", pInfo.AssemblyInformationalVersion
"warnon", "3390"
])
DisableInternalBinLog = true
}
{
p with
MSBuildParams = msBuildParams
}
// Use this if you want to speed up your build. Especially helpful in large projects
// Ensure that the order in your project list is correct (e.g. projects that are depended on are built first)
|> DotNet.Options.withCustomParams (Some "-tl")
)
)
}


let publish = BuildTask.create "Publish" [clean] {
CLIProject.ProjFile
|> DotNet.publish (fun p ->
let msBuildParams =
{p.MSBuildParams with
Properties = ([
"AssemblyVersion", CLIProject.AssemblyVersion
"InformationalVersion", CLIProject.AssemblyInformationalVersion
"warnon", "3390"
])
DisableInternalBinLog = true
}
{
p with
MSBuildParams = msBuildParams
OutputPath = Some "publish"
}
|> DotNet.Options.withCustomParams (Some "-tl")
)
}
6 changes: 3 additions & 3 deletions build/Build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ open PackageTasks
open DocumentationTasks
open ReleaseTasks


/// Full release of nuget package, git tag, and documentation for the stable version.
let _release =
BuildTask.createEmpty
Expand All @@ -41,8 +42,7 @@ let _preReleaseNoDocs =
"PreReleaseNoDocs"
[setPrereleaseTag; clean; build; runTests; packPrerelease; createPrereleaseTag; publishNugetPrerelease]

let _releaseNotes = ReleaseNotesTasks.updateReleaseNotes

[<EntryPoint>]
let main args =
runOrDefault build args
runOrDefault buildSolution args

71 changes: 44 additions & 27 deletions build/DocumentationTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,47 @@ open BasicTasks

open BlackFox.Fake

let buildDocs = BuildTask.create "BuildDocs" [build] {
printfn "building docs with stable version %s" stableVersionTag
runDotNet
(sprintf "fsdocs build --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s" stableVersionTag)
"./"
}

let buildDocsPrerelease = BuildTask.create "BuildDocsPrerelease" [setPrereleaseTag; build] {
printfn "building docs with prerelease version %s" prereleaseTag
runDotNet
(sprintf "fsdocs build --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s" prereleaseTag)
"./"
}

let watchDocs = BuildTask.create "WatchDocs" [build] {
printfn "watching docs with stable version %s" stableVersionTag
runDotNet
(sprintf "fsdocs watch --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s" stableVersionTag)
"./"
}

let watchDocsPrerelease = BuildTask.create "WatchDocsPrerelease" [setPrereleaseTag; build] {
printfn "watching docs with prerelease version %s" prereleaseTag
runDotNet
(sprintf "fsdocs watch --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s" prereleaseTag)
"./"
}

let buildDocs =
BuildTask.create "BuildDocs" [ build ] {
printfn "building docs with stable version %s" stableDocsVersionTag

runDotNet
(sprintf
"fsdocs build --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s"
stableDocsVersionTag)
"./"
}

let buildDocsPrerelease =
BuildTask.create "BuildDocsPrerelease" [ setPrereleaseTag; build ] {
printfn "building docs with prerelease version %s" prereleaseTag

runDotNet
(sprintf
"fsdocs build --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s"
prereleaseTag)
"./"
}

let watchDocs =
BuildTask.create "WatchDocs" [ build ] {
printfn "watching docs with stable version %s" stableDocsVersionTag

runDotNet
(sprintf
"fsdocs watch --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s"
stableDocsVersionTag)
"./"
}

let watchDocsPrerelease =
BuildTask.create "WatchDocsPrerelease" [ setPrereleaseTag; build ] {
printfn "watching docs with prerelease version %s" prereleaseTag

runDotNet
(sprintf
"fsdocs watch --eval --clean --properties Configuration=Release --parameters fsdocs-package-version %s"
prereleaseTag)
"./"
}
Loading

0 comments on commit 673d680

Please sign in to comment.