Skip to content

Commit

Permalink
include ARCtrl Common props in package for downstream fable transpila…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
HLWeil committed Oct 15, 2024
1 parent 0f9028c commit 25c8d3c
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 52 deletions.
93 changes: 57 additions & 36 deletions build/TestTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ open Fake.Core

module RunTests =

let skipTestsFlag = "--skipTests"

let runTestsUI = BuildTask.create "runTestsUI" [clean; build] {
let path = "tests/UI"
Trace.traceImportant "Start UI tests"
Expand All @@ -18,46 +20,65 @@ module RunTests =
run npx $"cypress run --component -P {path}" ""
}

let runTestsJsNative = BuildTask.create "runTestsJSNative" [clean; build] {
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" ""
GenerateIndexJs.ARCtrl_generate($"{path}/ARCtrl")
run npx $"mocha {path} --timeout 20000" ""
}
let runTestsJsNative = BuildTask.createFn "runTestsJSNative" [clean; build] (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" ""
GenerateIndexJs.ARCtrl_generate($"{path}/ARCtrl")
run npx $"mocha {path} --timeout 20000" ""
else
Trace.traceImportant "Skipping JavaScript tests"
)

let runTestsJs = BuildTask.create "runTestsJS" [clean; build] {
for path in ProjectInfo.testProjects do
// transpile js files from fsharp code
run dotnet $"fable {path} -o {path}/js" ""
// 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" ""
}
let runTestsJs = BuildTask.createFn "runTestsJS" [clean; build] (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
// transpile js files from fsharp code
run dotnet $"fable {path} -o {path}/js" ""
// 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.create "runTestsPyNative" [clean; build] {
Trace.traceImportant "Start native Python tests"
for path in ProjectInfo.pyTestProjects do
// transpile library for native access
run dotnet $"fable src/ARCtrl/ARCtrl.Python.fsproj -o {path}/ARCtrl --lang python" ""
GenerateIndexPy.ARCtrl_generate($"{path}/ARCtrl")
run python $"-m pytest {path}" ""
}
let runTestsPyNative = BuildTask.createFn "runTestsPyNative" [clean; build] (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
// transpile library for native access
run dotnet $"fable src/ARCtrl/ARCtrl.Python.fsproj -o {path}/ARCtrl --lang python" ""
GenerateIndexPy.ARCtrl_generate($"{path}/ARCtrl")
run python $"-m pytest {path}" ""
else
Trace.traceImportant "Skipping Python tests"
)

let runTestsPy = BuildTask.create "runTestsPy" [clean; build] {
for path in ProjectInfo.testProjects do
//transpile py files from fsharp code
run dotnet $"fable {path} -o {path}/py --lang python" ""
// run pyxpecto in target path to execute tests in python
run python $"{path}/py/main.py" ""
}
let runTestsPy = BuildTask.createFn "runTestsPy" [clean; build] (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
//transpile py files from fsharp code
run dotnet $"fable {path} -o {path}/py --lang python" ""
// run pyxpecto in target path to execute tests in python
run python $"{path}/py/main.py" ""
else
Trace.traceImportant "Skipping Python tests"

let runTestsDotnet = BuildTask.create "runTestsDotnet" [clean; build] {
let dotnetRun = run dotnet "run"
testProjects
|> Seq.iter dotnetRun
}
)

let runTestsDotnet = BuildTask.createFn "runTestsDotnet" [clean; build] (fun tp ->
if tp.Context.Arguments |> List.exists (fun a -> a.ToLower() = skipTestsFlag.ToLower()) |> not then
Trace.traceImportant "Start .NET tests"
let dotnetRun = run dotnet "run"
testProjects
|> Seq.iter dotnetRun
else
Trace.traceImportant "Skipping .NET tests"
)

