Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
chriswalpen committed Dec 7, 2021
2 parents ed3ced7 + 07c43de commit 240fdaa
Show file tree
Hide file tree
Showing 175 changed files with 2,876 additions and 2,186 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build
on:
push:
branches:
- master
- dev
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"WickedFlame_Broadcast" /o:"wickedflame" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="src/Tests/**/coverage.opencover.xml"
dotnet build
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
23 changes: 22 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ mono: none
#dist: xenial
dotnet: 3.1.414

#node_js:
# - "10"

notifications:
email:
# recipients:
Expand All @@ -13,10 +16,28 @@ notifications:
on_success: never #[always|never|change] # default: change
on_failure: always #[always|never|change] # default: always

before_script:
- export PATH="$PATH:$HOME/.dotnet/tools"

install:
- dotnet tool install --global dotnet-sonarscanner
- dotnet restore
- nvm install 10.0.0
- nvm use 10.0.0

script:
- dotnet sonarscanner begin /k:"WickedFlame_Broadcast" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="$SONAR_KEY" /d:sonar.language="cs" /d:sonar.exclusions="**/bin/**/*,**/obj/**/*" /d:sonar.cs.opencover.reportsPaths="lcov.opencover.xml" || true
- dotnet build --configuration NetCore
# - dotnet test
# - dotnet test Tests/DataImporter.Tests/DataImporter.Tests.csproj
# - dotnet test Tests/DataImporter.Tests/DataImporter.Tests.csproj
- dotnet sonarscanner end /d:sonar.login="$SONAR_KEY" || true

#addons:
# sonarcloud:
# organization: "wickedflame"
# token:
# secure: "" # encrypted value of your token

