diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 06db04d..17cfcb1 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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 @@ -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 \ No newline at end of file diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index d8fcb5d..2e230ea 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -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 @@ -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 @@ -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 diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 47bbfe9..95b40ff 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -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) diff --git a/build/BasicTasks.fs b/build/BasicTasks.fs index d7f28ad..bcc8cf3 100644 --- a/build/BasicTasks.fs +++ b/build/BasicTasks.fs @@ -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") + ) } \ No newline at end of file diff --git a/build/Build.fs b/build/Build.fs index 72a2ba3..ca7f757 100644 --- a/build/Build.fs +++ b/build/Build.fs @@ -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 @@ -41,8 +42,7 @@ let _preReleaseNoDocs = "PreReleaseNoDocs" [setPrereleaseTag; clean; build; runTests; packPrerelease; createPrereleaseTag; publishNugetPrerelease] -let _releaseNotes = ReleaseNotesTasks.updateReleaseNotes - [] let main args = - runOrDefault build args + runOrDefault buildSolution args + diff --git a/build/DocumentationTasks.fs b/build/DocumentationTasks.fs index b3e5f48..8b8832f 100644 --- a/build/DocumentationTasks.fs +++ b/build/DocumentationTasks.fs @@ -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) + "./" + } diff --git a/build/PackageTasks.fs b/build/PackageTasks.fs index e77d4c4..f6dfccc 100644 --- a/build/PackageTasks.fs +++ b/build/PackageTasks.fs @@ -8,57 +8,114 @@ open TestTasks open BlackFox.Fake open Fake.Core +open Fake.DotNet open Fake.IO.Globbing.Operators -open System.Text.RegularExpressions -/// https://github.com/Freymaurer/Fake.Extensions.Release#release-notes-in-nuget -let private replaceCommitLink input = - let commitLinkPattern = @"\[\[#[a-z0-9]*\]\(.*\)\] " - Regex.Replace(input,commitLinkPattern,"") - -let pack = BuildTask.create "Pack" [clean; build; runTests] { - if promptYesNo (sprintf "creating stable package with version %s OK?" stableVersionTag ) - then - !! "src/**/*.*proj" - -- "src/bin/*" - |> Seq.iter (Fake.DotNet.DotNet.pack (fun p -> +let pack = BuildTask.create "Pack" [ clean; build; runTests ] { + [ + CoreProject + ValidationPackagesProject + ] + |> List.iter (fun pInfo -> + if promptYesNo $"creating stable package for {pInfo.Name}{System.Environment.NewLine}\tpackage version: {pInfo.PackageVersionTag}{System.Environment.NewLine}\tassembly version: {pInfo.AssemblyVersion}{System.Environment.NewLine}\tassembly informational version: {pInfo.AssemblyInformationalVersion}{System.Environment.NewLine} OK?" then + pInfo.ProjFile + |> Fake.DotNet.DotNet.pack (fun p -> let msBuildParams = - {p.MSBuildParams with - Properties = ([ - "Version",stableVersionTag - "PackageReleaseNotes", (release.Notes |> List.map replaceCommitLink |> String.concat "\r\n" ) - ] @ p.MSBuildParams.Properties) - } - { - p with - MSBuildParams = msBuildParams - OutputPath = Some pkgDir + match pInfo.ReleaseNotes with + | Some r -> + { p.MSBuildParams with + Properties = + ([ + "Version",pInfo.PackageVersionTag + "AssemblyVersion", pInfo.AssemblyVersion + "AssemblyInformationalVersion", pInfo.AssemblyVersion + "PackageReleaseNotes", (r.Notes |> String.concat "\r\n") + "TargetsForTfmSpecificContentInPackage", "" //https://github.com/dotnet/fsharp/issues/12320 + ] + @ p.MSBuildParams.Properties) + DisableInternalBinLog = true + } + | _ -> + { p.MSBuildParams with + Properties = + ([ + "Version",pInfo.PackageVersionTag + "AssemblyVersion", pInfo.AssemblyVersion + "AssemblyInformationalVersion", pInfo.AssemblyVersion + "TargetsForTfmSpecificContentInPackage", "" //https://github.com/dotnet/fsharp/issues/12320 + ] + @ p.MSBuildParams.Properties) + DisableInternalBinLog = true + } + + + { p with + MSBuildParams = msBuildParams + OutputPath = Some pkgDir + NoBuild = true } - )) - else failwith "aborted" -} + |> DotNet.Options.withCustomParams (Some "-tl") + ) + else + failwith "aborted" + ) + } -let packPrerelease = BuildTask.create "PackPrerelease" [setPrereleaseTag; clean; build; runTests] { - if promptYesNo (sprintf "package tag will be %s OK?" prereleaseTag ) - then - !! "src/**/*.*proj" - -- "src/bin/*" - |> Seq.iter (Fake.DotNet.DotNet.pack (fun p -> - let msBuildParams = - {p.MSBuildParams with - Properties = ([ - "Version", prereleaseTag - "PackageReleaseNotes", (release.Notes |> List.map replaceCommitLink |> String.toLines ) - ] @ p.MSBuildParams.Properties) +let packPrerelease = + BuildTask.create + "PackPrerelease" + [ + clean + build + runTests + ] { + [ + CoreProject + ValidationPackagesProject + ] + |> List.iter (fun pInfo -> + printfn $"Please enter pre-release package suffix for {pInfo.Name}" + let prereleaseSuffix = System.Console.ReadLine() + pInfo.PackagePrereleaseTag <- sprintf "%s-%s" pInfo.PackageVersionTag prereleaseSuffix + if promptYesNo $"creating prerelease package for {pInfo.Name}{System.Environment.NewLine}\tpackage version: {pInfo.PackagePrereleaseTag}{System.Environment.NewLine}\tassembly version: {pInfo.AssemblyVersion}{System.Environment.NewLine}\tassembly informational version: {pInfo.AssemblyInformationalVersion}{System.Environment.NewLine} OK?" then + pInfo.ProjFile + |> Fake.DotNet.DotNet.pack (fun p -> + let msBuildParams = + match pInfo.ReleaseNotes with + | Some r -> + { p.MSBuildParams with + Properties = + ([ + "Version",pInfo.PackagePrereleaseTag + "AssemblyVersion", pInfo.AssemblyVersion + "InformationalVersion", pInfo.AssemblyInformationalVersion + "PackageReleaseNotes", (r.Notes |> String.concat "\r\n") + "TargetsForTfmSpecificContentInPackage", "" //https://github.com/dotnet/fsharp/issues/12320 + ]) + DisableInternalBinLog = true } - { - p with - VersionSuffix = Some prereleaseSuffix - OutputPath = Some pkgDir - MSBuildParams = msBuildParams - } - )) - else - failwith "aborted" -} \ No newline at end of file + | _ -> + { p.MSBuildParams with + Properties = + ([ + "Version",pInfo.PackagePrereleaseTag + "AssemblyVersion", pInfo.AssemblyVersion + "InformationalVersion", pInfo.AssemblyInformationalVersion + "TargetsForTfmSpecificContentInPackage", "" //https://github.com/dotnet/fsharp/issues/12320 + ]) + DisableInternalBinLog = true + } + + { p with + VersionSuffix = Some prereleaseSuffix + OutputPath = Some pkgDir + MSBuildParams = msBuildParams + NoBuild = true + } + |> DotNet.Options.withCustomParams (Some "-tl") + ) + else + failwith "aborted" + ) + } diff --git a/build/ProjectInfo.fs b/build/ProjectInfo.fs index 1eb4a03..262d880 100644 --- a/build/ProjectInfo.fs +++ b/build/ProjectInfo.fs @@ -2,15 +2,81 @@ open Fake.Core -let project = "arc-validate" + +/// Contains relevant information about a project (e.g. version info, project location) +type ProjectInfo = { + Name: string + ProjFile: string + ReleaseNotes: ReleaseNotes.ReleaseNotes Option + PackageVersionTag: string + mutable PackagePrereleaseTag: string + AssemblyVersion: string + AssemblyInformationalVersion: string +} with + /// creates a ProjectInfo given a name, project file path, and release notes file path. + /// version info is created from the version header of the uppermost release notes entry. + /// Assembly version is set to X.0.0, where X is the major version from the releas enotes. + static member create( + name: string, + projFile: string, + releaseNotesPath: string + ): ProjectInfo = + let release = releaseNotesPath |> ReleaseNotes.load + let stableVersion = release.NugetVersion |> SemVer.parse + let stableVersionTag = $"{stableVersion.Major}.{stableVersion.Minor}.{stableVersion.Patch}" + let assemblyVersion = $"{stableVersion.Major}.0.0" + let assemblyInformationalVersion = stableVersionTag + { + Name = name + ProjFile = projFile + ReleaseNotes = Some release + PackagePrereleaseTag = "" + PackageVersionTag = stableVersionTag + AssemblyVersion = assemblyVersion + AssemblyInformationalVersion = assemblyInformationalVersion + } + static member create( + name: string, + projFile: string + ): ProjectInfo = + { + Name = name + ProjFile = projFile + ReleaseNotes = None + PackagePrereleaseTag = "" + PackageVersionTag = "" + AssemblyVersion = "" + AssemblyInformationalVersion = "" + } + +// adapt this to reflect the core project in your repository. The only effect this will have is the version displayed in the docs, as it is currently only possible to have one version displayed there. +let CoreProject = ProjectInfo.create("ARCExpect", "src/ARCExpect/ARCExpect.fsproj", "src/ARCExpect/RELEASE_NOTES.md") +let ValidationPackagesProject = ProjectInfo.create("ARCValidationPackages", "src/ARCValidationPackages/ARCValidationPackages.fsproj", "src/ARCValidationPackages/RELEASE_NOTES.md") +let CLIProject = ProjectInfo.create("arc-validate", "src/arc-validate/arc-validate.fsproj", "src/arc-validate/RELEASE_NOTES.md") + +let projects = + [ + // add relative paths (from project root) to your projects here, including individual reslease notes files + // e.g. ProjectInfo.create("MyProject", "src/MyProject/MyProject.fsproj", "src/MyProject/RELEASE_NOTES.md") + CoreProject + ValidationPackagesProject + CLIProject + ] + + let testProjects = [ - "tests/ARCExpect.Tests/ARCExpect.Tests.fsproj" - "tests/ARCValidationPackages.Tests/ARCValidationPackages.Tests.fsproj" - "tests/arc-validate.Tests/arc-validate.Tests.fsproj" + // add relative paths (from project root) to your testprojects here + // e.g. ProjectInfo.create("MyTestProject", "tests/MyTestProject/MyTestProject.fsproj") + ProjectInfo.create("ARCExpect.Tests", "tests/ARCExpect.Tests/ARCExpect.Tests.fsproj") + ProjectInfo.create("ARCValidationPackages.Tests", "tests/ARCValidationPackages.Tests/ARCValidationPackages.Tests.fsproj") + ProjectInfo.create("arc-validate.Tests", "tests/arc-validate.Tests/arc-validate.Tests.fsproj") ] + +let project = "arc-validate" + let solutionFile = $"{project}.sln" let configuration = "Release" @@ -23,17 +89,18 @@ let projectRepo = $"https://github.com/{gitOwner}/{project}" let pkgDir = "pkg" -// Create RELEASE_NOTES.md if not existing. Or "release" would throw an error. -Fake.Extensions.Release.ReleaseNotes.ensure() - -let release = ReleaseNotes.load "RELEASE_NOTES.md" -let stableVersion = SemVer.parse release.NugetVersion +/// docs are always targeting the version of the core project +let stableDocsVersionTag = CoreProject.PackageVersionTag -let stableVersionTag = (sprintf "%i.%i.%i" stableVersion.Major stableVersion.Minor stableVersion.Patch ) +/// branch tag is always the version of the core project +let branchTag = CoreProject.PackageVersionTag +/// prerelease suffix used by prerelease buildtasks let mutable prereleaseSuffix = "" +/// prerelease tag used by prerelease buildtasks let mutable prereleaseTag = "" -let mutable isPrerelease = false \ No newline at end of file +/// mutable switch used to signal that we are building a prerelease version, used in prerelease buildtasks +let mutable isPrerelease = false diff --git a/build/ReleaseNotesTasks.fs b/build/ReleaseNotesTasks.fs deleted file mode 100644 index 22d3671..0000000 --- a/build/ReleaseNotesTasks.fs +++ /dev/null @@ -1,29 +0,0 @@ -module ReleaseNotesTasks - -open Fake.Extensions.Release -open BlackFox.Fake - -/// This might not be necessary, mostly useful for apps which want to display current version as it creates an accessible F# version script from RELEASE_NOTES.md -let createAssemblyVersion = BuildTask.create "createvfs" [] { - AssemblyVersion.create ProjectInfo.project -} - -// https://github.com/Freymaurer/Fake.Extensions.Release#releaseupdate -let updateReleaseNotes = BuildTask.createFn "ReleaseNotes" [] (fun config -> - ReleaseNotes.update(ProjectInfo.gitOwner, ProjectInfo.project, config) -) - - -// https://github.com/Freymaurer/Fake.Extensions.Release#githubdraft -let githubDraft = BuildTask.createFn "GithubDraft" [] (fun config -> - - let body = "We are ready to go for the first release!" - - Github.draft( - ProjectInfo.gitOwner, - ProjectInfo.project, - (Some body), - None, - config - ) -) \ No newline at end of file diff --git a/build/ReleaseTasks.fs b/build/ReleaseTasks.fs index 8748ab7..cda6a63 100644 --- a/build/ReleaseTasks.fs +++ b/build/ReleaseTasks.fs @@ -15,57 +15,118 @@ open Fake.Tools open Fake.IO open Fake.IO.Globbing.Operators -let createTag = BuildTask.create "CreateTag" [clean; build; runTests; pack] { - if promptYesNo (sprintf "tagging branch with %s OK?" stableVersionTag ) then - Git.Branches.tag "" stableVersionTag - Git.Branches.pushTag "" projectRepo stableVersionTag - else - failwith "aborted" -} -let createPrereleaseTag = BuildTask.create "CreatePrereleaseTag" [setPrereleaseTag; clean; build; runTests; packPrerelease] { - if promptYesNo (sprintf "tagging branch with %s OK?" prereleaseTag ) then - Git.Branches.tag "" prereleaseTag - Git.Branches.pushTag "" projectRepo prereleaseTag - else - failwith "aborted" -} +let createTag = + BuildTask.create "CreateTag" [ clean; build; runTests; pack ] { + if promptYesNo (sprintf "tagging branch with %s OK?" branchTag) then + Git.Branches.tag "" branchTag + Git.Branches.pushTag "" projectRepo branchTag + else + failwith "aborted" + } +let createPrereleaseTag = + BuildTask.create + "CreatePrereleaseTag" + [ + setPrereleaseTag + clean + build + runTests + packPrerelease + ] { + if promptYesNo (sprintf "tagging branch with %s OK?" prereleaseTag) then + Git.Branches.tag "" prereleaseTag + Git.Branches.pushTag "" projectRepo prereleaseTag + else + failwith "aborted" + } -let publishNuget = BuildTask.create "PublishNuget" [clean; build; runTests; pack] { - let targets = (!! (sprintf "%s/*.*pkg" pkgDir )) - for target in targets do printfn "%A" target - let msg = sprintf "release package with version %s?" stableVersionTag - if promptYesNo msg then - let source = "https://api.nuget.org/v3/index.json" - let apikey = Environment.environVar "NUGET_KEY_CSB" - for artifact in targets do - let result = DotNet.exec id "nuget" (sprintf "push -s %s -k %s %s --skip-duplicate" source apikey artifact) - if not result.OK then failwith "failed to push packages" - else failwith "aborted" -} -let publishNugetPrerelease = BuildTask.create "PublishNugetPrerelease" [clean; build; runTests; packPrerelease] { - let targets = (!! (sprintf "%s/*.*pkg" pkgDir )) - for target in targets do printfn "%A" target - let msg = sprintf "release package with version %s?" prereleaseTag - if promptYesNo msg then - let source = "https://api.nuget.org/v3/index.json" - let apikey = Environment.environVar "NUGET_KEY_CSB" - for artifact in targets do - let result = DotNet.exec id "nuget" (sprintf "push -s %s -k %s %s --skip-duplicate" source apikey artifact) - if not result.OK then failwith "failed to push packages" - else failwith "aborted" -} +let publishNuget = + BuildTask.create "PublishNuget" [ clean; build; runTests; pack ] { + let targets = + (!!(sprintf "%s/*.*pkg" pkgDir)) + + printfn "package files:" + + for target in targets do + printfn "%A" target + + printfn "package versions to release:" + + projects + |> List.iter (fun p -> + printfn $"{p.Name} @ {p.PackageVersionTag}" + ) + + if promptYesNo "OK?" then + let source = + "https://api.nuget.org/v3/index.json" + + let apikey = + Environment.environVar "NUGET_KEY" + + for artifact in targets do + let result = + DotNet.exec id "nuget" (sprintf "push -s %s -k %s %s --skip-duplicate" source apikey artifact) + + if not result.OK then + failwith "failed to push packages" + else + failwith "aborted" + } + +let publishNugetPrerelease = + BuildTask.create + "PublishNugetPrerelease" + [ + clean + build + runTests + packPrerelease + ] { + let targets = + (!!(sprintf "%s/*.*pkg" pkgDir)) + + printfn "package files:" + + for target in targets do + printfn "%A" target + + printfn "package versions to release:" + + projects + |> List.iter (fun p -> + printfn $"{p.Name} @ {p.PackagePrereleaseTag}" + ) + + if promptYesNo "OK?" then + let source = + "https://api.nuget.org/v3/index.json" + + let apikey = + Environment.environVar "NUGET_KEY" + + for artifact in targets do + let result = + DotNet.exec id "nuget" (sprintf "push -s %s -k %s %s --skip-duplicate" source apikey artifact) + + if not result.OK then + failwith "failed to push packages" + else + failwith "aborted" + } let releaseDocs = BuildTask.create "ReleaseDocs" [buildDocs] { - let msg = sprintf "release docs for version %s?" stableVersionTag + let msg = + sprintf "release docs for version %s?" stableDocsVersionTag if promptYesNo msg then Shell.cleanDir "temp" Git.CommandHelper.runSimpleGitCommand "." (sprintf "clone %s temp/gh-pages --depth 1 -b gh-pages" projectRepo) |> ignore Shell.copyRecursive "output" "temp/gh-pages" true |> printfn "%A" Git.CommandHelper.runSimpleGitCommand "temp/gh-pages" "add ." |> printfn "%s" - let cmd = sprintf """commit -a -m "Update generated documentation for version %s""" stableVersionTag + let cmd = sprintf """commit -a -m "Update generated documentation for version %s""" stableDocsVersionTag Git.CommandHelper.runSimpleGitCommand "temp/gh-pages" cmd |> printfn "%s" Git.Branches.push "temp/gh-pages" else failwith "aborted" diff --git a/build/TestTasks.fs b/build/TestTasks.fs index d9b99fd..d19572f 100644 --- a/build/TestTasks.fs +++ b/build/TestTasks.fs @@ -2,11 +2,11 @@ open BlackFox.Fake open Fake.DotNet +open Fake.Tools.Git open ProjectInfo open BasicTasks open System.IO -open Fake.Tools.Git let ensureArcFixtures = BuildTask.create "EnsureArcFixtures" [] { let arcFixtures = [ @@ -21,38 +21,36 @@ let ensureArcFixtures = BuildTask.create "EnsureArcFixtures" [] { ) } -let runTests = BuildTask.create "RunTests" [clean; ensureArcFixtures; build] { +let buildTests = + BuildTask.create "BuildTests" [clean; build] { + testProjects + |> List.iter (fun pInfo -> + let proj = pInfo.ProjFile + proj + |> DotNet.build (fun p -> + { + p with + MSBuildParams = { p.MSBuildParams with DisableInternalBinLog = true} + } + |> DotNet.Options.withCustomParams (Some "-tl") + ) + ) + } + +let runTests = BuildTask.create "RunTests" [clean; ensureArcFixtures; publish; buildTests] { testProjects - |> Seq.iter (fun testProject -> - Fake.DotNet.DotNet.test(fun testParams -> - { - testParams with + |> Seq.iter (fun testProjectInfo -> + Fake.DotNet.DotNet.test + (fun testParams -> + { testParams with Logger = Some "console;verbosity=detailed" Configuration = DotNet.BuildConfiguration.fromString configuration NoBuild = true - } - ) testProject - ) + MSBuildParams = { testParams.MSBuildParams with DisableInternalBinLog = true } + } + |> DotNet.Options.withCustomParams (Some "-tl") + ) + testProjectInfo.ProjFile + ) } -// to do: use this once we have actual tests -let runTestsWithCodeCov = BuildTask.create "RunTestsWithCodeCov" [clean; build] { - let standardParams = Fake.DotNet.MSBuild.CliArguments.Create () - testProjects - |> Seq.iter(fun testProject -> - Fake.DotNet.DotNet.test(fun testParams -> - { - testParams with - MSBuildParams = { - standardParams with - Properties = [ - "AltCover","true" - "AltCoverCobertura","../../codeCov.xml" - "AltCoverForce","true" - ] - }; - Logger = Some "console;verbosity=detailed" - } - ) testProject - ) -} \ No newline at end of file diff --git a/build/build.fsproj b/build/build.fsproj index 8c83a51..448beec 100644 --- a/build/build.fsproj +++ b/build/build.fsproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 Exe @@ -9,7 +9,6 @@ - @@ -20,15 +19,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/global.json b/global.json index 08fc58c..989a69c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.100", + "version": "8.0.100", "rollForward": "latestMinor" } } \ No newline at end of file diff --git a/src/ARCExpect/ARCExpect.fsproj b/src/ARCExpect/ARCExpect.fsproj index 5a06b08..19c6cdc 100644 --- a/src/ARCExpect/ARCExpect.fsproj +++ b/src/ARCExpect/ARCExpect.fsproj @@ -7,6 +7,7 @@ + @@ -24,6 +25,8 @@ + + diff --git a/src/ARCExpect/RELEASE_NOTES.md b/src/ARCExpect/RELEASE_NOTES.md new file mode 100644 index 0000000..207a91d --- /dev/null +++ b/src/ARCExpect/RELEASE_NOTES.md @@ -0,0 +1 @@ +### 1.0.0 - tbd \ No newline at end of file diff --git a/src/ARCExpect/packages.lock.json b/src/ARCExpect/packages.lock.json index c490b33..d16dad4 100644 --- a/src/ARCExpect/packages.lock.json +++ b/src/ARCExpect/packages.lock.json @@ -40,9 +40,9 @@ }, "FSharp.Core": { "type": "Direct", - "requested": "[6.0.7, )", - "resolved": "6.0.7", - "contentHash": "e6wGrq5smV3Yk2fBE/Y0nBG5oFyF59k5Je0a0QDydUpg6liyaafGjD3xvutciKepCP2knspZ/sWViC/F1OyyQQ==" + "requested": "[8.0.100, )", + "resolved": "8.0.100", + "contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg==" }, "FSharpAux": { "type": "Direct", diff --git a/src/ARCValidationPackages/ARCValidationPackages.fsproj b/src/ARCValidationPackages/ARCValidationPackages.fsproj index f1539eb..8d4a05a 100644 --- a/src/ARCValidationPackages/ARCValidationPackages.fsproj +++ b/src/ARCValidationPackages/ARCValidationPackages.fsproj @@ -7,6 +7,7 @@ + @@ -17,6 +18,8 @@ + + diff --git a/src/ARCValidationPackages/RELEASE_NOTES.md b/src/ARCValidationPackages/RELEASE_NOTES.md new file mode 100644 index 0000000..207a91d --- /dev/null +++ b/src/ARCValidationPackages/RELEASE_NOTES.md @@ -0,0 +1 @@ +### 1.0.0 - tbd \ No newline at end of file diff --git a/src/ARCValidationPackages/packages.lock.json b/src/ARCValidationPackages/packages.lock.json index afde8bd..5941bc1 100644 --- a/src/ARCValidationPackages/packages.lock.json +++ b/src/ARCValidationPackages/packages.lock.json @@ -22,9 +22,9 @@ }, "FSharp.Core": { "type": "Direct", - "requested": "[6.0.7, )", - "resolved": "6.0.7", - "contentHash": "e6wGrq5smV3Yk2fBE/Y0nBG5oFyF59k5Je0a0QDydUpg6liyaafGjD3xvutciKepCP2knspZ/sWViC/F1OyyQQ==" + "requested": "[8.0.100, )", + "resolved": "8.0.100", + "contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg==" }, "FsHttp": { "type": "Direct", diff --git a/src/arc-validate/RELEASE_NOTES.md b/src/arc-validate/RELEASE_NOTES.md new file mode 100644 index 0000000..207a91d --- /dev/null +++ b/src/arc-validate/RELEASE_NOTES.md @@ -0,0 +1 @@ +### 1.0.0 - tbd \ No newline at end of file diff --git a/src/arc-validate/arc-validate.fsproj b/src/arc-validate/arc-validate.fsproj index 3d77395..d280a41 100644 --- a/src/arc-validate/arc-validate.fsproj +++ b/src/arc-validate/arc-validate.fsproj @@ -2,11 +2,14 @@ Exe - net6.0 + net8.0 true + + + @@ -23,13 +26,28 @@ - + - - + + + + + <_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.PackageVersion)' != ''" /> + <_ProjectReferenceWithExactPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.ExactVersion)' == 'true'" /> + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExplicitPackageVersion)' == '@(_ProjectReferencesWithVersions)'"> + @(_ProjectReferenceWithExplicitPackageVersion->'%(PackageVersion)') + + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExactPackageVersion)' == '@(_ProjectReferencesWithVersions)'"> + [@(_ProjectReferencesWithVersions->'%(ProjectVersion)')] + + <_ProjectReferencesWithVersions Remove="@(_ProjectReferenceWithReassignedVersion)" /> + <_ProjectReferencesWithVersions Include="@(_ProjectReferenceWithReassignedVersion)" /> + + + diff --git a/src/arc-validate/packages.lock.json b/src/arc-validate/packages.lock.json index 8519f87..1428f95 100644 --- a/src/arc-validate/packages.lock.json +++ b/src/arc-validate/packages.lock.json @@ -1,7 +1,7 @@ { "version": 1, "dependencies": { - "net6.0": { + "net8.0": { "AnyBadge.NET": { "type": "Direct", "requested": "[1.0.0, 1.0.0]", @@ -14,9 +14,9 @@ }, "Argu": { "type": "Direct", - "requested": "[6.1.1, 6.1.1]", - "resolved": "6.1.1", - "contentHash": "5SBLYihaZ6/YNpRU+0v0QLsCk7ABmOWNOUwkXVUql2w7kJ6Hi4AFhgIv5XLTtxTid5/xrJAL+PglQkNcjANCJg==", + "requested": "[6.1.4, 6.1.4]", + "resolved": "6.1.4", + "contentHash": "tYK5fxBgF8DJSvrI4KseqEwMA3Mcee+bgP2EcimxTqiiFSpZLgSbBG7yU22xb78CXMX40sb0OaLshZReObNGRw==", "dependencies": { "FSharp.Core": "4.3.2", "System.Configuration.ConfigurationManager": "4.4.0" @@ -34,9 +34,9 @@ }, "FSharp.Core": { "type": "Direct", - "requested": "[6.0.7, )", - "resolved": "6.0.7", - "contentHash": "e6wGrq5smV3Yk2fBE/Y0nBG5oFyF59k5Je0a0QDydUpg6liyaafGjD3xvutciKepCP2knspZ/sWViC/F1OyyQQ==" + "requested": "[8.0.100, )", + "resolved": "8.0.100", + "contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg==" }, "ARCTokenization": { "type": "Transitive", @@ -924,7 +924,7 @@ "ARCTokenization": "[1.2.0, 1.2.0]", "Cytoscape.NET": "[0.2.0, 0.2.0]", "Expecto": "[9.0.4, 9.0.4]", - "FSharp.Core": "[6.0.7, )", + "FSharp.Core": "[8.0.100, )", "FSharpAux": "[2.0.0, 2.0.0]", "FsOboParser": "[0.3.0, 0.3.0]", "FsSpreadsheet": "[4.1.0, 4.1.0]", @@ -935,7 +935,7 @@ "arcvalidationpackages": { "type": "Project", "dependencies": { - "FSharp.Core": "[6.0.7, )", + "FSharp.Core": "[8.0.100, )", "Fake.DotNet.Cli": "[6.0.0, 6.0.0]", "FsHttp": "[11.0.0, 11.0.0]" } diff --git a/tests/ARCExpect.Tests/ARCExpect.Tests.fsproj b/tests/ARCExpect.Tests/ARCExpect.Tests.fsproj index a8cc43c..f4d6db9 100644 --- a/tests/ARCExpect.Tests/ARCExpect.Tests.fsproj +++ b/tests/ARCExpect.Tests/ARCExpect.Tests.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 false @@ -24,7 +24,7 @@ + - diff --git a/tests/ARCValidationPackages.Tests/ARCValidationPackages.Tests.fsproj b/tests/ARCValidationPackages.Tests/ARCValidationPackages.Tests.fsproj index c7a5fc0..7bd96a4 100644 --- a/tests/ARCValidationPackages.Tests/ARCValidationPackages.Tests.fsproj +++ b/tests/ARCValidationPackages.Tests/ARCValidationPackages.Tests.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 false @@ -23,7 +23,7 @@ + - diff --git a/tests/arc-validate.Tests/CLITests/PackageCommandTests.fs b/tests/arc-validate.Tests/CLITests/PackageCommandTests.fs index 8b221c7..4d89f25 100644 --- a/tests/arc-validate.Tests/CLITests/PackageCommandTests.fs +++ b/tests/arc-validate.Tests/CLITests/PackageCommandTests.fs @@ -27,7 +27,7 @@ let ``PackageCommand CLI Tests`` = test "arc-validate package install test" { resetConfigEnvironment() // make sure to remove any caching before running these tests - let proc = runTool "arc-validate" [|"package"; "install"; "test"|] + let proc = runTool "../../../../../publish/arc-validate" [|"package"; "install"; "test"|] let package = Path.Combine( @@ -51,7 +51,7 @@ let ``PackageCommand CLI Tests`` = Expect.isTrue (File.Exists(package)) "package file was not installed at expected location" - let proc = runTool "arc-validate" [|"package"; "uninstall"; "test"|] + let proc = runTool "../../../../../publish/arc-validate" [|"package"; "uninstall"; "test"|] Expect.equal proc.ExitCode 0 $"incorrect exit code.{System.Environment.NewLine}{proc.Result.Output}" Expect.isFalse (File.Exists(package)) "package file was not deleted" diff --git a/tests/arc-validate.Tests/CLITests/ValidateCommandTests.fs b/tests/arc-validate.Tests/CLITests/ValidateCommandTests.fs index 87b2a9e..4254ac8 100644 --- a/tests/arc-validate.Tests/CLITests/ValidateCommandTests.fs +++ b/tests/arc-validate.Tests/CLITests/ValidateCommandTests.fs @@ -20,7 +20,13 @@ let ``ValidateCommand CLI Tests`` = testList "arc validate CLI tests" [ testSequenced ( testList "arc-validate validate -i fixtures/arcs/inveniotestarc" [ - let proc = runTool "arc-validate" [|"validate"; "-i"; "fixtures/arcs/inveniotestarc"|] + + printfn "%s" (Path.GetFullPath("fixtures/arcs/inveniotestarc")) + + let proc = runTool "../../../../../publish/arc-validate" [|"validate"; "-i"; "fixtures/arcs/inveniotestarc"|] + + printfn "%s" proc.Result.Output + printfn "%s" proc.Result.Error test "exit code is 0 (Success)" { Expect.equal proc.ExitCode 0 $"incorrect exit code: {proc.Result.Error} | {proc.Result.Output}" diff --git a/tests/arc-validate.Tests/arc-validate.Tests.fsproj b/tests/arc-validate.Tests/arc-validate.Tests.fsproj index d47bb1c..21f9512 100644 --- a/tests/arc-validate.Tests/arc-validate.Tests.fsproj +++ b/tests/arc-validate.Tests/arc-validate.Tests.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 false @@ -21,7 +21,7 @@ - - + +