Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing System looking for an error #13

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .github/workflows/build-solution.yml

This file was deleted.

101 changes: 101 additions & 0 deletions .github/workflows/ubuntodotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

permissions:
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

environment:
name: github-pages
url: ${{ steps.change-page-url.outputs.new_page_url }}

defaults:
run:
working-directory: ./modelCsharp

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Install Python 3
uses: actions/setup-python@v1
with:
python-version: 3.11.6

#installing packages
- name: Install Python pandas
run: python -m pip install --upgrade pip pandas
- name: Install Python aspose
run: python -m pip install --upgrade pip aspose.words
- name: Install Python matplotlib
run: python -m pip install --upgrade pip matplotlib
- name: Install Python pyinstaller
run: python -m pip install --upgrade pip datetime
- name: Install Python datetime
run: pip install pyinstaller

- name: Create a temporary artifact downloads folder for graphs
run: mkdir graphs

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: run
run: dotnet run --project ConsoleAppSVS-test/ConsoleAppSVS-test.csproj

- name: run python
run: python TestModel/testGraph/testGraph/testGraph.py

- name: moving artfacts to temp folder
run: |
mv index.html graphs
mv index.001.png graphs

- name: find index file
run: find . -type f -name "*.html"

- name: Step 3 - Use the Upload Artifact GitHub Action
uses: actions/upload-artifact@v2
with:
name: folder for graphs
path: ./modelCsharp/graphs

- name: Deploy 🚀
uses: actions/upload-pages-artifact@v2
with:
path: ./modelCsharp/graphs

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

- name: Override page_url
id: change-page-url
run: echo "new_page_url=${{ steps.deployment.outputs.page_url }}index.html" >> $GITHUB_OUTPUT




4 changes: 4 additions & 0 deletions modelCsharp/ConsoleAppSVS-test/ConsoleAppSVS-test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SVSModel\SVSModel.csproj" />
<ProjectReference Include="..\TestModel\TestModel\TestModel.csproj" />
Expand Down
126 changes: 126 additions & 0 deletions modelCsharp/ConsoleAppSVS-test/OutputFiles/test 1.csv

Large diffs are not rendered by default.

126 changes: 126 additions & 0 deletions modelCsharp/ConsoleAppSVS-test/OutputFiles/test 2.csv

Large diffs are not rendered by default.

126 changes: 126 additions & 0 deletions modelCsharp/ConsoleAppSVS-test/OutputFiles/test 3.csv

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions modelCsharp/ConsoleAppSVS-test/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@

using TestModel;
using TestModel;

Test.RunTests(TestConfigData.configDict);
namespace ConsoleApp1
{

internal class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
Test.RunTests(TestConfigData.configDict);
}
}
}
1 change: 1 addition & 0 deletions modelCsharp/SVSModel.Excel/SVSModel.Excel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="ExcelDna.AddIn" Version="1.7.0-rc1" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions modelCsharp/SVSModel/SVSModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="Microsoft.Data.Analysis" Version="0.20.0" />
</ItemGroup>
Expand Down
30 changes: 30 additions & 0 deletions modelCsharp/TestModel/Observed/observed.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Date,Nitrogen
9/07/2011 0:00,12
10/07/2011 0:00,38
11/07/2011 0:00,55
12/07/2011 0:00,165
12/07/2011 0:00,170
14/07/2011 0:00,5
15/07/2011 0:00,25
16/07/2011 0:00,75
17/07/2011 0:00,66
19/09/2020 0:00,77
20/09/2020 0:00,52
21/09/2020 0:00,55
22/09/2020 0:00,35
23/09/2020 0:00,15
24/09/2020 0:00,78
25/09/2020 0:00,68
26/09/2020 0:00,46
27/09/2020 0:00,55
28/09/2020 0:00,97
29/09/2020 0:00,78
20/07/2015 0:00,25
21/07/2015 0:00,65
22/07/2015 0:00,45
23/07/2015 0:00,56
24/07/2015 0:00,44
25/07/2015 0:00,66
26/07/2015 0:00,77
27/07/2015 0:00,88
28/07/2015 0:00,99
30 changes: 17 additions & 13 deletions modelCsharp/TestModel/TestModel/Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,50 @@
using System;
using static System.Net.Mime.MediaTypeNames;
using System.Text.Json.Serialization;
//using ServiceStack;
//using ServiceStack.Text;
using System.Collections.Generic;
//using Nancy.Routing.Constraints;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;
using Microsoft.Scripting;
using static IronPython.Modules._ast;
using System.IO;
using CommandLine;