#script:
# the following command line builds the project, runs the tests with coverage and then execute the SonarCloud analysis
# - sonar-scanner
12 changes: 7 additions & 5 deletions Broadcast.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29509.3
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Broadcast", "src\Broadcast\Broadcast.csproj", "{88E7BB4F-B2BD-4BB9-99D2-66CDDD7095DA}"
EndProject
Expand All @@ -12,25 +12,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.travis.yml = .travis.yml
appveyor.yml = appveyor.yml
src\Broadcast.snk = src\Broadcast.snk
.github\workflows\build.yml = .github\workflows\build.yml
License.txt = License.txt
README.md = README.md
sonar-project.properties = sonar-project.properties
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{7B8E8745-88B2-4319-884D-556F587570DC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Broadcast.Console.Test", "src\Tests\Broadcast.Console.Test\Broadcast.Console.Test.csproj", "{D8F923B8-220A-41C1-9E5E-BDDEC71EA0BF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Broadcast.Console.TestApp", "src\Tests\Broadcast.Console.TestApp\Broadcast.Console.TestApp.csproj", "{D8F923B8-220A-41C1-9E5E-BDDEC71EA0BF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Broadcast.Test", "src\Tests\Broadcast.Test\Broadcast.Test.csproj", "{5F4A862D-AD7C-4C5B-83FA-A920ACB8479A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Broadcast.Integration.Test", "src\Tests\Broadcast.Integration.Test\Broadcast.Integration.Test.csproj", "{D3D96D6A-ED86-46B2-BB0A-7BAD8326DE7E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Broadcast.AspNetCore.Test", "src\Tests\Broadcast.AspNetCore.Test\Broadcast.AspNetCore.Test.csproj", "{082D5010-3136-4500-AF51-79D3153044DF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Broadcast.AspNetCore.TestApp", "src\Tests\Broadcast.AspNetCore.TestApp\Broadcast.AspNetCore.TestApp.csproj", "{082D5010-3136-4500-AF51-79D3153044DF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Broadcast.Dashboard", "src\Broadcast.Dashboard\Broadcast.Dashboard.csproj", "{FF470A41-7608-4E25-A298-8565E92C592A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Broadcast.Dashboard.Test", "src\Tests\Broadcast.Dashboard.Test\Broadcast.Dashboard.Test.csproj", "{CBD5AFD6-5AFC-41E5-B112-00FF3BBB485E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Broadcast.AspNet.Test", "src\Tests\Broadcast.AspNet.Test\Broadcast.AspNet.Test.csproj", "{420C8308-7468-4553-A062-E082CDCB78DB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Broadcast.AspNet.TestApp", "src\Tests\Broadcast.AspNet.TestApp\Broadcast.AspNet.TestApp.csproj", "{420C8308-7468-4553-A062-E082CDCB78DB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{18910F76-F1A5-43F3-9284-EFEC491C8C52}"
EndProject
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
[![Build status](https://img.shields.io/appveyor/build/chriswalpen/broadcast/dev?label=Dev&logo=appveyor&style=for-the-badge)](https://ci.appveyor.com/project/chriswalpen/broadcast/branch/dev)
[![NuGet Version](https://img.shields.io/nuget/v/broadcast.svg?style=for-the-badge&label=Latest)](https://www.nuget.org/packages/broadcast/)
[![NuGet Version](https://img.shields.io/nuget/vpre/broadcast.svg?style=for-the-badge&label=RC)](https://www.nuget.org/packages/broadcast/)


[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=WickedFlame_Broadcast&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=WickedFlame_Broadcast)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=WickedFlame_Broadcast&metric=coverage)](https://sonarcloud.io/summary/new_code?id=WickedFlame_Broadcast)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=WickedFlame_Broadcast&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=WickedFlame_Broadcast)

[![Codacy Badge](https://app.codacy.com/project/badge/Grade/9f04469804014684ac6c1e91bed72e5e)](https://www.codacy.com/gh/WickedFlame/Broadcast/dashboard?utm_source=github.com&utm_medium=referral&utm_content=WickedFlame/Broadcast&utm_campaign=Badge_Grade)

Expand Down
23 changes: 10 additions & 13 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ image:
- Visual Studio 2017

# version format
version: 1.0.1.{build}
version: 1.0.2.{build}

# you can use {branch} name in version format too
# version: 1.0.{build}-{branch}
environment:
rc_version: 1.0.1-RC{build}
base_version: 1.0.1
rc_version: 1.0.2-RC{build}
base_version: 1.0.2

# branches to build
branches:
Expand Down Expand Up @@ -50,8 +50,6 @@ configuration: Release

before_build:
- nuget restore
- nuget install OpenCover -OutputDirectory packages -Version 4.7.1221
- nuget install codecov -OutputDirectory packages

build:
parallel: true # enable MSBuild parallel builds
Expand Down Expand Up @@ -100,18 +98,17 @@ test:
# - [DAL, BL] # 2nd job

# scripts to run before tests
before_test:
#before_test:
# - echo script1
# - ps: Write-Host "script1"

# scripts to run after tests
after_test:


# to run your custom scripts instead of automatic tests
test_script:
#test_script:
# - echo This is my custom test script
- packages\OpenCover.Console.exe -register:user -targetargs:"test --logger:trx;LogFileName=results.trx /p:DebugType=full -output:"broadcaster_coverage.xml" -filter:"+[LetsDisc*]* -[Tests*]*"
- packages\codecov -f "broadcaster_coverage.xml"

# scripts to run after tests
#after_test:

# to disable automatic tests
#test: off

Expand Down
27 changes: 0 additions & 27 deletions codecov.yml

This file was deleted.

22 changes: 22 additions & 0 deletions coverlet.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat code coverage">
<Configuration>
<Format>json,cobertura,lcov,teamcity,opencover</Format>
<Exclude>[*.tests?]*</Exclude> <!-- [*.tests?]*,[*]Coverlet.Core* [Assembly-Filter]Type-Filter -->
<Include>Broadcast,Broadcast.Dashboard,Broadcast.Storage.Redis</Include> <!-- [coverlet.*]*,[*]Coverlet.Core* [Assembly-Filter]Type-Filter -->
<ExcludeByAttribute>Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute</ExcludeByAttribute>
<ExcludeByFile>**/dir1/class1.cs,**/dir2/*.cs,**/dir3/**/*.cs,</ExcludeByFile> <!-- Globbing filter -->
<IncludeDirectory>../dir1/,../dir2/,</IncludeDirectory>
<SingleHit>false</SingleHit>
<UseSourceLink>true</UseSourceLink>
<IncludeTestAssembly>true</IncludeTestAssembly>
<SkipAutoProps>true</SkipAutoProps>
<DeterministicReport>false</DeterministicReport>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
10 changes: 4 additions & 6 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ nav_order: 99
---

## Broadcast Changelog
### vNext
- Rename BackgroundTaskClient to BackgroundTask

### 0.5.0
* Updated the Project to a .NetStandard Library
* Renamded Parallel mode to Serial mode
* Added: Task scheduling - Execute tasks at a certain time instead of directly
* Added: Recurring task execution - Execute tasks multiple times at a desired interval
* Breaking change: The default PorcessorMode is set to Async. If a Parallel Mode is desired, the Broadcaster has to be initialized with the ProcessorMode set to Parallel.
### v1.0.1
* Total workover of v0.5
7 changes: 4 additions & 3 deletions src/Broadcast.Dashboard/AppBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,20 @@ public static IAppBuilder UseBroadcastServer(this IAppBuilder builder, Action<IS
var storage = serverSetup.Resolve<IStorage>() ?? new InmemoryStorage();
var store = serverSetup.Resolve<ITaskStore>() ?? new TaskStore(options, storage);

var processor = new TaskProcessor(store, options);
var processorOptions = serverSetup.Resolve<ProcessorOptions>() ?? new ProcessorOptions();
var processor = new TaskProcessor(store, processorOptions);
var scheduler = new Scheduler();

TaskStore.Setup(() => store);

BroadcastServer.Setup(c =>
c.AddOptions(options)
c.AddOptions(processorOptions)
.AddProcessor(processor)
.AddScheduler(scheduler)
.AddTaskStore(store)
);

BackgroundTaskClient.Setup(() => new BroadcastingClient(store));
BackgroundTask.Setup(() => new BroadcastingClient(store));

return builder;
}
Expand Down
15 changes: 10 additions & 5 deletions src/Broadcast.Dashboard/Assets/js/broadcast-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ export class BroadcastDashboard extends BroadcastBase {
super();

this.config = config;
//setTimeout(() => {
// this.startPolling(config, (data) => this.updateDashboard(data, this));
//}, 3000);
this.startPolling(config, (data) => this.updateDashboard(data, this));

document.querySelector('#tasklist').addEventListener('click',
Expand Down Expand Up @@ -55,6 +52,7 @@ export class BroadcastDashboard extends BroadcastBase {
updateDashboard(data, dashboard) {
// servers
this.updateElement(document.querySelector('#broadcast-servers-count'), data.servers.length);
this.updateElement(document.querySelector('#broadcast-threads-count'), data.metrics[0].value);
var serverList = document.querySelector('#serverlist');
data.servers.forEach(s => {
var serverElem = serverList.querySelector(`#serverheartbeat_${s.id}`);
Expand Down Expand Up @@ -237,7 +235,14 @@ export class BroadcastDashboard extends BroadcastBase {
return response.json();
}).then(function(response) {
var rows = '';

if (response === null) {
response = {
groups: [],
title: 'task',
key: `No taskdata availiable for ${id}`
}
}

response.groups.forEach(g => {
if (g.values.length > 0) {
rows = rows + `<div class="broadcast-storage-type-row"><span></span><h4>${g.title}</h4></div>`;
Expand Down Expand Up @@ -345,7 +350,7 @@ export class BroadcastDashboard extends BroadcastBase {

if (dashboardConfig === undefined) {
dashboardConfig = {
pollUrl: "%(RouteBasePath)/dashboard/metrics",
pollUrl: "%(RouteBasePath)/dashboard/data",
dashboardUrl: "%(RouteBasePath)/dashboard",
pollInterval: 1000
};
Expand Down
4 changes: 4 additions & 0 deletions src/Broadcast.Dashboard/Assets/js/broadcast-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ ${this.createStorageValues(values)}

updateStorageElement(elem, values) {
elem.querySelector('.broadcast-storage-content').innerHTML = this.createStorageValues(values);
var state = values.find(i => i.key === 'State');
if (state) {
elem.setAttribute('data-state', state.value);
}
}

appendChild(list, child) {
Expand Down
16 changes: 13 additions & 3 deletions src/Broadcast.Dashboard/Assets/views/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,22 @@
<div class="">
<div class="broadcast-section">
<div class="broadcast-recap-section">
<div class="broadcast-recap-section-item">
<div>
<h4>Servers</h4>
</div>
<div>
<span id="broadcast-servers-count">
-
</span>
</div>
</div>
<div class="broadcast-recap-section-item">
<div>
<h4>Servers</h4>
<h4>Open Threads</h4>
</div>
<div>
<span id="broadcast-servers-count">
<span id="broadcast-threads-count">
-
</span>
</div>
Expand Down Expand Up @@ -177,7 +187,7 @@ <h3><span id="broadcast-data-title">Title</span> : <span id="broadcast-data-key"

<script>
var dashboardConfig = {
pollUrl: "%(RouteBasePath)/dashboard/metrics",
pollUrl: "%(RouteBasePath)/dashboard/data",
dashboardUrl: "%(RouteBasePath)/dashboard",
pollInterval: 1000
}
Expand Down
Loading

0 comments on commit 240fdaa

Please sign in to comment.