let runTestProject = BuildTask.createFn "runTestProject" [clean; build] (fun config ->
let dotnetRun = run dotnet "run"
Expand Down
1 change: 1 addition & 0 deletions src/ARCtrl/ARCtrl.Javascript.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<Import Project="ARCtrl.Common.props" />
<ItemGroup>
<Content Include="ARCtrl.Common.props" Pack="true" PackagePath="fable/"/>
<Compile Include="WebRequest\WebRequest.Node.fs" />
<Compile Include="WebRequest\WebRequest.fs" />
<Compile Include="Template.Web.fs" />
Expand Down
3 changes: 2 additions & 1 deletion src/ARCtrl/ARCtrl.Python.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<Import Project="../Package.Metadata.props" />

<Import Project="ARCtrl.Common.props" />
<ItemGroup>
<ItemGroup>
<Content Include="ARCtrl.Common.props" Pack="true" PackagePath="fable/"/>
<Compile Include="WebRequest\WebRequest.Py.fs" />
<Compile Include="WebRequest\WebRequest.fs" />
<Compile Include="Template.Web.fs" />
Expand Down
4 changes: 2 additions & 2 deletions src/ARCtrl/ARCtrl.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<Import Project="../Package.Metadata.props" />

<Import Project="ARCtrl.Common.props" />
<ItemGroup>
<None Include="ARCtrl.Common.props" />
<ItemGroup>
<Content Include="ARCtrl.Common.props" Pack="true" PackagePath="fable/" />
<Compile Include="WebRequest\WebRequest.fs" />
<Compile Include="Template.Web.fs" />
<Compile Include="ARC.fs" />
Expand Down
26 changes: 13 additions & 13 deletions src/ARCtrl/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@
"arctrl.contract": {
"type": "Project",
"dependencies": {
"ARCtrl.Core": "[2.1.0, )",
"ARCtrl.Json": "[2.1.0, )",
"ARCtrl.Spreadsheet": "[2.1.0, )",
"ARCtrl.Yaml": "[2.1.0, )"
"ARCtrl.Core": "[2.1.0-alpha.3, )",
"ARCtrl.Json": "[2.1.0-alpha.3, )",
"ARCtrl.Spreadsheet": "[2.1.0-alpha.3, )",
"ARCtrl.Yaml": "[2.1.0-alpha.3, )"
}
},
"arctrl.core": {
"type": "Project",
"dependencies": {
"ARCtrl.CWL": "[2.1.0, )",
"ARCtrl.FileSystem": "[2.1.0, )"
"ARCtrl.CWL": "[2.1.0-alpha.3, )",
"ARCtrl.FileSystem": "[2.1.0-alpha.3, )"
}
},
"arctrl.cwl": {
Expand All @@ -72,8 +72,8 @@
"arctrl.json": {
"type": "Project",
"dependencies": {
"ARCtrl.Core": "[2.1.0, )",
"ARCtrl.ROCrate": "[2.1.0, )",
"ARCtrl.Core": "[2.1.0-alpha.3, )",
"ARCtrl.ROCrate": "[2.1.0-alpha.3, )",
"Thoth.Json.Core": "[0.4.0, )"
}
},
Expand All @@ -87,22 +87,22 @@
"arctrl.spreadsheet": {
"type": "Project",
"dependencies": {
"ARCtrl.Core": "[2.1.0, )",
"ARCtrl.FileSystem": "[2.1.0, )",
"ARCtrl.Core": "[2.1.0-alpha.3, )",
"ARCtrl.FileSystem": "[2.1.0-alpha.3, )",
"FsSpreadsheet": "[6.3.0-alpha.4, )"
}
},
"arctrl.validationpackages": {
"type": "Project",
"dependencies": {
"ARCtrl.Core": "[2.1.0, )"
"ARCtrl.Core": "[2.1.0-alpha.3, )"
}
},
"arctrl.yaml": {
"type": "Project",
"dependencies": {
"ARCtrl.Core": "[2.1.0, )",
"ARCtrl.ValidationPackages": "[2.1.0, )",
"ARCtrl.Core": "[2.1.0-alpha.3, )",
"ARCtrl.ValidationPackages": "[2.1.0-alpha.3, )",
"YAMLicious": "[0.0.1, )"
}
},
Expand Down

0 comments on commit 25c8d3c

Please sign in to comment.