namespace TestModel
{
public class Test
{
private static void runPythonScript()
/* private static void runPythonScript()
{
//that is new with james
//string progToRun = dir + @"/../TestModel/testGraph/testGraph/testGraph.py";
string dir = Directory.GetCurrentDirectory();
string newPath = Path.GetFullPath(Path.Combine(dir, @"..\..\..\..\"));
string progToRun = newPath+ @"TestModel\testGraph\testGraph\testGraph.py";
string progToRun = newPath + @"TestModel\testGraph\testGraph\testGraph.py";

Process proc = new Process();
proc.StartInfo.FileName = "python.exe";
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.Arguments =progToRun;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.Arguments = progToRun;
proc.Start();
StreamReader sReader = proc.StandardOutput;
proc.WaitForExit();
Console.ReadLine();

}
}*/
public static void RunTests(Dictionary<string, object> _configDict)

{
string dir = Directory.GetCurrentDirectory();
//DataFrame testConfigs = Crop.LoadCoefficients("SVSModel.Data.TestConfig.csv");

string resourceName = "TestModel.TestConfig.csv";
var assembly = Assembly.GetExecutingAssembly();
Stream csv = assembly.GetManifestResourceStream(resourceName);

Check warning on line 51 in modelCsharp/TestModel/TestModel/Test.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 51 in modelCsharp/TestModel/TestModel/Test.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.
DataFrame allTests = DataFrame.LoadCsv(csv);

List<string> Tests = new List<string>();

foreach (DataFrameRow row in allTests.Rows)
{
Tests.Add(row[0].ToString());

Check warning on line 58 in modelCsharp/TestModel/TestModel/Test.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'.

Check warning on line 58 in modelCsharp/TestModel/TestModel/Test.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'.
}

foreach (string test in Tests)
Expand All @@ -70,7 +67,7 @@
Dictionary<DateTime, double> testResults = new Dictionary<DateTime, double>();
Dictionary<DateTime, double> nApplied = new Dictionary<DateTime, double>();

string weatherStation = allTests["WeatherStation"][testRow].ToString();

Check warning on line 70 in modelCsharp/TestModel/TestModel/Test.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

Check warning on line 70 in modelCsharp/TestModel/TestModel/Test.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

MetDataDictionaries metData = ModelInterface.BuildMetDataDictionaries(_config.Prior.EstablishDate, _config.Following.HarvestDate.AddDays(1), weatherStation);

Expand All @@ -80,7 +77,7 @@
List<string> OutPutHeaders = new List<string>();
for (int i = 0; i< output.GetLength(1); i +=1)
{
OutPutHeaders.Add(output[0, i].ToString());

Check warning on line 80 in modelCsharp/TestModel/TestModel/Test.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'.

Check warning on line 80 in modelCsharp/TestModel/TestModel/Test.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'item' in 'void List<string>.Add(string item)'.
if (i == 0)
{
columns[i] = new PrimitiveDataFrameColumn<DateTime>(output[0, i].ToString());
Expand All @@ -102,11 +99,18 @@
}
newDataframe.Append(nextRow, true);
}
string folderName = "OutputFiles";

if (!Directory.Exists(folderName))
{
System.IO.Directory.CreateDirectory("OutputFiles");
}

DataFrame.SaveCsv(newDataframe, dir + "\\OutputFiles\\" + test + ".csv");

}
runPythonScript();
// uncomment it if run is on local machine
//runPythonScript();

}

Expand Down
1 change: 1 addition & 0 deletions modelCsharp/TestModel/TestModel/TestModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="IronPython" Version="3.4.1" />
</ItemGroup>

Expand Down
Loading
Loading