devel: Migrate from FAKE to Just

Also updates dotnetPackage CIs to v4.4
This commit is contained in:
2025-12-04 22:19:39 +01:00
parent 453c9d234c
commit 1cb9d455db
36 changed files with 417 additions and 903 deletions

View File

@@ -1,37 +0,0 @@
open Fake.Core
open Fake.IO
open Farmer
open Farmer.Builders
open Helpers
initializeContext()
let packPath = Path.getFullName "packages"
Target.create "Clean" (fun _ -> Shell.cleanDir packPath)
Target.create "InstallClient" (fun _ ->
run dotnet "tool restore" "."
)
Target.create "Run" ignore
Target.create "Format" (fun _ ->
run dotnet "fantomas . -r" "src"
)
open Fake.Core.TargetOperators
let dependencies = [
"Clean"
==> "InstallClient"
"Run"
==> "InstallClient"
"Format"
]
[<EntryPoint>]
let main args = runOrDefault args

View File

@@ -1,129 +0,0 @@
module Helpers
open Fake.Core
let initializeContext () =
let execContext = Context.FakeExecutionContext.Create false "build.fsx" [ ]
Context.setExecutionContext (Context.RuntimeContext.Fake execContext)
module Proc =
module Parallel =
open System
let locker = obj()
let colors =
[| ConsoleColor.Blue
ConsoleColor.Yellow
ConsoleColor.Magenta
ConsoleColor.Cyan
ConsoleColor.DarkBlue
ConsoleColor.DarkYellow
ConsoleColor.DarkMagenta
ConsoleColor.DarkCyan |]
let print color (colored: string) (line: string) =
lock locker
(fun () ->
let currentColor = Console.ForegroundColor
Console.ForegroundColor <- color
Console.Write colored
Console.ForegroundColor <- currentColor
Console.WriteLine line)
let onStdout index name (line: string) =
let color = colors.[index % colors.Length]
if isNull line then
print color $"{name}: --- END ---" ""
else if String.isNotNullOrEmpty line then
print color $"{name}: " line
let onStderr name (line: string) =
let color = ConsoleColor.Red
if isNull line |> not then
print color $"{name}: " line
let redirect (index, (name, createProcess)) =
createProcess
|> CreateProcess.redirectOutputIfNotRedirected
|> CreateProcess.withOutputEvents (onStdout index name) (onStderr name)
let printStarting indexed =
for (index, (name, c: CreateProcess<_>)) in indexed do
let color = colors.[index % colors.Length]
let wd =
c.WorkingDirectory
|> Option.defaultValue ""
let exe = c.Command.Executable
let args = c.Command.Arguments.ToStartInfo
print color $"{name}: {wd}> {exe} {args}" ""
let run cs =
cs
|> Seq.toArray
|> Array.indexed
|> fun x -> printStarting x; x
|> Array.map redirect
|> Array.Parallel.map Proc.run
let createProcess exe arg dir =
CreateProcess.fromRawCommandLine exe arg
|> CreateProcess.withWorkingDirectory dir
|> CreateProcess.ensureExitCode
let dotnet = createProcess "dotnet"
// NOTE: Uses dotnet-tools from nixpkgs
let fable = createProcess "fable"
let fantomas = createProcess "fantomas"
let bun =
let bunPath =
match ProcessUtils.tryFindFileOnPath "bun" with
| Some path -> path
| None ->
"bun was not found in path. Please install it and make sure it's available from your path. " +
"See https://safe-stack.github.io/docs/quickstart/#install-pre-requisites for more info"
|> failwith
createProcess bunPath
let bunx = createProcess "bunx"
type BundleMode =
| Prod
| Devel
| Watch
with
override this.ToString() =
match this with
| Prod -> "production"
| Devel -> "development"
| Watch -> "watch"
let viteCmd (m: BundleMode) outDir =
match m with
| Prod -> $"vite build -c ../../vite.config.js -m {m} --emptyOutDir --outDir {outDir}/public"
| Devel -> $"vite build -c ../../vite.config.js -m {m} --minify false --sourcemap true --emptyOutDir --outDir {outDir}/public"
| Watch -> "vite -c ../../vite.config.js"
let run proc arg dir =
proc arg dir
|> Proc.run
|> ignore
let runParallel processes =
processes
|> Proc.Parallel.run
|> ignore
let runOrDefault args =
try
match args with
| [| target |] -> Target.runOrDefault target
| _ ->
Target.runOrDefault "Run"
0
with e ->
printfn "%A" e
1

2
.envrc
View File

