Skip to content

Commit

Permalink
Merge pull request #34 from ix-ax/dev
Browse files Browse the repository at this point in the history
preview v0.13.x
  • Loading branch information
PTKu committed Jan 31, 2023
2 parents 95298be + bcf7547 commit 0d183b3
Show file tree
Hide file tree
Showing 110 changed files with 1,015 additions and 1,075 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. Microsoft Windows [Version 10.0.18363.1082]]
- ix version
- simatix-ax version [eg. 4024.10]
- simatix-ax version (attach apax.yml file)
- hardware/software target type and version (e.g. S71516, PLCSIM Advanced)
- other tools used (visual studio, vscode)

**Additional context**
Expand Down
3 changes: 3 additions & 0 deletions .github/issue-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mode: chatops
branchName: '${issue.number}-${issue.title}'
openDraftPR: true
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ Please describe the tests that you ran to verify your changes. Provide instructi
- [ ] Test B

**Test Configuration**:
* simatix-ax version:

* simatix-ax version (apax.yml):
* ix version:
* Hardware PLC:
* Other hardware:
* PLC Target system:
* PLC Firmware version:
* OS System:
* Other relevant hardware:

# Checklist:

Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/create_issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
issues:
types: [assigned]
issue_comment:
types: [created]
pull_request:
types: [closed]

jobs:
create_issue_branch_job:
runs-on: ubuntu-latest
steps:
- name: Create Issue Branch
uses: robvanderleek/create-issue-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

19 changes: 11 additions & 8 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ on:
paths:
- 'src/**'
- 'cake/**'
- '.github/**'
pull_request:
branches: [ "dev" ]
paths:
- 'src/**'
- 'cake/**'
- '.github/**'
- '.github/**'
workflow_dispatch:

jobs:
Expand All @@ -33,5 +27,14 @@ jobs:
run: dotnet build cake/Build.csproj

- name: "Run build script"
run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 1
env:
GH_TOKEN : ${{ secrets.GH_TOKEN }}
run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 2 --do-publish true
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Test report
path: 'TestResults/*.xml'
reporter: dotnet-trx

11 changes: 10 additions & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,14 @@ jobs:
run: dotnet build cake/Build.csproj

- name: "Run build script"
run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 100 --do-publish true
env:
GH_TOKEN : ${{ secrets.GH_TOKEN }}
run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 100 --do-publish true --do-publish-release true
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Test report
path: 'TestResults/*.xml'
reporter: dotnet-trx

37 changes: 37 additions & 0 deletions .github/workflows/pr-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: pr-dev

on:
pull_request:
branches: [ "dev" ]
paths:
- 'src/**'
- 'cake/**'
- '.github/**'
workflow_dispatch:

jobs:
build:
strategy:
matrix:
configuration: [Release]

runs-on: [self-hosted, Windows, X64, L2] # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: '0'

- name: "Build script"
run: dotnet build cake/Build.csproj

- name: "Run build script"
run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 1
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Test report
path: 'TestResults/*.xml'
reporter: dotnet-trx
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,14 @@ jobs:
run: dotnet build cake/Build.csproj

