Skip to content

Commit

Permalink
Github and CI integration
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeuchler committed Jul 1, 2020
1 parent 36d5f6c commit fee8e47
Show file tree
Hide file tree
Showing 12 changed files with 947 additions and 16 deletions.
581 changes: 581 additions & 0 deletions .build/BuildToolkit.ps1

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions .build/Global.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassNeverInstantiated_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassNeverInstantiated_002ELocal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEverywhere/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEvident/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
<s:Boolean x:Key="/Default/Environment/MemoryUsageIndicator/IsVisible/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Int64 x:Key="/Default/Environment/UnitTesting/ParallelProcessesCount/@EntryValue">2</s:Int64>
</wpf:ResourceDictionary>
36 changes: 36 additions & 0 deletions .build/Output.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
################################
# Functions for Console Output #
################################

function Write-Step([string]$step) {
Write-Host "########################################################################################################" -foreground Magenta;
Write-Host "#### $step" -foreground Magenta;
Write-Host "########################################################################################################" -foreground Magenta
}

function Write-Variable ([string]$variableName, [string]$variableValue) {
Write-Host ($variableName + " = " + $variableValue)
}

function Invoke-ExitCodeCheck([string]$exitCode) {
if ([int]::Parse($exitCode) -gt 0) {
Write-Host "This is the end, you know (ExitCode: $exitCode) - Lady, the plans we had went all wrong - We ain't nothing but fight and shout and tears." -ForegroundColor Red
exit $exitCode;
}
}

function Write-Host-Info([string]$message) {
Write-Host $message
}

function Write-Host-Success([string]$message) {
Write-Host $message -ForegroundColor Green
}

function Write-Host-Warning([string]$message) {
Write-Host $message -ForegroundColor Yellow
}

function Write-Host-Error([string]$message) {
Write-Host $message -ForegroundColor Red
}
34 changes: 34 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/Bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
### Summary

<!--
Summarize the bug. Map the MR with Tickets from JIRA (by using the ticket id)
-->

### Relevant logs and/or screenshots

<!--
Paste any relevant logs - please use code blocks (```) to format console output,
logs, and code as it's very hard to read otherwise.)
-->

### Review

<!--
The bullet points will be edited by the reviewer
-->

**Typical tasks**

- [ ] Merge-Request is well described
- [ ] Critical sections are *documented in code*
- [ ] *Tests* are extended
- [ ] *Documentation* is created / updated
- [ ] Running in test environment

**Clean code**

- [ ] *All* unused references are removed
- [ ] Clean code rules are respected with passion (naming, ...)
- [ ] Avoid *copy and pasted* code snippets

/label ~Bug
38 changes: 38 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/Feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
### Summary

<!--
Summarize the feature. Map the MR with Tickets from JIRA (by using the ticket id)
-->

### Relevant logs and/or screenshots

<!--
Paste any relevant logs - please use code blocks (```) to format console output,
logs, and code as it's very hard to read otherwise.)
Paste images of the new features.
-->

### Review

<!--
The bullet points will be edited by the reviewer
-->

**Typical tasks**

- [ ] Merge-Request is well described
- [ ] Added `Obsolete` attributes if necessary
- [ ] Critical sections are *documented in code*
- [ ] *Tests* available or extended
- [ ] *Documentation* is created / updated
- [ ] Running in test environment
- [ ] *Manual* is created / updated

**Clean code**

- [ ] *All* unused references are removed
- [ ] Clean code rules are respected with passion (naming, ...)
- [ ] Avoid *copy and pasted* code snippets

/label ~Feature
Empty file.
86 changes: 86 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]

env:
MORYX_OPTIMIZE_CODE: "false"
MORYX_BUILD_CONFIG: "Release"
MORYX_BUILDNUMBER: ${{github.run_number}}
MORYX_BRANCH: "dev" #TODO: ${{github.ref}} parse branch name
MORYX_CODECOV_SECRET: ${{secrets.CODECOV_TOKEN}}
MORYX_NUGET_APIKEY: ${{secrets.MYGET_TOKEN}}

jobs:
Build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1

- name: Setup NuGet.exe
uses: NuGet/[email protected]

- name: Build
shell: pwsh
run: ./Build.ps1 -Build
Test:
needs: [Build]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1

- name: Setup NuGet.exe
uses: NuGet/[email protected]

- name: Execute Unit Tests
shell: pwsh
run: ./Build.ps1 -UnitTests

- name: Execute Integration Tests
shell: pwsh
run: ./Build.ps1 -IntegrationTests

- name: Cover Report
shell: pwsh
run: ./Build.ps1 -CoverReport

- name: Upload test results
uses: actions/upload-artifact@v1
with:
name: test-results
path: artifacts/Tests
Publish:
needs: [Test]
if: (github.event_name == 'push')
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1

- name: Setup NuGet.exe
uses: NuGet/[email protected]