@@ -11,6 +11,8 @@ use nix
# HACK: Workaround for direnv bug
unset TMP TMPDIR TEMP TEMPDIR
export NPINS_DIRECTORY="nix"
# HACK: Configure Rider to use the correct .NET paths from an ambient .NET
use_rider_dotnet() {
# Get paths

View File

@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include=".build/Helpers.fs" />
<Compile Include=".build/Build.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fake.Core.Target" />
<PackageReference Include="Fake.DotNet.Cli" />
<PackageReference Include="Fake.IO.FileSystem" />
<PackageReference Include="Farmer" />
<PackageReference Include="FSharp.Core" />
</ItemGroup>
</Project>

View File

@@ -81,11 +81,6 @@
<PackageVersion Include="MessagePack" Version="3.1.3" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="ProjNet.FSharp" Version="5.2.0" />
<!-- Build -->
<PackageVersion Include="Fake.Core.Target" Version="6.1.3" />
<PackageVersion Include="Fake.DotNet.Cli" Version="6.1.3" />
<PackageVersion Include="Fake.IO.FileSystem" Version="6.1.3" />
<PackageVersion Include="Farmer" Version="1.9.6" />
<!-- Dapperizer -->
<PackageVersion Include="Oceanbox.SDSLite" Version="2.8.0" />
<PackageVersion Include="Dapper.FSharp" Version="4.9.0"/>

42
justfile Normal file
View File

@@ -0,0 +1,42 @@
# Poseidon build commands
# Install just: https://github.com/casey/just
#
# Sub-projects with justfiles:
# - Atlantis (src/Atlantis) - Server + Client application with Fable/Vite
# - ServerPack (src/ServerPack) - Server package library
# - DataAgent (src/DataAgent) - Data agent library
# - Interfaces (src/Interfaces) - API interfaces library
# - Archivist (src/Archivist) - CLI tool with client
# - Sorcerer (src/Sorcerer) - Server application with client
#
# Run 'just <project>' to see available commands for each project (e.g., 'just atlantis')
set dotenv-load
# Default recipe - show available commands
default:
@just --list
# Show available commands for Atlantis (src/Atlantis)
atlantis:
@just src/Atlantis/
# Show available commands for ServerPack (src/ServerPack)
serverpack:
@just src/ServerPack/
# Show available commands for DataAgent (src/DataAgent)
dataagent:
@just src/DataAgent/
# Show available commands for Interfaces (src/Interfaces)
interfaces:
@just src/Interfaces/
# Show available commands for Archivist (src/Archivist)
archivist:
@just src/Archivist/
# Show available commands for Sorcerer (src/Sorcerer)
sorcerer:
@just src/Sorcerer/

View File

@@ -9,8 +9,8 @@
},
"branch": "main",
"submodules": false,
"revision": "2f0f812f69f3eb4140157fe15e12739adf82e32a",
"url": "https://github.com/ryantm/agenix/archive/2f0f812f69f3eb4140157fe15e12739adf82e32a.tar.gz",
"revision": "fcdea223397448d35d9b31f798479227e80183f6",
"url": "https://github.com/ryantm/agenix/archive/fcdea223397448d35d9b31f798479227e80183f6.tar.gz",
"hash": "1d4m7hsq727q7ndjqmgyl8vkbkqjwps962ygmv2mcc5dbqzgn963"
},
"nix-utils": {
@@ -28,8 +28,8 @@
"nixpkgs": {
"type": "Channel",
"name": "nixpkgs-unstable",
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-25.11pre880343.87848bf0cc4f/nixexprs.tar.xz",
"hash": "134c1sx06gxh7a4jnf618bi4c2wa949fm14w34cjhsryqjs3a8ha"
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre905319.f720de590661/nixexprs.tar.xz",
"hash": "07n4hhch0j6n69b0zchdjg0l80z2xrdk7k57ykv90cvhklim5dz1"
},
"pre-commit": {
"type": "Git",
@@ -40,9 +40,9 @@
},
"branch": "master",
"submodules": false,
"revision": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37",
"url": "https://github.com/cachix/git-hooks.nix/archive/ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37.tar.gz",
"hash": "11r45r45qcfv77rx024mqpra2yixnc5g248kp7rmccq09vll1y85"
"revision": "50b9238891e388c9fdc6a5c49e49c42533a1b5ce",
"url": "https://github.com/cachix/git-hooks.nix/archive/50b9238891e388c9fdc6a5c49e49c42533a1b5ce.tar.gz",
"hash": "01z1ihgpc7z7s97k9gn7vskw5zl8p6xavysdlmis1w0w4c3jfms2"
}
},
"version": 5

View File