- name: "Run build script"
run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 100 --do-publish true
env:
GH_TOKEN : ${{ secrets.GH_TOKEN }}
run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 100 --do-publish true --do-publish-release true
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Test report
path: 'TestResults/*.xml'
reporter: dotnet-trx

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,4 @@ ix/.g/**

.apax/
/src/apax/stc-generic-x64
TestResults/
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mode: ContinuousDeployment
next-version: 0.12.0
next-version: 0.13.0
branches:
main:
regex: ^master$|^main$
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# [WIP] RUNNING SOME POST PUBLISH TESTS

![](assets/pics/banner_wider.png)

[![dev](https://github.com/ix-ax/ix/actions/workflows/dev.yml/badge.svg?branch=dev)](https://github.com/ix-ax/ix/actions/workflows/dev.yml)
[![preview](https://github.com/ix-ax/ix/actions/workflows/release.yml/badge.svg?branch=releases%2Fv0)](https://github.com/ix-ax/ix/actions/workflows/release.yml)
[![master](https://github.com/ix-ax/ix/actions/workflows/master.yml/badge.svg?branch=master)](https://github.com/ix-ax/ix/actions/workflows/master.yml)
![semver](https://img.shields.io/badge/semver-0.10.0-blue)
[![GitHub license](https://badgen.net/github/license/Naereen/Strapdown.js)](https://github.com/ix-ax/ix/blob/master/LICENSE)


# IX

The **IX** is a series of tools that extend SIMATIC AX (Automation Xpansion) with a flexible and powerful connection with .NET ecosystem. IX includes a compiler (`ixc`) that translates PLC data structures into C# (PLC .NET Twin), which makes the PLC data available in a structured way for any .NET application. Furthermore, presentation libraries provide additional features for the automated rendering of PLC data in the UI/HMI.
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ ix is in development; we will address the security issues in the latest pre-rele
## Reporting a Vulnerability

**Please do not disclose the vulnerability in the publicly available parts of this repo.**
The vulnerabilities should be reported to the following email ix-team@kurhajec.com
The vulnerabilities should be reported to the following email team@ixcite.tech
We will address the security issue in a separate workflow.

10 changes: 8 additions & 2 deletions cake/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// https://github.com/ix-ax/ix/blob/master/LICENSE
// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md

using System.Collections.Generic;
using System.IO;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.Build;
Expand All @@ -19,6 +20,8 @@ public class BuildContext : FrostingContext
{
public string Artifacts => Path.Combine(Environment.WorkingDirectory.FullPath, "..//artifacts//");

public string TestResults => Path.Combine(Environment.WorkingDirectory.FullPath, "..//TestResults//");

public string WorkDirName => Environment.WorkingDirectory.GetDirectoryName();

public string ApiDocumentationDir => Path.GetFullPath(Path.Combine(Environment.WorkingDirectory.FullPath, "..//docs//api//"));
Expand Down Expand Up @@ -55,8 +58,9 @@ public BuildContext(ICakeContext context, BuildParameters buildParameters)
Verbosity = buildParameters.Verbosity,
Configuration = buildParameters.Configuration,
NoRestore = true,
NoBuild = true

NoBuild = true,
DiagnosticOutput = true,
VSTestReportPath = TestResults,
};

DotNetRunSettings = new DotNetRunSettings()
Expand All @@ -68,4 +72,6 @@ public BuildContext(ICakeContext context, BuildParameters buildParameters)
NoRestore = true,
};
}

public IEnumerable<string> TargetFrameworks { get; } = new List<string>() { "net6.0", "net7.0" };
}
3 changes: 3 additions & 0 deletions cake/BuildParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ public class BuildParameters

[Option('l', "test-level", Required = false, Default = 1, HelpText = "Test level 1 - 3")]
public int TestLevel { get; set; }

[Option('r', "do-publish-release", Required = false, Default = false, HelpText = "Publishes release on GH")]
public bool DoPublishRelease { get; set; }
}
25 changes: 25 additions & 0 deletions cake/FilteredSolution/FilteredSolution.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Build
// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved.
// Contributors: https://github.com/ix-ax/ix/graphs/contributors
// See the LICENSE file in the repository root for more information.
// https://github.com/ix-ax/ix/blob/master/LICENSE
// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md

using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;

namespace Build.FilteredSolution;

public class FilteredSolution
{
public string path { get; set; }
public List<string> projects { get; set; }

public static SolutionRoot Parse(string pathToFilteredSolution)
{
var json = File.ReadAllText(pathToFilteredSolution);
SolutionRoot solution = JsonConvert.DeserializeObject<SolutionRoot>(json);
return solution;
}
}
13 changes: 13 additions & 0 deletions cake/FilteredSolution/SolutionRoot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Build
// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved.
// Contributors: https://github.com/ix-ax/ix/graphs/contributors
// See the LICENSE file in the repository root for more information.
// https://github.com/ix-ax/ix/blob/master/LICENSE
// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md

using Build.FilteredSolution;

public class SolutionRoot
{
public FilteredSolution solution { get; set; }
}
49 changes: 42 additions & 7 deletions cake/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Build.FilteredSolution;
using Cake.Common;
using Cake.Common.IO;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.Clean;
using Cake.Core.Diagnostics;
using Cake.Core.IO;
using Cake.Core.Tooling;
using Cake.Frosting;
using Cake.Powershell;
using CliWrap;
Expand Down Expand Up @@ -60,7 +62,8 @@ public sealed class CleanUpTask : FrostingTask<BuildContext>
public override void Run(BuildContext context)
{
context.DotNetClean(Path.Combine(context.RootDir, "ix.sln"), new DotNetCleanSettings() { Verbosity = context.BuildParameters.Verbosity});
context.CleanDirectory(context.Artifacts);
context.CleanDirectory(context.Artifacts);
context.CleanDirectory(context.TestResults);
}
}

Expand Down Expand Up @@ -140,15 +143,15 @@ public override void Run(BuildContext context)

if (context.BuildParameters.TestLevel == 1)
{
context.DotNetTest(Path.Combine(context.RootDir, "ix-L1-tests.slnf"), context.DotNetTestSettings);
RunTestsFromFilteredSolution(context, Path.Combine(context.RootDir, "ix-L1-tests.slnf"));
}
else if (context.BuildParameters.TestLevel == 2)
{
context.DotNetTest(Path.Combine(context.RootDir, "ix-L2-tests.slnf"), context.DotNetTestSettings);
RunTestsFromFilteredSolution(context, Path.Combine(context.RootDir, "ix-L2-tests.slnf"));
}
else if (context.BuildParameters.TestLevel == 3)
{
context.DotNetTest(Path.Combine(context.RootDir, "ix-L3-tests.slnf"), context.DotNetTestSettings);
RunTestsFromFilteredSolution(context, Path.Combine(context.RootDir, "ix-L3-tests.slnf"));
}
else
{
Expand All @@ -160,13 +163,28 @@ public override void Run(BuildContext context)

UploadTestPlc(context, workingDirectory, targetIp, targetPlatform);

context.DotNetTest(Path.Combine(context.RootDir, "ix.sln"), context.DotNetTestSettings);
RunTestsFromFilteredSolution(context, Path.Combine(context.RootDir, "ix-L3-tests.slnf"));
}



}

private static void RunTestsFromFilteredSolution(BuildContext context, string filteredSolutionFile)
{
foreach (var project in FilteredSolution.Parse(filteredSolutionFile).solution.projects
.Select(p => new FileInfo(Path.Combine(context.RootDir, p)))
.Where(p => p.Name.ToUpperInvariant().Contains("TEST")))
{
foreach (var framework in context.TargetFrameworks)
{
context.DotNetTestSettings.VSTestReportPath = Path.Combine(context.TestResults, $"{project.Name}_{framework}.xml");
context.DotNetTestSettings.Framework = framework;
context.DotNetTest(Path.Combine(project.FullName), context.DotNetTestSettings);
}
}
}

private static void UploadTestPlc(BuildContext context, string workingDirectory, string targetIp,
string targetPlatform)
{
Expand Down Expand Up @@ -234,7 +252,24 @@ public override void Run(BuildContext context)

foreach (var templateCsProjFile in templateCsProjFiles)
{
var packagesToUpdate = new List<string>() { "Ix.Abstractions", "Ix.Connector", "Ix.Connector.Sax.WebAPI" };
var packagesToUpdate = new List<string>()
{
"Ix.Abstractions",
"Ix.Connector",
"Ix.Connector.S71500.WebAPI",
"Ix.Presentation.Blazor.Controls",
"Ix.Presentation.Blazor"
};

foreach (var packageId in packagesToUpdate)
{
ix.nuget.update.Program.Update(new Options() { NewVersion = GitVersionInformation.SemVer, PackageId = packageId, FileToUpdate = templateCsProjFile });
}
}
var templateToolDotnetTools = Directory.EnumerateFiles(templatesDirectory, "dotnet-tools.json", SearchOption.AllDirectories);
foreach (var templateCsProjFile in templateToolDotnetTools)
{
var packagesToUpdate = new List<string>() { "ix.ixc" };
foreach (var packageId in packagesToUpdate)
{
ix.nuget.update.Program.Update(new Options() { NewVersion = GitVersionInformation.SemVer, PackageId = packageId, FileToUpdate = templateCsProjFile });
Expand Down Expand Up @@ -377,7 +412,7 @@ public sealed class PublishReleaseTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
if (!context.BuildParameters.DoPublish)
if (!context.BuildParameters.DoPublishRelease)
{
context.Log.Warning($"Skipping package release.");
return;
Expand Down
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
www.ixcite.tech
5 changes: 4 additions & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# INDUSTRIAL AUTOMATION EXPANSION

![](_media/readme/logo-color-sm.png)

# INDUSTRIAL AUTOMATION EXPANSION
## OPEN SOURCE FOR INDUSTRIAL AUTOMATION
## Bind SIMATIC AX based projects with .NET ecosystem


Loading

0 comments on commit 0d183b3

Please sign in to comment.