Skip to content

Commit

Permalink
StyleCop + NuGet
Browse files Browse the repository at this point in the history
  • Loading branch information
lithiumtoast committed Aug 14, 2022
1 parent b260b5f commit a0fda94
Show file tree
Hide file tree
Showing 247 changed files with 1,079 additions and 943 deletions.
104 changes: 100 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,80 @@ on:

jobs:

build-job:
name: "GitVersion"
native-job:
name: "Build native libraries ${{ matrix.platform.rid }}"
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- { name: Windows (x64), os: windows-latest, rid: win-x64 }
- { name: Linux (x64), os: ubuntu-latest, rid: linux-x64 }
- { name: macOS (x64+arm64), os: macos-latest, rid: osx }
steps:

- name: "Clone Git repository"
uses: actions/checkout@v3
with:
submodules: 'false'

- name: "Update Git submodules"
shell: bash
run: |
git submodule update --init --recursive
git submodule update --remote --merge ./ext/katabasis-bedrock
- name: "Set variables"
id: vars
shell: bash
run: |
cd ./ext/katabasis-bedrock
HASH="$(git rev-parse HEAD)"
echo "HASH: $HASH"
echo ::set-output name=katabasis_bedrock_hash::$HASH
- name: "Cache native libraries"
id: cache-libs
uses: actions/cache@v3
with:
path: "./ext/katabasis-bedrock/lib"
key: "libs-${{ matrix.platform.rid }}-${{ hashFiles('library.sh') }}-${{ steps.vars.outputs.katabasis_bedrock_hash }}"