- name: Set assembly versions
shell: pwsh
run: ./Build.ps1 -SetAssemblyVersion

- name: Build
shell: pwsh
run: ./Build.ps1 -Build

- name: Pack & Publish
shell: pwsh
run: ./Build.ps1 -Pack -Publish
65 changes: 65 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "Build",
"script": "${workspaceRoot}\\Build.ps1",
"args": ["-Build"],
"cwd": "${workspaceRoot}"
},
{
"type": "PowerShell",
"request": "launch",
"name": "AssemblyVersion",
"script": "${workspaceRoot}\\Build.ps1",
"args": ["-SetAssemblyVersion"],
"cwd": "${workspaceRoot}"
},
{
"type": "PowerShell",
"request": "launch",
"name": "UnitTests",
"script": "${workspaceRoot}\\Build.ps1",
"args": ["-UnitTests"],
"cwd": "${workspaceRoot}"
},
{
"type": "PowerShell",
"request": "launch",
"name": "CoverReport",
"script": "${workspaceRoot}\\Build.ps1",
"args": ["-CoverReport"],
"cwd": "${workspaceRoot}"
},
{
"type": "PowerShell",
"request": "launch",
"name": "SystemTests",
"script": "${workspaceRoot}\\Build.ps1",
"args": ["-SystemTests"],
"cwd": "${workspaceRoot}"
},
{
"type": "PowerShell",
"request": "launch",
"name": "Nuget Pack",
"script": "${workspaceRoot}\\Build.ps1",
"args": ["-Pack"],
"cwd": "${workspaceRoot}"
}
{
"type": "PowerShell",
"request": "launch",
"name": "Documentation",
"script": "${workspaceRoot}\\Build.ps1",
"args": ["-GenerateDocs"],
"cwd": "${workspaceRoot}"
}
]
}

64 changes: 64 additions & 0 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
param (
[switch]$SetAssemblyVersion,
[switch]$Build,

[switch]$SmokeTests,
[switch]$UnitTests,
[switch]$IntegrationTests,
[switch]$SystemTests,

[switch]$CoverReport,
[switch]$GenerateDocs,

[switch]$Pack,
[switch]$Publish
)

# Load Toolkit
. ".build\BuildToolkit.ps1"

# Initialize Toolkit
Invoke-Initialize -Version (Get-Content "VERSION");

if ($SetAssemblyVersion) {
Set-AssemblyVersions;
}

if ($Build) {
Invoke-Build ".\MoryxPlatform.sln"
}

if ($SmokeTests) {
$runtimePath = "$RootPath\src\StartProject\bin\$env:MORYX_BUILD_CONFIG\StartProject.exe";
Invoke-SmokeTest $runtimePath 3 6000
}

if ($UnitTests) {
Invoke-CoverTests -SearchFilter "*.Tests.csproj"
}

if ($IntegrationTests) {
Invoke-CoverTests -SearchFilter "*.IntegrationTests.csproj"
}

if ($SystemTests) {
Invoke-Nunit -SearchFilter "*.SystemTests.csproj"
}

if ($CoverReport) {
Invoke-CodecovUpload
}

if ($GenerateDocs) {
Invoke-DocFx
}

if ($Pack) {
Invoke-PackAll -Symbols
}

if ($Publish) {
Invoke-Publish
}

Write-Host "Success!"
15 changes: 15 additions & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<!-- Allow NuGet to download missing packages -->
<add key="enabled" value="True" />

<!-- Automatically check for missing packages during build in Visual Studio -->
<add key="automatic" value="True" />
</packageRestore>

<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# MORYX Platform

[![pipeline status](http://gitlab-swtd.europe.phoenixcontact.com/marvinplatform/MarvinPlatform/badges/master/pipeline.svg)](http://gitlab-swtd.europe.phoenixcontact.com/marvinplatform/MarvinPlatform/commits/master)
[![coverage report](http://gitlab-swtd.europe.phoenixcontact.com/marvinplatform/MarvinPlatform/badges/master/coverage.svg)](http://gitlab-swtd.europe.phoenixcontact.com/marvinplatform/MarvinPlatform/commits/master)
![CI](https://github.com/dbeuchler/MarvinPlatform/workflows/CI/badge.svg)
[![codecov](https://codecov.io/gh/dbeuchler/MarvinPlatform/branch/dev/graph/badge.svg?token=BZUCXPUNHU)](https://codecov.io/gh/dbeuchler/MarvinPlatform)

The MORYX Platform is a .NET based framework to quickly build three-tier applications. It aims to reduce boilerplate code as much as possible and provide modularity, flexibility and easy configuration with very little effort. It is also the foundation for the Phoenix Contact IoT Framework [MORYX Abstraction Layer](https://git-ctvc.europe.phoenixcontact.com/marvin/AbstractionLayer)

Expand Down
Loading

0 comments on commit fee8e47

Please sign in to comment.