@@ -26,6 +26,7 @@ pkgs.mkShellNoCC {
mkcert
dive
nix-output-monitor
just
# Secret management with agenix
agenix
@@ -41,7 +42,6 @@ pkgs.mkShellNoCC {
DOTNET_ROOT = "${dotnet-sdk}/share/dotnet";
DOTNET_CLI_TELEMETRY_OPTOUT = "true";
LOG_LEVEL = "verbose";
NPINS_DIRECTORY = "nix";
# Alternative shells
passthru = pkgs.lib.mapAttrs (name: value: pkgs.mkShellNoCC (value // { inherit name; })) {
@@ -61,4 +61,4 @@ pkgs.mkShellNoCC {
'';
};
};
}
}

View File

@@ -1,67 +0,0 @@
open Fake.Core
open Fake.IO
open Farmer
open Farmer.Builders
open Helpers
initializeContext()
let clientPath = Path.getFullName "src/Client"
let cliPath = Path.getFullName "src/Cli"
let testPath = Path.getFullName "tests"
let distPath = Path.getFullName "dist"
let vite = $"bunx --bun vite -c ../../vite.config.js"
let viteBundle = $"{vite} build --outDir {distPath}/public"
Target.create "Clean" (fun _ -> Shell.cleanDir distPath)
// Target.create "Bundle" (fun _ ->
// let vite = $"{viteBundle} -m production"
// run dotnet $"publish -c Release -o \"{distPath}\"" serverPath
// run fable $"-o build/client --run {vite}" clientPath
// )
// Target.create "BundleDebug" (fun _ ->
// let vite = $"{viteBundle} -m development --minify false"
// run dotnet $"publish -c Debug -o \"{distPath}\"" serverPath
// run fable $"-o build/client --run {vite}" clientPath
// )
Target.create "Bundle" (fun _ ->
run dotnet $"publish -c Release -o \"{distPath}\"" cliPath
)
Target.create "BundleDebug" (fun _ ->
run dotnet $"publish -c Debug -o \"{distPath}\"" cliPath
)
Target.create "Format" (fun _ ->
run fantomas ". -r" "src"
)
Target.create "Test" (fun _ ->
if System.IO.Directory.Exists testPath then
run dotnet "run" testPath
else ()
)
Target.create "Run" (fun _ -> Target.runOrDefault "Bundle")
open Fake.Core.TargetOperators
let dependencies = [
"Clean"
==> "Bundle"
"Clean"
==> "BundleDebug"
"Clean"
==> "Test"
]
[<EntryPoint>]
let main args = runOrDefault args

View File

@@ -1,116 +0,0 @@
module Helpers
open Fake.Core
let initializeContext () =
let execContext = Context.FakeExecutionContext.Create false "build.fsx" [ ]
Context.setExecutionContext (Context.RuntimeContext.Fake execContext)
module Proc =
module Parallel =
open System
let locker = obj()
let colors =
[| ConsoleColor.Blue
ConsoleColor.Yellow
ConsoleColor.Magenta
ConsoleColor.Cyan
ConsoleColor.DarkBlue
ConsoleColor.DarkYellow
ConsoleColor.DarkMagenta
ConsoleColor.DarkCyan |]
let print color (colored: string) (line: string) =
lock locker
(fun () ->
let currentColor = Console.ForegroundColor
Console.ForegroundColor <- color
Console.Write colored
Console.ForegroundColor <- currentColor
Console.WriteLine line)
let onStdout index name (line: string) =
let color = colors.[index % colors.Length]
if isNull line then
print color $"{name}: --- END ---" ""
else if String.isNotNullOrEmpty line then
print color $"{name}: " line
let onStderr name (line: string) =
let color = ConsoleColor.Red
if isNull line |> not then
print color $"{name}: " line
let redirect (index, (name, createProcess)) =
createProcess
|> CreateProcess.redirectOutputIfNotRedirected
|> CreateProcess.withOutputEvents (onStdout index name) (onStderr name)
let printStarting indexed =
for (index, (name, c: CreateProcess<_>)) in indexed do
let color = colors.[index % colors.Length]
let wd =
c.WorkingDirectory
|> Option.defaultValue ""
let exe = c.Command.Executable
let args = c.Command.Arguments.ToStartInfo
print color $"{name}: {wd}> {exe} {args}" ""
let run cs =
cs
|> Seq.toArray
|> Array.indexed
|> fun x -> printStarting x; x
|> Array.map redirect
|> Array.Parallel.map Proc.run
let createProcess exe arg dir =
CreateProcess.fromRawCommandLine exe arg
|> CreateProcess.withWorkingDirectory dir
|> CreateProcess.ensureExitCode
let dotnet = createProcess "dotnet"
let fable = createProcess "fable"
let fantomas = createProcess "fantomas"
type BundleMode =
| Prod
| Devel
| Watch
with
override this.ToString() =
match this with
| Prod -> "production"
| Devel -> "development"
| Watch -> "watch"
let viteCmd (m: BundleMode) outDir =
match m with
| Prod -> $"vite build -c ../../vite.config.js -m {m} --emptyOutDir --outDir {outDir}/public"
| Devel -> $"vite build -c ../../vite.config.js -m {m} --minify false --sourcemap true --emptyOutDir --outDir {outDir}/public"
| Watch -> "vite -c ../../vite.config.js"
let run proc arg dir =
proc arg dir
|> Proc.run
|> ignore
let runParallel processes =
processes
|> Proc.Parallel.run
|> ignore
let runOrDefault args =
try
match args with
| [| target |] -> Target.runOrDefault target
| _ ->
Target.runOrDefault "Run"
0
with e ->
printfn "%A" e
1

View File

@@ -1,15 +1,15 @@
# yaml-language-server: $schema=https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json
variables:
SKIP_TESTS: "true"
SKIP_TESTS: "true"
include:
- project: oceanbox/gitlab-ci
ref: v4.4
file: DotnetDeployment.gitlab-ci.yml
inputs:
project-name: archivist
project-dir: src/Cli
- project: oceanbox/gitlab-ci
ref: v4.4
file: DotnetDeployment.gitlab-ci.yml
inputs:
project-name: archivist
project-dir: src/Cli
dockerize-archivist:
tags:
- nix
- nix

View File

@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include=".build/Helpers.fs" />
<Compile Include=".build/Build.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fake.Core.Target" />
<PackageReference Include="Fake.DotNet.Cli" />
<PackageReference Include="Fake.IO.FileSystem" />
<PackageReference Include="Farmer" />
<PackageReference Include="FSharp.Core" />
</ItemGroup>
</Project>

40
src/Archivist/justfile Normal file
View File

@@ -0,0 +1,40 @@
# Archivist build commands
# Install just: https://github.com/casey/just
set dotenv-load
src_path := "src"
client_path := "src/Client"
cli_path := "src/Cli"
test_path := "tests"
dist_path := "dist"
# Default recipe - show available commands
default:
@just --list
# Clean build artifacts
clean:
rm -rf {{dist_path}}
# Build production bundle
bundle: clean
dotnet publish -c Release -o {{dist_path}} {{cli_path}}
# Build debug bundle
bundle-debug: clean
dotnet publish -c Debug -o {{dist_path}} {{cli_path}}
# Format code with Fantomas
format:
fantomas {{src_path}} -r
# Run tests
test: clean
#!/usr/bin/env bash
if [ -d "{{test_path}}" ]; then
dotnet run {{test_path}}
fi
# Run (builds bundle)
run: bundle

View File

@@ -1,90 +0,0 @@
open Fake.Core
open Fake.IO
open Farmer
open Farmer.Builders
open Helpers
initializeContext()
let serverPath = Path.getFullName "src/Server"
let clientPath = Path.getFullName "src/Client"
let testPath = Path.getFullName "test"
let libPath = Path.getFullName "src/Interfaces" |> Some
let distPath = Path.getFullName "dist"
let packPath = Path.getFullName "packages"
let versionFile = Path.getFullName ".version"
let vite = """bunx --bun vite -c ../../vite.config.js"""
let fableOpt opts =
$"-e .jsx -o build --test:MSBuildCracker --run {vite} build --emptyOutDir --outDir {distPath}/public {opts}"
let fableWatch = $"watch -e .jsx -o build --run {vite}"
Target.create "Clean" (fun _ -> Shell.cleanDir distPath)
Target.create "Bundle" (fun _ ->
[ "server", dotnet $"build -tl -c Release -o {distPath} -p:DefineConstants=" serverPath
"client", fable (fableOpt "-m production") clientPath ]
|> runParallel
)
Target.create "BundleDebug" (fun _ ->
[ "server", dotnet $"build -tl -c Debug -o {distPath} -p:DefineConstants=" serverPath
"client", fable (fableOpt "-m development --minify false --sourcemap true") clientPath ]
|> runParallel
)
Target.create "Pack" (fun _ ->
match libPath with
| Some p -> run dotnet $"pack -c Release -o \"{packPath}\"" p
| None -> ()
)
Target.create "Run" (fun _ ->
[ "server", dotnet "watch run" serverPath
"client", fable fableWatch clientPath ]
|> runParallel
)
Target.create "Client" (fun _ ->
run fable fableWatch clientPath
)
Target.create "Format" (fun _ ->
run fantomas ". -r" "src"
)
Target.create "Test" (fun _ ->
if System.IO.Directory.Exists testPath then
[ "server", dotnet "run" (testPath + "/Server")
"client", fable $"-e .jsx -o build --run {vite}" (testPath + "/Client") ]
|> runParallel
else ()
)
open Fake.Core.TargetOperators
let dependencies = [
"Clean"
==> "Bundle"
"Clean"
==> "BundleDebug"
"Clean"
==> "Test"
"Clean"
==> "Run"
"Clean"
==> "Pack"
"Client"
]
[<EntryPoint>]
let main args = runOrDefault args

View File

@@ -1,15 +1,15 @@
# yaml-language-server: $schema=https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json
variables:
SKIP_TESTS: "true"
SKIP_TESTS: "true"
include:
- project: oceanbox/gitlab-ci
ref: v4.4
file: DotnetDeployment.gitlab-ci.yml
inputs:
project-name: atlantis
project-dir: src/Atlantis
- project: oceanbox/gitlab-ci
ref: v4.4
file: DotnetDeployment.gitlab-ci.yml
inputs:
project-name: atlantis
project-dir: src/Atlantis
dockerize-atlantis:
tags:
- nix
- nix

View File

@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="../../.build/Helpers.fs" />
<Compile Include=".build/Build.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fake.Core.Target" />
<PackageReference Include="Fake.DotNet.Cli" />
<PackageReference Include="Fake.IO.FileSystem" />
<PackageReference Include="Farmer" />
<PackageReference Include="FSharp.Core" />
</ItemGroup>
</Project>

View File

@@ -60,13 +60,13 @@ k8s_yaml(namespace_inject(blob(kustomizations), namespace))
local_resource(
'create-bundle',
cmd='dotnet run bundledebug',
cmd='just bundle-debug',
trigger_mode=TRIGGER_MODE_MANUAL
)
local_resource(
'build-server',
cmd='dotnet publish -o ./dist src/Server',
cmd='just bundle-debug-server',
deps=[
'./src/Server',
'./src/Shared'
@@ -84,7 +84,7 @@ local_resource(
local_resource(
'run-client',
serve_cmd='fable watch -e .jsx -o build --run vite -c ../../vite.config.js',
serve_cmd='just run-client',
serve_dir='./src/Client',
links=['https://{name}.local.oceanbox.io:{port}'.format(name=name, port=clientPort)],
resource_deps=['build-server'],

75
src/Atlantis/justfile Normal file
View File

@@ -0,0 +1,75 @@
# Atlantis build commands
# Install just: https://github.com/casey/just
set dotenv-load
src_path := "src"
server_path := "src/Server"
client_path := "src/Client"
test_path := "test"
lib_path := "src/Interfaces"
dist_path := "dist"
pack_path := "packages"
vite := "bunx --bun vite -c vite.config.js"
# Default recipe - show available commands
default:
@just --list
# Clean build artifacts
clean:
rm -rf {{dist_path}}
# Build production bundle (server + client)
[parallel]
bundle: clean bundle-server bundle-client
bundle-server:
dotnet build -tl -c Release -o {{dist_path}} {{server_path}}
bundle-client:
fable {{client_path}} -e .jsx -o build --test:MSBuildCracker --run {{vite}} build -m production --emptyOutDir --outDir {{dist_path}}/public
# Build debug bundle (server + client)
[parallel]
bundle-debug: clean bundle-debug-server bundle-debug-client
bundle-debug-server:
dotnet build -tl -c Debug -o {{dist_path}} {{server_path}}
bundle-debug-client:
fable {{client_path}} -e .jsx -o build --test:MSBuildCracker --run {{vite}} build -m development --minify false --sourcemap true --emptyOutDir --outDir {{dist_path}}/public
# Create NuGet package
pack: clean
dotnet pack -c Release -o "{{pack_path}}" {{lib_path}}
# Run development server (watch mode)
[parallel]
run: clean run-server run-client
run-server:
dotnet watch run {{server_path}}
run-client:
fable watch {{client_path}} -e .jsx -o build --run {{vite}}
# Run client only in watch mode
client:
fable watch {{client_path}} -e .jsx -o build --run {{vite}}
# Format code with Fantomas
format:
fantomas {{src_path}} -r
# Run tests
[parallel]
test: clean test-server test-client
test-server:
dotnet run {{test_path}}/Server
test-client:
fable {{test_path}}/Client -e .jsx -o build --run {{vite}}

View File

@@ -1545,7 +1545,7 @@
"Hipster.Api": "[1.0.1, )",
"Oceanbox.DataAgent": "[7.3.0, )",
"Oceanbox.DataAgent.Api": "[7.2.1, )",
"Oceanbox.ServerPack": "[1.33.0, )",
"Oceanbox.ServerPack": "[1.35.2, )",
"Petimeter.Api": "[1.0.0, )"
}
},

View File

@@ -1,59 +0,0 @@
open Fake.Core
open Fake.IO
open Farmer
open Farmer.Builders
open Helpers
initializeContext()
let libPath = Path.getFullName "src/DataAgent"
let testPath = Path.getFullName "tests"
let distPath = Path.getFullName "dist"
let packPath = Path.getFullName "../../packages"
Target.create "Clean" (fun _ -> Shell.cleanDir distPath)
Target.create "Bundle" (fun _ ->
run dotnet $"publish -c Release -o \"{distPath}\"" libPath
)
Target.create "BundleDebug" (fun _ ->
run dotnet $"publish -c Debug -o \"{distPath}\"" libPath
)
Target.create "Pack" (fun _ ->
run dotnet $"pack -c Release -o \"{packPath}\"" libPath
)
Target.create "Format" (fun _ ->
run fantomas ". -r" "src"
)
Target.create "Test" (fun _ ->
if System.IO.Directory.Exists testPath then
run dotnet "run" testPath
else ()
)
Target.create "Run" (fun _ -> Target.runOrDefault "Pack")
open Fake.Core.TargetOperators
let dependencies = [
"Clean"
==> "Bundle"
"Clean"
==> "BundleDebug"
"Clean"
==> "Test"
"Clean"
==> "Pack"
]
[<EntryPoint>]
let main args = runOrDefault args

View File

@@ -1,12 +1,16 @@
# yaml-language-server: $schema=https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json
variables:
SKIP_TESTS: "true"
SKIP_SINGULARITY: "true"
SKIP_TESTS: "true"
SKIP_SINGULARITY: "true"
include:
- project: oceanbox/gitlab-ci
ref: v4.2
file: DotnetPackage.gitlab-ci.yml
inputs:
project-name: archmaester
project-dir: src/DataAgent
- project: oceanbox/gitlab-ci
ref: v4.4
file: DotnetPackage.gitlab-ci.yml
inputs:
project-name: archmaester
project-dir: src/DataAgent
dotnet-build-package-archmaester:
tags:
- nix

View File

@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="../../.build/Helpers.fs" />
<Compile Include=".build/Build.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fake.Core.Target" />
<PackageReference Include="Fake.DotNet.Cli" />
<PackageReference Include="Fake.IO.FileSystem" />
<PackageReference Include="Farmer" />
<PackageReference Include="FSharp.Core" />
</ItemGroup>
</Project>

44
src/DataAgent/justfile Normal file
View File

@@ -0,0 +1,44 @@
# DataAgent build commands
# Install just: https://github.com/casey/just
set dotenv-load
src_path := "src"
lib_path := "src/DataAgent"
test_path := "tests"
dist_path := "dist"
pack_path := "../../packages"
# Default recipe - show available commands
default:
@just --list
# Clean build artifacts
clean:
rm -rf {{dist_path}}
# Build production bundle
bundle: clean
dotnet publish -c Release -o {{dist_path}} {{lib_path}}
# Build debug bundle
bundle-debug: clean
dotnet publish -c Debug -o {{dist_path}} {{lib_path}}
# Create NuGet package
pack: clean
dotnet pack -c Release -o {{pack_path}} {{lib_path}}
# Format code with Fantomas
format:
fantomas {{src_path}} -r
# Run tests
test: clean
#!/usr/bin/env bash
if [ -d "{{test_path}}" ]; then
dotnet run {{test_path}}
fi
# Run (creates package)
run: pack

View File

@@ -1,59 +0,0 @@
open Fake.Core
open Fake.IO
open Farmer
open Farmer.Builders
open Helpers
initializeContext()
let libPath = Path.getFullName "Api"
let testPath = Path.getFullName "tests"
let distPath = Path.getFullName "dist"
let packPath = Path.getFullName "../../packages"
Target.create "Clean" (fun _ -> Shell.cleanDir distPath)
Target.create "Bundle" (fun _ ->
run dotnet $"publish -c Release -o \"{distPath}\"" libPath
)
Target.create "BundleDebug" (fun _ ->
run dotnet $"publish -c Debug -o \"{distPath}\"" libPath
)
Target.create "Pack" (fun _ ->
run dotnet $"pack -c Release -o \"{packPath}\"" libPath
)
Target.create "Format" (fun _ ->
run fantomas ". -r" "src"
)
Target.create "Test" (fun _ ->
if System.IO.Directory.Exists testPath then
run dotnet "run" testPath
else ()
)
Target.create "Run" (fun _ -> Target.runOrDefault "Pack")
open Fake.Core.TargetOperators
let dependencies = [
"Clean"
==> "Bundle"
"Clean"
==> "BundleDebug"
"Clean"
==> "Test"
"Clean"
==> "Pack"
]
[<EntryPoint>]
let main args = runOrDefault args

View File

@@ -1,12 +1,16 @@
# yaml-language-server: $schema=https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json
variables:
SKIP_TESTS: "true"
SKIP_SINGULARITY: "true"
SKIP_TESTS: "true"
SKIP_SINGULARITY: "true"
include:
- project: oceanbox/gitlab-ci
ref: v4.2
file: DotnetPackage.gitlab-ci.yml
inputs:
project-dir: src/Interfaces
project-name: interfaces
- project: oceanbox/gitlab-ci
ref: v4.4
file: DotnetPackage.gitlab-ci.yml
inputs:
project-name: interfaces
project-dir: src/Interfaces
dotnet-build-package-interfaces:
tags:
- nix

View File

@@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<Version>1.35.2</Version>
</PropertyGroup>
<ItemGroup>
<Compile Include="../../.build/Helpers.fs"/>
<Compile Include=".build/Build.fs"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fake.Core.Target"/>
<PackageReference Include="Fake.DotNet.Cli"/>
<PackageReference Include="Fake.IO.FileSystem"/>
<PackageReference Include="Farmer"/>
<PackageReference Include="FSharp.Core"/>
</ItemGroup>
</Project>

44
src/Interfaces/justfile Normal file
View File

@@ -0,0 +1,44 @@
# Interfaces build commands
# Install just: https://github.com/casey/just
set dotenv-load
src_path := "src"
lib_path := "Api"
test_path := "tests"
dist_path := "dist"
pack_path := "../../packages"
# Default recipe - show available commands
default:
@just --list
# Clean build artifacts
clean:
rm -rf {{dist_path}}
# Build production bundle
bundle: clean
dotnet publish -c Release -o {{dist_path}} {{lib_path}}
# Build debug bundle
bundle-debug: clean
dotnet publish -c Debug -o {{dist_path}} {{lib_path}}
# Create NuGet package
pack: clean
dotnet pack -c Release -o {{pack_path}} {{lib_path}}
# Format code with Fantomas
format:
fantomas {{src_path}} -r
# Run tests
test: clean
#!/usr/bin/env bash
if [ -d "{{test_path}}" ]; then
dotnet run {{test_path}}
fi
# Run (creates package)
run: pack

View File

@@ -1,59 +0,0 @@
open Fake.Core
open Fake.IO
open Farmer
open Farmer.Builders
open Helpers
initializeContext()
let srcPath = Path.getFullName "src"
let testPath = Path.getFullName "tests"
let distPath = Path.getFullName "dist"
let packPath = Path.getFullName "../../packages"
Target.create "Clean" (fun _ -> Shell.cleanDir distPath)
Target.create "Bundle" (fun _ ->
run dotnet $"publish -c Release -o {distPath}" srcPath
)
Target.create "BundleDebug" (fun _ ->
run dotnet $"publish -c Debug -o {distPath}" srcPath
)
Target.create "Pack" (fun _ ->
run dotnet $"pack -c Release -o {packPath}" srcPath
)
Target.create "Format" (fun _ ->
run fantomas ". -r" "src"
)
Target.create "Test" (fun _ ->
if System.IO.Directory.Exists testPath then
run dotnet "run" testPath
else ()
)
Target.create "Run" (fun _ -> Target.runOrDefault "Pack")
open Fake.Core.TargetOperators
let dependencies = [
"Clean"
==> "Bundle"
"Clean"
==> "BundleDebug"
"Clean"
==> "Test"
"Clean"
==> "Pack"
]
[<EntryPoint>]
let main args = runOrDefault args

View File

@@ -1,12 +1,16 @@
# yaml-language-server: $schema=https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json
variables:
SKIP_TESTS: "true"
SKIP_SINGULARITY: "true"
SKIP_TESTS: "true"
SKIP_SINGULARITY: "true"
include:
- project: oceanbox/gitlab-ci
ref: v4.2
file: DotnetPackage.gitlab-ci.yml
inputs:
project-name: serverpack
project-dir: src/ServerPack
- project: oceanbox/gitlab-ci
ref: v4.4
file: DotnetPackage.gitlab-ci.yml
inputs:
project-name: serverpack
project-dir: src/ServerPack
dotnet-build-package-serverpack:
tags:
- nix

View File

@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="../../.build/Helpers.fs" />
<Compile Include=".build/Build.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fake.Core.Target" />
<PackageReference Include="Fake.DotNet.Cli" />
<PackageReference Include="Fake.IO.FileSystem" />
<PackageReference Include="Farmer" />
<PackageReference Include="FSharp.Core" />
</ItemGroup>
</Project>

43
src/ServerPack/justfile Normal file
View File

@@ -0,0 +1,43 @@
# ServerPack build commands
# Install just: https://github.com/casey/just
set dotenv-load
src_path := "src"
test_path := "tests"
dist_path := "dist"
pack_path := "../../packages"
# Default recipe - show available commands
default:
@just --list
# Clean build artifacts
clean:
rm -rf {{dist_path}}
# Build production bundle
bundle: clean
dotnet publish -c Release -o {{dist_path}} {{src_path}}
# Build debug bundle
bundle-debug: clean
dotnet publish -c Debug -o {{dist_path}} {{src_path}}
# Create NuGet package
pack: clean
dotnet pack -c Release -o {{pack_path}} {{src_path}}
# Format code with Fantomas
format:
fantomas {{src_path}} -r
# Run tests
test: clean
#!/usr/bin/env bash
if [ -d "{{test_path}}" ]; then
dotnet run {{test_path}}
fi
# Run (creates package)
run: pack

View File

@@ -1,99 +0,0 @@
open Fake.Core
open Fake.IO
open Farmer
open Farmer.Builders
open Helpers
initializeContext()
let serverPath = Path.getFullName "src/Server"
let clientPath = Path.getFullName "src/Client"
let testPath = Path.getFullName "tests"
let distPath = Path.getFullName "dist"
let packPath = Path.getFullName "../../packages"
Target.create "Clean" (fun _ -> Shell.cleanDir distPath)
type BundleMode =
| Prod
| Devel
| Watch
with
override this.ToString() =
match this with
| Prod -> "production"
| Devel -> "development"
| Watch -> "watch"
let vite (m: BundleMode) outDir =
match m with
| Prod -> $"bunx --bun vite build -c ../../vite.config.js -m {m} --emptyOutDir --outDir {outDir}/public"
| Devel -> $"bunx --bun vite build -c ../../vite.config.js -m {m} --minify false --sourcemap true --emptyOutDir --outDir {outDir}/public"
| Watch -> "bunx --bun vite -c ../../vite.config.js"
Target.create "Bundle" (fun _ ->
[ "server", dotnet $"publish -tl -c Release -o {distPath}" serverPath ]
// "client", fable $"-o build/client --run {vite Prod distPath}" clientPath ]
|> runParallel
)
Target.create "BundleDebug" (fun _ ->
[ "server", dotnet $"publish -tl -c Debug -o {distPath}" serverPath ]
// "client", fable $"-o build/client --run {vite Devel distPath}" clientPath ]
|> runParallel
)
Target.create "Run" (fun _ ->
[
"server", dotnet "run" serverPath ]
// "client", fable $"watch -o build/client --run {vite Watch distPath}" clientPath ]
|> runParallel
)
Target.create "Server" (fun _ -> run dotnet "watch run" serverPath)
Target.create "ServerWatch" (fun _ -> run dotnet "watch build" serverPath)
Target.create "Client" (fun _ ->
run fable $"watch -o build/client --run vite" clientPath
)
Target.create "Format" (fun _ ->
run fantomas ". -r" "src"
)
Target.create "Test" (fun _ ->
if System.IO.Directory.Exists testPath then
[ "server", dotnet "run" (testPath + "/Server")
"client", fable "-o build/client --run vite build -c ../../vite.config.js" (testPath + "/Client") ]
|> runParallel
else ()
)
open Fake.Core.TargetOperators
let dependencies = [
"Clean"
==> "Bundle"
"Clean"
==> "BundleDebug"
"Clean"
==> "Test"
"Clean"
==> "Run"
"Server"
"ServerWatch"
"Client"
]
[<EntryPoint>]
let main args = runOrDefault args

View File

@@ -1,15 +1,15 @@
# yaml-language-server: $schema=https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json
variables:
SKIP_TESTS: "true"
SKIP_TESTS: "true"
include:
- project: oceanbox/gitlab-ci
ref: v4.4
file: DotnetDeployment.gitlab-ci.yml
inputs:
project-name: sorcerer
project-dir: src/Sorcerer
- project: oceanbox/gitlab-ci
ref: v4.4
file: DotnetDeployment.gitlab-ci.yml
inputs:
project-name: sorcerer
project-dir: src/Sorcerer
dockerize-sorcerer:
tags:
- nix
- nix

View File

@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="../../.build/Helpers.fs" />
<Compile Include=".build/Build.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fake.Core.Target" />
<PackageReference Include="Fake.DotNet.Cli" />
<PackageReference Include="Fake.IO.FileSystem" />
<PackageReference Include="Farmer" />
<PackageReference Include="FSharp.Core" />
</ItemGroup>
</Project>

View File

@@ -60,13 +60,13 @@ k8s_yaml(namespace_inject(blob(kustomizations), namespace))
local_resource(
'create-bundle',
cmd='dotnet run bundledebug',
cmd='just bundle-debug',
trigger_mode=TRIGGER_MODE_MANUAL
)
local_resource(
'build-server',
cmd='dotnet publish -o ./dist src/Server',
cmd='just bundle-debug-server',
deps=[
'./src/Server',
'./src/Shared'

52
src/Sorcerer/justfile Normal file
View File

@@ -0,0 +1,52 @@
# Sorcerer build commands
# Install just: https://github.com/casey/just
set dotenv-load
src_path := "src"
server_path := "src/Server"
test_path := "tests"
dist_path := "dist"
vite_prod := "bunx --bun vite build -c ../../vite.config.js -m production --emptyOutDir --outDir " + dist_path + "/public"
vite_dev := "bunx --bun vite build -c ../../vite.config.js -m development --minify false --sourcemap true --emptyOutDir --outDir " + dist_path + "/public"
vite_watch := "bunx --bun vite -c ../../vite.config.js"
# Default recipe - show available commands
default:
@just --list
# Clean build artifacts
clean:
rm -rf {{dist_path}}
# Build production bundle (server only for now)
bundle: clean
dotnet publish -tl -c Release -o {{dist_path}} {{server_path}}
# Build debug bundle (server only for now)
bundle-debug: clean
dotnet publish -tl -c Debug -o {{dist_path}} {{server_path}}
# Run development server (server only for now)
run: clean
dotnet run {{server_path}}
# Run server in watch mode
server:
dotnet watch run {{server_path}}
# Build server in watch mode
server-watch:
dotnet watch build {{server_path}}
# Format code with Fantomas
format:
fantomas {{src_path}} -r
# Run tests (parallel server and client if tests exist)
test: clean
#!/usr/bin/env bash
if [ -d "{{test_path}}" ]; then
dotnet run {{test_path}}/Server
fi