Modernise CI (#5)
Co-authored-by: Smaug123 <3138005+Smaug123@users.noreply.github.com> Reviewed-on: #5
This commit is contained in:
@@ -3,19 +3,19 @@
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"fantomas": {
|
||||
"version": "6.1.2",
|
||||
"version": "7.0.3",
|
||||
"commands": [
|
||||
"fantomas"
|
||||
]
|
||||
},
|
||||
"fable": {
|
||||
"version": "3.2.9",
|
||||
"version": "4.25.0",
|
||||
"commands": [
|
||||
"fable"
|
||||
]
|
||||
},
|
||||
"femto": {
|
||||
"version": "0.12.0",
|
||||
"version": "0.21.0",
|
||||
"commands": [
|
||||
"femto"
|
||||
]
|
22
.envrc
22
.envrc
@@ -1 +1,23 @@
|
||||
use flake
|
||||
DOTNET_PATH=$(readlink "$(which dotnet)")
|
||||
SETTINGS_FILE=$(find . -maxdepth 1 -type f -name '*.sln.DotSettings.user')
|
||||
MSBUILD=$(realpath "$(find "$(dirname "$DOTNET_PATH")/../share/dotnet/sdk" -maxdepth 2 -type f -name MSBuild.dll)")
|
||||
if [ -f "$SETTINGS_FILE" ] ; then
|
||||
xmlstarlet ed --inplace \
|
||||
-N wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" \
|
||||
-N x="http://schemas.microsoft.com/winfx/2006/xaml" \
|
||||
-N s="clr-namespace:System;assembly=mscorlib" \
|
||||
-N ss="urn:shemas-jetbrains-com:settings-storage-xaml" \
|
||||
--update "//s:String[@x:Key='/Default/Environment/Hierarchy/Build/BuildTool/DotNetCliExePath/@EntryValue']" \
|
||||
--value "$(realpath "$(dirname "$DOTNET_PATH")/../share/dotnet/dotnet")" \
|
||||
"$SETTINGS_FILE"
|
||||
|
||||
xmlstarlet ed --inplace \
|
||||
-N wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" \
|
||||
-N x="http://schemas.microsoft.com/winfx/2006/xaml" \
|
||||
-N s="clr-namespace:System;assembly=mscorlib" \
|
||||
-N ss="urn:shemas-jetbrains-com:settings-storage-xaml" \
|
||||
--update "//s:String[@x:Key='/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue']" \
|
||||
--value "$MSBUILD" \
|
||||
"$SETTINGS_FILE"
|
||||
fi
|
||||
|
@@ -6,11 +6,11 @@ steps:
|
||||
# Lint
|
||||
- "nix develop --command bash -c 'dotnet tool restore && ./hooks/pre-push'"
|
||||
# Test
|
||||
- nix develop --command dotnet -- test
|
||||
- nix develop --command dotnet -- test --configuration Release
|
||||
- nix develop --command dotnet test
|
||||
- nix develop --command dotnet test --configuration Release
|
||||
# Perform build
|
||||
- "pushd RaftFable && nix develop --command npm -- install && popd"
|
||||
- "pushd RaftFable && nix develop --command npm -- run-script build && popd"
|
||||
- "pushd RaftFable && nix develop --command npm install && popd"
|
||||
- "pushd RaftFable && nix develop --command npm run-script build && popd"
|
||||
|
||||
when:
|
||||
- event: "push"
|
@@ -1,6 +1,7 @@
|
||||
namespace Raft.Test
|
||||
|
||||
open FsCheck
|
||||
open FsCheck.FSharp
|
||||
open Raft
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
@@ -8,7 +9,7 @@ module NetworkAction =
|
||||
|
||||
let generate<'a> (clusterSize : int) : Gen<NetworkAction<'a>> =
|
||||
gen {
|
||||
let! choice = Arb.generate<NetworkAction<'a>>
|
||||
let! choice = ArbMap.defaults |> ArbMap.generate<NetworkAction<'a>>
|
||||
let! server = Gen.choose (0, clusterSize - 1)
|
||||
let server = server * 1<ServerId>
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
@@ -19,13 +19,11 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FsCheck" Version="2.16.5" />
|
||||
<PackageReference Include="FsUnit" Version="5.0.5" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="3.3.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2" />
|
||||
<PackageReference Include="FsCheck" Version="3.3.1" />
|
||||
<PackageReference Include="FsUnit" Version="7.1.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||
<PackageReference Include="NUnit" Version="4.4.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -1,6 +1,7 @@
|
||||
namespace Raft.Test
|
||||
|
||||
open System.Threading
|
||||
open FsCheck.FSharp
|
||||
open Raft
|
||||
open NUnit.Framework
|
||||
open FsUnitTyped
|
||||
@@ -10,10 +11,7 @@ open FsCheck
|
||||
module TestInMemoryServer =
|
||||
|
||||
let check<'T> (prop : 'T) =
|
||||
let config =
|
||||
{ Config.QuickThrowOnFailure with
|
||||
MaxTest = 1000
|
||||
}
|
||||
let config = Config.QuickThrowOnFailure.WithMaxTest(1000).WithQuietOnSuccess (true)
|
||||
|
||||
Check.One (config, prop)
|
||||
|
||||
@@ -194,7 +192,7 @@ module TestInMemoryServer =
|
||||
let networkMessageSelectionGen (clusterSize : int) : Gen<NetworkMessageSelection> =
|
||||
gen {
|
||||
let! pile = Gen.choose (0, clusterSize - 1)
|
||||
let! entry = Arb.generate<int>
|
||||
let! entry = ArbMap.defaults |> ArbMap.generate<int>
|
||||
return (pile * 1<ServerId>, abs entry)
|
||||
}
|
||||
|> Gen.listOf
|
||||
@@ -425,7 +423,7 @@ module TestInMemoryServer =
|
||||
firstTime = secondTime
|
||||
|
||||
property
|
||||
|> Prop.forAll (ValidHistory.arb (Arb.Default.Byte().Generator) clusterSize)
|
||||
|> Prop.forAll (ValidHistory.arb (ArbMap.defaults |> ArbMap.generate<byte>) clusterSize)
|
||||
|> check
|
||||
|
||||
|
||||
@@ -448,7 +446,7 @@ module TestInMemoryServer =
|
||||
List.distinct leaders = leaders
|
||||
|
||||
property
|
||||
|> Prop.forAll (ValidHistory.arb (Arb.Default.Byte().Generator) clusterSize)
|
||||
|> Prop.forAll (ValidHistory.arb (ArbMap.defaults |> ArbMap.generate<byte>) clusterSize)
|
||||
|> check
|
||||
|
||||
let duplicationProperty<'a when 'a : equality>
|
||||
|
@@ -1,5 +1,6 @@
|
||||
namespace Raft.Test
|
||||
|
||||
open FsCheck.FSharp
|
||||
open Raft
|
||||
open System.Collections.Generic
|
||||
open NUnit.Framework
|
||||
|
@@ -2,6 +2,7 @@ namespace Raft.Test
|
||||
|
||||
open Raft
|
||||
open FsCheck
|
||||
open FsCheck.FSharp
|
||||
|
||||
type ValidHistory<'a> = | ValidHistory of NetworkAction<'a> list
|
||||
|
||||
|
@@ -1,9 +1,4 @@
|
||||
// Note this only includes basic configuration for development mode.
|
||||
// For a more comprehensive configuration check:
|
||||
// https://github.com/fable-compiler/webpack-config-template
|
||||
|
||||
var path = require("path");
|
||||
|
||||
module.exports = {
|
||||
mode: "development",
|
||||
entry: "./src/App.fs.js",
|
||||
@@ -12,8 +7,12 @@ module.exports = {
|
||||
filename: "bundle.js",
|
||||
},
|
||||
devServer: {
|
||||
publicPath: "/",
|
||||
contentBase: "./public",
|
||||
static: {
|
||||
directory: path.join(__dirname, "./public"),
|
||||
},
|
||||
devMiddleware: {
|
||||
publicPath: "/",
|
||||
},
|
||||
port: 8080,
|
||||
},
|
||||
module: {
|
||||
|
13
flake.lock
generated
13
flake.lock
generated
@@ -5,11 +5,11 @@
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689068808,
|
||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -20,15 +20,16 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1691179010,
|
||||
"narHash": "sha256-83NO4I6eKStD0VPJWTt9lymaqhCeUmHQ/0MOUo7fQPM=",
|
||||
"lastModified": 1757034884,
|
||||
"narHash": "sha256-PgLSZDBEWUHpfTRfFyklmiiLBE1i1aGCtz4eRA3POao=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f9e7c7f7e5deba3339e5cc45ab3e4e17414ee78e",
|
||||
"rev": "ca77296380960cd497a765102eeb1356eb80fed0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
12
flake.nix
12
flake.nix
@@ -1,13 +1,12 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils = {
|
||||
url = "github:numtide/flake-utils";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
...
|
||||
@@ -17,12 +16,7 @@
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs =
|
||||
[pkgs.alejandra pkgs.nodejs pkgs.dotnet-sdk_6 pkgs.python3]
|
||||
++ (
|
||||
if pkgs.stdenv.isDarwin
|
||||
then [pkgs.darwin.apple_sdk.frameworks.CoreServices]
|
||||
else []
|
||||
);
|
||||
[pkgs.alejandra pkgs.nodejs pkgs.dotnet-sdk_9 pkgs.python3 pkgs.xmlstarlet];
|
||||
};
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user