- name: "Install Windows dependencies"
if: ${{ steps.cache-libs.outputs.cache-hit != 'true' && runner.os == 'Windows' }}
run: |
choco install ninja
- name: "Install macOS dependencies"
if: ${{ steps.cache-libs.outputs.cache-hit != 'true' && runner.os == 'macOS' }}
run: |
brew install ninja
- name: "Install Linux dependencies"
if: ${{ steps.cache-libs.outputs.cache-hit != 'true' && runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install ninja-build
- name: "Build native libraries"
if: steps.cache-libs.outputs.cache-hit != 'true'
shell: bash
run: ./library.sh

- name: "Upload native libraries"
uses: actions/upload-artifact@v2
with:
name: "native-libraries-${{ matrix.platform.rid }}"
path: './ext/katabasis-bedrock/lib/${{ matrix.platform.rid }}'

dotnet-job:
name: ".NET"
runs-on: ubuntu-latest
needs: [native-job]

steps:
- name: "Checkout Git repository"
uses: actions/checkout@v3
with:
ref: ${{ env.GITHUB_REF }}
submodules: 'recursive'

- name: "Fetch all history for all tags and branches"
Expand All @@ -44,12 +109,43 @@ jobs:
id: gitversion
uses: gittools/actions/gitversion/[email protected]

- name: "Download native libraries: win-x64"
uses: actions/download-artifact@v1
with:
name: "native-libraries-win-x64"
path: './ext/katabasis-bedrock/lib/win-x64'

- name: "Download native libraries: osx"
uses: actions/download-artifact@v1
with:
name: "native-libraries-osx"
path: './ext/katabasis-bedrock/lib/osx'

- name: "Download native libraries: linux-x64"
uses: actions/download-artifact@v1
with:
name: "native-libraries-linux-x64"
path: './ext/katabasis-bedrock/lib/linux-x64'

- name: "Build solution"
run: dotnet build --nologo --configuration Release /p:Version='${{ steps.gitversion.outputs.nuGetVersionV2 }}"'
run: dotnet build --nologo --configuration Release /p:Version='${{ steps.gitversion.outputs.nuGetVersionV2 }}'

- name: "Test solution"
run: dotnet test --nologo --configuration Release --no-build

- name: "Pack solution"
run: dotnet pack --nologo --configuration Release --no-build /p:Version='${{ steps.gitversion.outputs.nuGetVersionV2 }}'

- name: "Upload NuGet packages: MyGet"
shell: bash
if: ${{ github.event_name == 'push' || startsWith(github.ref, 'refs/tags/v') }}
run: dotnet nuget push "${{ github.workspace }}/**/*.nupkg" --source https://www.myget.org/F/bottlenoselabs/api/v3/index.json --skip-duplicate --api-key ${{ secrets.MYGET_ACCESS_TOKEN }}

- name: "Upload NuGet packages: NuGet"
shell: bash
if: "${{ startsWith(github.ref, 'refs/tags/v') }}"
run: dotnet nuget push "${{ github.workspace }}/**/*.nupkg" --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${{ secrets.NUGET_ACCESS_TOKEN }}




Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ lib/

# macOS
.DS_Store

# Packed NuGet packages
/nupkg/*
11 changes: 11 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
assembly-versioning-scheme: None
mode: ContinuousDeployment
tag-prefix: "[vV]"
continuous-delivery-fallback-tag: ""
branches:
develop:
regex: '^main$'
increment: Patch
tag: 'pre'
main:
regex: '^notused$'
15 changes: 0 additions & 15 deletions Katabasis.sln
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Bedrock", "Bedrock", "{9306
ext\katabasis-bedrock\README.md = ext\katabasis-bedrock\README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Katabasis.Bedrock", "ext\katabasis-bedrock\src\cs\production\Katabasis.Bedrock\Katabasis.Bedrock.csproj", "{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Katabasis.Bedrock.win-x64", "ext\katabasis-bedrock\src\cs\production\Katabasis.Bedrock.win-x64\Katabasis.Bedrock.win-x64.csproj", "{BC07E29C-E8BA-4BC2-A479-CF63C44AA55C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Katabasis.Bedrock.linux-x64", "ext\katabasis-bedrock\src\cs\production\Katabasis.Bedrock.linux-x64\Katabasis.Bedrock.linux-x64.csproj", "{9FE09BC4-AB66-40B6-B28A-5014CE90272E}"
Expand Down Expand Up @@ -330,18 +328,6 @@ Global
{16DF9AC9-9066-4C33-AA6E-B41DE41706F1}.Release|x64.Build.0 = Release|Any CPU
{16DF9AC9-9066-4C33-AA6E-B41DE41706F1}.Release|x86.ActiveCfg = Release|Any CPU
{16DF9AC9-9066-4C33-AA6E-B41DE41706F1}.Release|x86.Build.0 = Release|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Debug|x64.ActiveCfg = Debug|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Debug|x64.Build.0 = Debug|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Debug|x86.ActiveCfg = Debug|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Debug|x86.Build.0 = Debug|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Release|Any CPU.Build.0 = Release|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Release|x64.ActiveCfg = Release|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Release|x64.Build.0 = Release|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Release|x86.ActiveCfg = Release|Any CPU
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2}.Release|x86.Build.0 = Release|Any CPU
{BC07E29C-E8BA-4BC2-A479-CF63C44AA55C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC07E29C-E8BA-4BC2-A479-CF63C44AA55C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC07E29C-E8BA-4BC2-A479-CF63C44AA55C}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -444,7 +430,6 @@ Global
{7BABA9FE-1086-4610-B4C0-1255CEFD14AC} = {6023ED4A-6070-4125-B36E-8C8EE45ABBF4}
{2097E157-703D-4374-8D5C-9774AA67D00D} = {C97F28F8-C889-4BF9-84E3-52DD0C1AB1FD}
{16DF9AC9-9066-4C33-AA6E-B41DE41706F1} = {2097E157-703D-4374-8D5C-9774AA67D00D}
{31FA7604-66AE-47AF-8B40-57AA2AFE64D2} = {93065BEE-1597-4D74-8B05-C031F53916B2}
{BC07E29C-E8BA-4BC2-A479-CF63C44AA55C} = {93065BEE-1597-4D74-8B05-C031F53916B2}
{9FE09BC4-AB66-40B6-B28A-5014CE90272E} = {93065BEE-1597-4D74-8B05-C031F53916B2}
{0E0EFADE-F6C1-4AC7-9F7D-DDE5DADC4B37} = {93065BEE-1597-4D74-8B05-C031F53916B2}
Expand Down
4 changes: 3 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# TODO
# TODO

- Pack C# as source code and native libraries as binaries
6 changes: 3 additions & 3 deletions src/cs/Common.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project>

<!-- MSBuild.Tools settings -->
<!-- bottlenoselabs.MSBuild.Tools settings -->
<PropertyGroup>
<CodeAnalysisRuleSetFilePath>$(MSBuildThisFileDirectory)/CodeAnalysis.ruleset</CodeAnalysisRuleSetFilePath>
<StyleCopSettingsFilePath>$(MSBuildThisFileDirectory)/StyleCop.json</StyleCopSettingsFilePath>
</PropertyGroup>

<!-- NuGet -->
<!-- NuGet packages -->
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)NuGet.config" Link="Properties/NuGet.config" />
<PackageReference Include="bottlenoselabs.MSBuild.Tools" Version="1.1.6" PrivateAssets="all" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/cs/StyleCop.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"useTabs": true
},
"documentationRules": {
"companyName": "BottlenoseLabs (https://github.com/bottlenoselabs)",
"companyName": "Bottlenose Labs Inc. (https://github.com/bottlenoselabs)",
"copyrightText": "Copyright (c) {companyName}. All rights reserved.\nLicensed under the {licenseName} license. See {licenseFile} file in the Git repository root directory for full license information.",
"variables": {
"licenseName": "MS-PL",
Expand Down
2 changes: 1 addition & 1 deletion src/cs/StyleCop.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<Rule Id="SA1216" Action="Error" />
<Rule Id="SA1217" Action="Error" />

<Rule Id="SA1300" Action="Error" />
<Rule Id="SA1300" Action="Hidden" />
<Rule Id="SA1301" Action="Error" />
<Rule Id="SA1302" Action="Hidden" />
<Rule Id="SA1303" Action="Error" />
Expand Down
10 changes: 0 additions & 10 deletions src/cs/games/Directory.Build.props

This file was deleted.

5 changes: 0 additions & 5 deletions src/cs/games/Directory.Build.targets

This file was deleted.

8 changes: 1 addition & 7 deletions src/cs/production/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<Project>

<Import Project="../Common.props" />

<PropertyGroup>
<IsPackable>true</IsPackable>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)/../Common.props" />

</Project>
7 changes: 6 additions & 1 deletion src/cs/production/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<Project>

<Import Project="../Common.targets" />
<Import Project="$(MSBuildThisFileDirectory)/../Common.targets" />

<PropertyGroup>
<IsPackable>true</IsPackable>
<IncludeSymbols>false</IncludeSymbols>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<!-- Disable warnins -->
<PropertyGroup>
<NoWarn>CA1051</NoWarn>
<NoWarn>$(NoWarn);CA1051</NoWarn>
</PropertyGroup>

</Project>
6 changes: 3 additions & 3 deletions src/cs/production/Katabasis.Extended/Math/AABB2.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) BottlenoseLabs (https://github.com/bottlenoselabs). All rights reserved.
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved.
// Licensed under the MS-PL license. See LICENSE file in the Git repository root directory for full license information.

using System;
Expand Down Expand Up @@ -295,7 +295,7 @@ public AABB2 Intersection(ref AABB2 aabb)
/// <param name="first">The first axis-aligned-bounding-box.</param>
/// <param name="second">The second axis-aligned-bounding-box.</param>
/// <returns>
/// <c>true</c> if the <paramref name="first" /> intersects with the <see cref="second" />; otherwise, <c>false</c>.
/// <c>true</c> if the <paramref name="first" /> intersects with the <paramref name="second"/>; otherwise, <c>false</c>.
/// </returns>
public static bool Intersects(ref AABB2 first, ref AABB2 second)
{
Expand All @@ -319,7 +319,7 @@ public static bool Intersects(ref AABB2 first, ref AABB2 second)
/// <param name="first">The first axis-aligned-bounding-box.</param>
/// <param name="second">The second axis-aligned-bounding-box.</param>
/// <returns>
/// <c>true</c> if the <paramref name="first" /> intersects with the <see cref="second" />; otherwise, <c>false</c>.
/// <c>true</c> if the <paramref name="first" /> intersects with the <paramref name="second"/>; otherwise, <c>false</c>.
/// </returns>
[ExcludeFromCodeCoverage]
public static bool Intersects(AABB2 first, AABB2 second)
Expand Down
2 changes: 1 addition & 1 deletion src/cs/production/Katabasis.Extended/Math/Line2.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) BottlenoseLabs (https://github.com/bottlenoselabs). All rights reserved.
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved.
// Licensed under the MS-PL license. See LICENSE file in the Git repository root directory for full license information.

// using System;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) BottlenoseLabs (https://github.com/bottlenoselabs). All rights reserved.
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved.
// Licensed under the MS-PL license. See LICENSE file in the Git repository root directory for full license information.

using System;
Expand Down
3 changes: 2 additions & 1 deletion src/cs/production/Katabasis.Framework/Audio/AudioCategory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) BottlenoseLabs (https://github.com/bottlenoselabs). All rights reserved.
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved.
// Licensed under the MS-PL license. See LICENSE file in the Git repository root directory for full license information.

using System;
using System.Diagnostics.CodeAnalysis;
using static bottlenoselabs.FAudio;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) BottlenoseLabs (https://github.com/bottlenoselabs). All rights reserved.
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved.
// Licensed under the MS-PL license. See LICENSE file in the Git repository root directory for full license information.
namespace bottlenoselabs.Katabasis
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) BottlenoseLabs (https://github.com/bottlenoselabs). All rights reserved.
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved.
// Licensed under the MS-PL license. See LICENSE file in the Git repository root directory for full license information.
using System;
using System.Numerics;
Expand Down
8 changes: 5 additions & 3 deletions src/cs/production/Katabasis.Framework/Audio/AudioEngine.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) BottlenoseLabs (https://github.com/bottlenoselabs). All rights reserved.
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved.
// Licensed under the MS-PL license. See LICENSE file in the Git repository root directory for full license information.

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using static bottlenoselabs.FAudio;

Expand Down Expand Up @@ -124,7 +124,7 @@ public AudioEngine(string settingsFile, TimeSpan lookAheadTime, string rendererI
notificationDesc.flags = FACT_FLAG_NOTIFICATION_PERSIST;
notificationDesc.type = FACTNOTIFICATIONTYPE_WAVEBANKDESTROYED;
FACTAudioEngine_RegisterNotification(handle, &notificationDesc);

notificationDesc.type = FACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED;
FACTAudioEngine_RegisterNotification(handle, &notificationDesc);
notificationDesc.type = FACTNOTIFICATIONTYPE_CUEDESTROYED;
Expand Down Expand Up @@ -189,6 +189,7 @@ private static void OnXACTNotification(FACTNotification* notification)

break;
}

case FACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED:
{
var target = notification->soundBank.pSoundBank;
Expand All @@ -207,6 +208,7 @@ private static void OnXACTNotification(FACTNotification* notification)

break;
}

case FACTNOTIFICATIONTYPE_CUEDESTROYED:
{
var target = notification->cue.pCue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) BottlenoseLabs (https://github.com/bottlenoselabs). All rights reserved.
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved.
// Licensed under the MS-PL license. See LICENSE file in the Git repository root directory for full license information.
using System;
using System.Numerics;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) BottlenoseLabs (https://github.com/bottlenoselabs). All rights reserved.
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved.
// Licensed under the MS-PL license. See LICENSE file in the Git repository root directory for full license information.
namespace bottlenoselabs.Katabasis
{
Expand Down
2 changes: 1 addition & 1 deletion src/cs/production/Katabasis.Framework/Audio/Cue.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) BottlenoseLabs (https://github.com/bottlenoselabs). All rights reserved.
// Copyright (c) Bottlenose Labs Inc. (https://github.com/bottlenoselabs). All rights reserved.
// Licensed under the MS-PL license. See LICENSE file in the Git repository root directory for full license information.
using System;
using System.Diagnostics.CodeAnalysis;
Expand Down
Loading

0 comments on commit a0fda94

Please sign in to comment.