Skip to content

Commit

Permalink
Fixes an issue where a failure to establish initial stream parsing co…
Browse files Browse the repository at this point in the history
…uld hang
  • Loading branch information
i8beef committed Oct 21, 2021
1 parent 6c1dfa4 commit f6f45b1
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 3 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: build
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"

env:
DOTNETVERSION: "5.0.x"
APP: "HarmonyHub"
SOLUTION: "./src/HarmonyHub.sln"
BUILDOUTPUTPATH: "./src/HarmonyHub/bin/Release/netstandard2.0"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup .NET Core SDK ${{ env.DOTNETVERSION }}
uses: actions/[email protected]
with:
dotnet-version: ${{ env.DOTNETVERSION }}

- name: Install dependencies
run: dotnet restore ${{ env.SOLUTION }}

- name: Build
run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore

- name: Upload app build artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.APP }}
path: ${{ env.BUILDOUTPUTPATH }}

- name: Test
run: dotnet test ${{ env.SOLUTION }} --no-restore --verbosity normal --logger trx --results-directory "TestResults"

- name: Upload TestResults build artifact
uses: actions/upload-artifact@v2
with:
name: TestResults
path: TestResults
101 changes: 101 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+.[0-9]+"

env:
DOTNETVERSION: "5.0.x"
APP: "HarmonyHub"
SOLUTION: "./src/HarmonyHub.sln"
BUILDOUTPUTPATH: "./src/HarmonyHub/bin/Release/netstandard2.0"
PACKOUTPUTPATH: "./out"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0

- name: Setup .NET Core SDK ${{ env.DOTNETVERSION }}
uses: actions/[email protected]
with:
dotnet-version: ${{ env.DOTNETVERSION }}

- name: Get version
id: version
uses: battila7/get-version-action@v2

- name: Get previous release tag
id: previousTag
uses: sammcoe/[email protected]

- name: Install dependencies
run: dotnet restore ${{ env.SOLUTION }}

- name: Build
run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore /p:Version=${{ steps.version.outputs.version-without-v }}

- name: Test
run: dotnet test ${{ env.SOLUTION }} --no-restore --verbosity normal --logger trx --results-directory "TestResults"

- name: Upload app build artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.APP }}-${{ steps.version.outputs.version-without-v }}
path: ${{ env.BUILDOUTPUTPATH }}

- name: Upload TestResults build artifact
uses: actions/upload-artifact@v2
with:
name: TestResults
path: TestResults

- name: Build changelog
id: gitLog
uses: jarrodparkes/[email protected]
with:
start: ${{ steps.previousTag.outputs.tag }}
end: ${{ github.ref }}

- name: GitHub release
uses: actions/create-release@v1
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: ${{ steps.version.outputs.version-without-v }}
tag_name: ${{ github.ref }}
body: ${{ env.LOG }}
draft: false
prerelease: false

- name: ZIP release artifact
run: zip -r ${{ env.APP }}-${{ steps.version.outputs.version-without-v }}.zip ${{ env.BUILDOUTPUTPATH }}

- name: GitHub release assets
uses: actions/upload-release-asset@v1
id: release_assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: ${{ env.APP }}-${{ steps.version.outputs.version-without-v }}.zip
asset_name: ${{ env.APP }}-${{ steps.version.outputs.version-without-v }}.zip
asset_content_type: application/zip

- name: NuGet pack
run: dotnet pack ${{ env.SOLUTION }} --configuration Release --no-restore --include-symbols /p:Version=${{ steps.version.outputs.version-without-v }} -o ${{ env.PACKOUTPUTPATH }}

- name: Upload NuGet build artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.APP }} NuGet Packages
path: ${{ env.PACKOUTPUTPATH }}

- name: NuGet push
run: dotnet nuget push "./${{ env.PACKOUTPUTPATH }}/*.nupkg" --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# HarmonyHub

[![Build status](https://ci.appveyor.com/api/projects/status/e346wmks920k8ik7/branch/release?svg=true)](https://ci.appveyor.com/project/i8beef/harmonyhub/branch/release)
[![Build status](https://ci.appveyor.com/api/projects/status/e346wmks920k8ik7/branch/master?svg=true)](https://ci.appveyor.com/project/i8beef/harmonyhub/branch/master)
![Build](https://github.com/i8beef/HarmonyHub/actions/workflows/build.yml/badge.svg?branch=master)
![Release](https://github.com/i8beef/HarmonyHub/actions/workflows/release.yml/badge.svg)

HarmonyHub is an event based .NET library for interacting with a Logitech Harmony Hub.

Expand Down
2 changes: 1 addition & 1 deletion src/HarmonyHub/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private async Task<XmlElement> RequestResponseAsync(XmlElement message, int time

var messageId = message.Attributes["id"].Value;

// Prepate the TaskCompletionSource, which is used to await the result
// Prepare the TaskCompletionSource, which is used to await the result
var resultTaskCompletionSource = new TaskCompletionSource<XmlElement>();
_resultTaskCompletionSources[messageId] = resultTaskCompletionSource;

Expand Down
3 changes: 3 additions & 0 deletions src/HarmonyHub/StreamParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ private void ReadRootElement()
throw new XmlException("Unexpected node: " + _reader.Name);
}
}

// If we got this far, the stream failed to establish
throw new Exception("Failed to read root node");
}

#region IDisposable interface implementation
Expand Down

0 comments on commit f6f45b1

Please sign in to comment.