Skip to content

Commit

Permalink
Fix CI errors
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Jul 31, 2024
1 parent a99fde7 commit 2e23cbc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 36 deletions.
61 changes: 31 additions & 30 deletions build/scripts/Targets.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ open Fake.IO.Globbing.Operators

module Main =

let private target name action = Targets.Target(name, Action(action))
let private target name action = Targets.Target(name, Action(action))
let private skip name = printfn "SKIPPED target '%s' evaluated not to run" name |> ignore
let private conditional name optional action = target name (if optional then action else (fun _ -> skip name))
let private conditional name optional action = target name (if optional then action else (fun _ -> skip name))
let private command name (dependencies: IEnumerable<string>) action = Targets.Target(name, dependencies, Action(action))
let private conditionalCommand name dependencies optional action = command name dependencies (if optional then action else (fun _ -> skip name))
let private conditionalCommand name dependencies optional action = command name dependencies (if optional then action else (fun _ -> skip name))

/// <summary>Sets command line environments indicating we are building from the command line</summary>
let setCommandLineEnvVars () =
Environment.setEnvironVar"OSC_COMMAND_LINE_BUILD" "1"

let sourceDir = Paths.TestsSource("Tests.Configuration");
let defaultYaml = Path.Combine(sourceDir, "tests.default.yaml");
let userYaml = Path.Combine(sourceDir, "tests.yaml");
Expand All @@ -56,59 +56,60 @@ module Main =
| (true, _) -> Environment.setEnvironVar "OSC_YAML_FILE" (Path.GetFullPath(userYaml))
| (_, true) -> Environment.setEnvironVar "OSC_YAML_FILE" (Path.GetFullPath(defaultYaml))
| _ -> failwithf "Expected to find a tests.default.yaml or tests.yaml in %s" sourceDir
let [<EntryPoint>] main args =


let [<EntryPoint>] main args =
async {
do! Async.SwitchToThreadPool ()

setCommandLineEnvVars ()

let parsed = Commandline.parse (args |> Array.toList)

let buildVersions = Versioning.BuildVersioning parsed
let artifactsVersion = Versioning.ArtifactsVersion buildVersions
Versioning.Validate parsed.Target buildVersions

let isCanary = parsed.Target = "canary";

Tests.SetTestEnvironmentVariables parsed

let testChain = ["clean"; "version"; "restore"; "full-build"; ]
let buildChain = ["test"; "inherit-doc" ]
let releaseChain =
[
[
"build";
"nuget-pack";
"nuget-pack-versioned";
// "nuget-pack-versioned";
"validate-artifacts";
"generate-release-notes"
]
let canaryChain = [ "version"; "release"; "test-nuget-package";]
// the following are expected to be called as targets directly
conditional "clean" (parsed.ReleaseBuild || parsed.Target = "clean") <| fun _ -> Build.Clean parsed

// the following are expected to be called as targets directly
conditional "clean" (parsed.ReleaseBuild || parsed.Target = "clean") <| fun _ -> Build.Clean parsed
target "version" <| fun _ -> printfn "Artifacts Version: %O" artifactsVersion
target "restore" Build.Restore

target "restore" Build.Restore
target "full-build" <| fun _ -> Build.Compile parsed artifactsVersion

//TEST
conditionalCommand "test" testChain (not parsed.SkipTests && not isCanary) <| fun _ -> Tests.RunUnitTests parsed

target "inherit-doc" <| InheritDoc.PatchInheritDocs

//BUILD
command "build" buildChain <| fun _ -> printfn "STARTING BUILD"

target "nuget-pack" <| fun _ -> Build.Pack artifactsVersion

conditional "nuget-pack-versioned" (isCanary) <| fun _ -> Build.VersionedPack artifactsVersion
// TODO: Re-enable once assembly-rewriter supports .NET 8.0
// conditional "nuget-pack-versioned" (isCanary) <| fun _ -> Build.VersionedPack artifactsVersion

conditional "generate-release-notes" (not isCanary) <| fun _ -> ReleaseNotes.GenerateNotes buildVersions

target "validate-artifacts" <| fun _ -> Versioning.ValidateArtifacts artifactsVersion

//RELEASE
command "release" releaseChain <| fun _ ->
let outputPath = match parsed.CommandArguments with | Commandline.SetVersion c -> c.OutputLocation | _ -> None
Expand All @@ -124,18 +125,18 @@ module Main =
printfn "Finished Release Build %O, output copied to: %s" artifactsVersion path

conditional "test-nuget-package" (not parsed.SkipTests) <| fun _ -> Tests.RunReleaseUnitTests artifactsVersion parsed

//CANARY
command "canary" canaryChain <| fun _ -> printfn "Finished Release Build %O" artifactsVersion

// ADDITIONAL COMMANDS

command "cluster" [ "restore"; "full-build" ] <| fun _ ->
ReposTooling.LaunchCluster parsed

command "codegen" [ ] <| fun _ ->
ReposTooling.GenerateApi parsed.RemainingArguments

command "rest-spec-tests" [ ] <| fun _ ->
ReposTooling.RestSpecTests parsed.RemainingArguments

Expand All @@ -145,5 +146,5 @@ module Main =

do! Targets.RunTargetsAndExitAsync([parsed.Target], (fun e -> e.GetType() = typeof<ProcExecException>)) |> Async.AwaitTask
} |> Async.RunSynchronously

0
10 changes: 5 additions & 5 deletions dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
"isRoot": true,
"tools": {
"assembly-rewriter": {
"version": "0.12.0",
"version": "0.13.0",
"commands": [
"assembly-rewriter"
]
},
"assembly-differ": {
"version": "0.13.0",
"version": "0.15.0",
"commands": [
"assembly-differ"
]
},
"nupkg-validator": {
"version": "0.4.0",
"version": "0.6.0",
"commands": [
"nupkg-validator"
]
},
"release-notes": {
"version": "0.3.1",
"version": "0.6.0",
"commands": [
"release-notes"
]
}
}
}
}
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"version": "2.0.0",
"doc_current": "2.0",
"doc_branch": "2.x"
}
}

0 comments on commit 2e23cbc

Please sign in to comment.