Skip to content

Commit

Permalink
Merge branch 'release/0.3.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Reynolds committed May 26, 2021
2 parents 3e7d118 + cf6c8f0 commit 6c857c5
Show file tree
Hide file tree
Showing 33 changed files with 853 additions and 669 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['paypal.me/charliefoxtwo'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
80 changes: 80 additions & 0 deletions .github/workflows/develop-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: develop ci

on:
push:
branches:
- develop

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
include:
- os: windows-latest
runtime: win-x64
- os: macos-latest
runtime: osx-x64
- os: ubuntu-latest
runtime: linux-x64

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100

- name: Test
run: dotnet test --configuration Release

- name: Publish
run: cd ViLA && dotnet publish --configuration Release --runtime ${{ matrix.runtime }} -p:PublishSingleFile=true -p:DebugType=None --no-self-contained -o publish

- name: Zip Folder
run: cd ViLA/publish/ && zip -r ViLA-${{ matrix.runtime }}.zip . && mkdir -p ../../build/artifacts/${{ matrix.runtime }}/ && cp -r ViLA-${{ matrix.runtime }}.zip ../../build/artifacts/${{ matrix.runtime }}/

- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.runtime }}
path: build/artifacts/${{ matrix.runtime }}

publish:
needs: build

if: github.event_name == 'push'

runs-on: windows-latest

steps:
- name: Download Artifacts win-x64
uses: actions/download-artifact@v1
with:
name: win-x64

- name: Download Artifacts osx-x64
uses: actions/download-artifact@v1
with:
name: osx-x64

- name: Download Artifacts linux-x64
uses: actions/download-artifact@v1
with:
name: linux-x64

- name: Create Release
id: create_release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "alpha"
files: |
**/ViLA-*.zip
80 changes: 80 additions & 0 deletions .github/workflows/main-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: main-publish

on:
push:
branches:
- main

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
include:
- os: windows-latest
runtime: win-x64
- os: macos-latest
runtime: osx-x64
- os: ubuntu-latest
runtime: linux-x64

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100

- name: Test
run: dotnet test --configuration Release

- name: Publish
run: cd ViLA && dotnet publish --configuration Release --runtime ${{ matrix.runtime }} -p:PublishSingleFile=true -p:DebugType=None --no-self-contained -o publish

- name: Zip Folder
run: cd ViLA/publish/ && zip -r ViLA-${{ matrix.runtime }}.zip . && mkdir -p ../../build/artifacts/${{ matrix.runtime }}/ && cp -r ViLA-${{ matrix.runtime }}.zip ../../build/artifacts/${{ matrix.runtime }}/

- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.runtime }}
path: build/artifacts/${{ matrix.runtime }}

publish:
needs: build

if: github.event_name == 'push'

runs-on: windows-latest

steps:
- name: Download Artifacts win-x64
uses: actions/download-artifact@v1
with:
name: win-x64

- name: Download Artifacts osx-x64
uses: actions/download-artifact@v1
with:
name: osx-x64

- name: Download Artifacts linux-x64
uses: actions/download-artifact@v1
with:
name: linux-x64

- name: Create Release
id: create_release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "Latest Official Release"
files: |
**/ViLA-*.zip
35 changes: 0 additions & 35 deletions .github/workflows/prerelease-publish.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: release ci

on:
push:
branches:
- "release/*"

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
include:
- os: windows-latest
runtime: win-x64
- os: macos-latest
runtime: osx-x64
- os: ubuntu-latest
runtime: linux-x64

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.100

- name: Test
run: dotnet test --configuration Release

- name: Publish
run: cd ViLA && dotnet publish --configuration Release --runtime ${{ matrix.runtime }} -p:PublishSingleFile=true -p:DebugType=None --no-self-contained -o publish

- name: Zip Folder
run: cd ViLA/publish/ && zip -r ViLA-${{ matrix.runtime }}.zip . && mkdir -p ../../build/artifacts/${{ matrix.runtime }}/ && cp -r ViLA-${{ matrix.runtime }}.zip ../../build/artifacts/${{ matrix.runtime }}/

- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.runtime }}
path: build/artifacts/${{ matrix.runtime }}

publish:
needs: build

if: github.event_name == 'push'

runs-on: windows-latest

steps:
- name: Download Artifacts win-x64
uses: actions/download-artifact@v1
with:
name: win-x64

- name: Download Artifacts osx-x64
uses: actions/download-artifact@v1
with:
name: osx-x64

- name: Download Artifacts linux-x64
uses: actions/download-artifact@v1
with:
name: linux-x64

- name: Create Release
id: create_release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "RC"
files: |
**/ViLA-*.zip
2 changes: 1 addition & 1 deletion ViLA/Comparator.cs → Configuration/Comparator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ViLA
namespace Configuration
{
public enum Comparator
{
Expand Down
101 changes: 101 additions & 0 deletions Configuration/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable ClassNeverInstantiated.Global
#pragma warning disable 8618

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Virpil.Communicator;

namespace Configuration
{
public class Config
{
public LogLevel? LogLevel { get; set; }
public bool CheckUpdates { get; set; } = true;
public bool CheckPrerelease { get; set; } = false;
public HashSet<string> DisabledPlugins { get; set; } = new();

public Dictionary<string, Device>? Devices { get; set; }

/// <summary>
/// Appends the devices of the provided config to this config.
/// </summary>
/// <param name="otherConfig"></param>
public Config Append(Config otherConfig)
{
if (otherConfig.LogLevel is not null)
{
LogLevel = (LogLevel) Math.Min((int) (LogLevel ?? Microsoft.Extensions.Logging.LogLevel.None),
(int) otherConfig.LogLevel);
}

if (otherConfig.CheckPrerelease) CheckPrerelease = otherConfig.CheckPrerelease;
if (otherConfig.CheckUpdates) CheckUpdates = otherConfig.CheckUpdates;
DisabledPlugins.UnionWith(otherConfig.DisabledPlugins);

if (otherConfig.Devices != null)
{
if (Devices is null) Devices = new Dictionary<string, Device>();
foreach (var (deviceId, device) in otherConfig.Devices)
{
if (Devices.TryGetValue(deviceId, out var thisDevice))
{
foreach (var (boardType, boardActions) in device)
{
if (Devices[deviceId].TryGetValue(boardType, out var thisBoardActions))
{
foreach (var (ledNumber, ledActions) in boardActions)
{
if (Devices[deviceId][boardType].TryGetValue(ledNumber, out var thisLedActions))
{
thisLedActions.AddRange(ledActions);
}
else
{
thisLedActions = ledActions;
}

Devices[deviceId][boardType][ledNumber] = thisLedActions;
}
}
else
{
thisBoardActions = boardActions;
}

Devices[deviceId][boardType] = thisBoardActions;
}
}
else
{
thisDevice = device;
}

Devices[deviceId] = thisDevice;
}
}

return this;
}

public static Config? GetAllConfiguration()
{
return Directory.EnumerateFiles("Configuration", "*.json", SearchOption.AllDirectories).AsParallel()
.Select(f => JsonConvert.DeserializeObject<Config>(File.ReadAllText(f)))
.Where(c => c != null)
.Aggregate((s, t) => s!.Append(t!));
}
}

public class Device : Dictionary<BoardType, BoardActions>
{
}

public class BoardActions : Dictionary<int, List<LedAction>>
{
}
}
Loading

0 comments on commit 6c857c5

Please sign in to comment.