Skip to content

Commit

Permalink
Merge pull request #479 from nfdi4plants/arcIO_async
Browse files Browse the repository at this point in the history
ARC transilable async/promise based IO
  • Loading branch information
HLWeil authored Dec 4, 2024
2 parents 68a42b7 + 3934047 commit 13842ba
Show file tree
Hide file tree
Showing 79 changed files with 4,442 additions and 167 deletions.
5 changes: 3 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"isRoot": true,
"tools": {
"fable": {
"version": "4.22.0",
"version": "4.24.0",
"commands": [
"fable"
]
],
"rollForward": false
}
}
}
235 changes: 235 additions & 0 deletions ARCtrl.JS.sln

Large diffs are not rendered by default.

235 changes: 235 additions & 0 deletions ARCtrl.Py.sln

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
<PackageVersion Include="Thoth.Json.JavaScript" Version="0.3.0" />
<PackageVersion Include="Thoth.Json.Python" Version="0.4.0" />
<PackageVersion Include="Thoth.Json.Newtonsoft" Version="0.2.0" />
<PackageVersion Include="FsSpreadsheet" Version="6.3.0-alpha.4" />
<PackageVersion Include="FsSpreadsheet" Version="6.3.1" />
<PackageVersion Include="FsSpreadsheet.NET" Version="6.3.1" />
<PackageVersion Include="FsSpreadsheet.Js" Version="6.3.1" />
<PackageVersion Include="FsSpreadsheet.Py" Version="6.3.1" />
<PackageVersion Include="YAMLicious" Version="0.0.3" />
<PackageVersion Include="DynamicObj" Version="4.0.3" />
<PackageVersion Include="Fable.SimpleHttp" Version="3.5.0" />
<PackageVersion Include="Fable.Fetch" Version="2.6.0" />
<PackageVersion Include="Fable.Node" Version="1.2.0" />
<PackageVersion Include="Fable.Promise" Version="3.2.0" />
<PackageVersion Include="Fable.Pyxpecto" Version="1.2.0" />
<PackageVersion Include="NJsonSchema" Version="10.8.0" />
</ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions build/BasicTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ let clean = BuildTask.create "Clean" [] {
++ "src/**/obj"
++ "tests/**/bin"
++ "tests/**/obj"
++ "tests/TestingUtils/TestResults"
++ "tests/**/py"
++ "tests/**/js"
++ "tests/Javascript/ARCtrl"
++ "tests/Python/ARCtrl"
++ "dist"
++ ProjectInfo.netPkgDir
|> Shell.cleanDirs
Expand Down
2 changes: 2 additions & 0 deletions build/PackageTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ module BundleJs =
"" // "fable-library.**/**"
|> Fake.IO.File.writeString false $"{ProjectInfo.npmPkgDir}/fable_modules/.npmignore"

System.IO.File.Copy(ProjectInfo.jsHelperFilePath, $"{ProjectInfo.npmPkgDir}/FileSystem.js", true) |> ignore

Fake.JavaScript.Npm.exec "pack" (fun o ->
{ o with
WorkingDirectory = ProjectInfo.npmPkgDir
Expand Down
3 changes: 3 additions & 0 deletions build/ProjectInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ let pyTestProjects =
"tests/Python"
]

let jsHelperFileName = "FileSystem.js"
let jsHelperFilePath = "src/ARCtrl/ContractIO/" + jsHelperFileName

let solutionFile = $"{project}.sln"

let configuration = "Release"
Expand Down
16 changes: 12 additions & 4 deletions build/TestTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,37 @@ module RunTests =
run npx $"cypress run --component -P {path}" ""
}

let runTestsJsNative = BuildTask.createFn "runTestsJSNative" [clean; build] (fun tp ->
let runTestsJsNative = BuildTask.createFn "runTestsJSNative" [clean] (fun tp ->
if tp.Context.Arguments |> List.exists (fun a -> a.ToLower() = skipTestsFlag.ToLower()) |> not then
Trace.traceImportant "Start native JavaScript tests"
for path in ProjectInfo.jsTestProjects do
// transpile library for native access
run dotnet $"fable src/ARCtrl/ARCtrl.Javascript.fsproj -o {path}/ARCtrl --nocache" ""
System.IO.File.Copy(jsHelperFilePath, $"{path}/ARCtrl/{jsHelperFileName}") |> ignore
GenerateIndexJs.ARCtrl_generate($"{path}/ARCtrl")
run npx $"mocha {path} --timeout 20000" ""
else
Trace.traceImportant "Skipping JavaScript tests"
)

let runTestsJs = BuildTask.createFn "runTestsJS" [clean; build] (fun tp ->
let runTestsJs = BuildTask.createFn "runTestsJS" [clean] (fun tp ->
if tp.Context.Arguments |> List.exists (fun a -> a.ToLower() = skipTestsFlag.ToLower()) |> not then
Trace.traceImportant "Start Js tests"
for path in ProjectInfo.testProjects do
// Setup test results directory after clean
System.IO.Directory.CreateDirectory("./tests/TestingUtils/TestResults/js") |> ignore
// transpile js files from fsharp code
run dotnet $"fable {path} -o {path}/js --nocache" ""

System.IO.File.Copy(jsHelperFilePath, $"{path}/js/{jsHelperFileName}") |> ignore
// run mocha in target path to execute tests
// "--timeout 20000" is used, because json schema validation takes a bit of time.
run node $"{path}/js/Main.js" ""
else
Trace.traceImportant "Skipping Js tests"
)

let runTestsPyNative = BuildTask.createFn "runTestsPyNative" [clean; build] (fun tp ->
let runTestsPyNative = BuildTask.createFn "runTestsPyNative" [clean] (fun tp ->
if tp.Context.Arguments |> List.exists (fun a -> a.ToLower() = skipTestsFlag.ToLower()) |> not then
Trace.traceImportant "Start native Python tests"
for path in ProjectInfo.pyTestProjects do
Expand All @@ -57,10 +62,12 @@ module RunTests =
Trace.traceImportant "Skipping Python tests"
)

let runTestsPy = BuildTask.createFn "runTestsPy" [clean; build] (fun tp ->
let runTestsPy = BuildTask.createFn "runTestsPy" [clean] (fun tp ->
if tp.Context.Arguments |> List.exists (fun a -> a.ToLower() = skipTestsFlag.ToLower()) |> not then
Trace.traceImportant "Start Python tests"
for path in ProjectInfo.testProjects do
// Setup test results directory after clean
System.IO.Directory.CreateDirectory("./tests/TestingUtils/TestResults/py") |> ignore
//transpile py files from fsharp code
run dotnet $"fable {path} -o {path}/py --lang python --nocache" ""
// run pyxpecto in target path to execute tests in python
Expand Down Expand Up @@ -98,6 +105,7 @@ module RunTests =
run python $"{p}/py/main.py" ""
// transpile js files from fsharp code
run dotnet $"fable {p} -o {p}/js" ""
System.IO.File.Copy(jsHelperFilePath, $"{p}/js/{jsHelperFileName}") |> ignore
// run mocha in target path to execute tests
// "--timeout 20000" is used, because json schema validation takes a bit of time.
run node $"{p}/js/Main.js" ""
Expand Down
Loading

0 comments on commit 13842ba

Please sign in to comment.