Skip to content

Commit

Permalink
Merge pull request #36 from exomia/development
Browse files Browse the repository at this point in the history
workflow & readme changed
  • Loading branch information
baetz-daniel authored Oct 30, 2020
2 parents abf26f4 + 2647d8c commit 9a480db
Show file tree
Hide file tree
Showing 17 changed files with 355 additions and 173 deletions.
26 changes: 9 additions & 17 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,44 @@ on:
branches:
- master
- development
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
build:
name: build release and debug
build-windows:
name: build release and debug for windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.300
- name: build debug
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
run: |
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=AnyCPU
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=x86
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=x64
- name: build release
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
run: |
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=AnyCPU
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=x86
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=x64
test:
name: test release and debug
needs: [build]
test-windows:
name: test release and debug for windows
needs: [build-windows]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.300
- name: test debug
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
run: |
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=AnyCPU
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=x86
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=x64
- name: test release
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
run: |
dotnet test tests/L0/Exomia.Framework.Tests --configuration Release --nologo -p:Platform=AnyCPU
dotnet test tests/L0/Exomia.Framework.Tests --configuration Release --nologo -p:Platform=x86
Expand Down
77 changes: 45 additions & 32 deletions .github/workflows/build_test_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,91 @@ name: build, test & publish
on:
release:
types: [published]
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
build:
name: build release and debug
build-windows:
name: build release and debug for windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.300
- name: build debug
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
run: |
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=AnyCPU
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=x86
dotnet build src/Exomia.Framework --configuration Debug --force --nologo -p:Platform=x64
- name: build release
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
run: |
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=AnyCPU
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=x86
dotnet build src/Exomia.Framework --configuration Release --force --nologo -p:Platform=x64
test:
name: test release and debug
needs: [build]
test-windows:
name: test release and debug for windows
needs: [build-windows]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.300
- name: test debug
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
run: |
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=AnyCPU
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=x86
dotnet test tests/L0/Exomia.Framework.Tests --configuration Debug --nologo -p:Platform=x64
- name: test release
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
run: |
dotnet test tests/L0/Exomia.Framework.Tests --configuration Release --nologo -p:Platform=AnyCPU
dotnet test tests/L0/Exomia.Framework.Tests --configuration Release --nologo -p:Platform=x86
dotnet test tests/L0/Exomia.Framework.Tests --configuration Release --nologo -p:Platform=x64
publish:
name: publish release or debug
needs: [test]
publish-github-windows:
name: publish debug for windows on github
needs: [test-windows]
if: ${{ github.event_name == 'release' }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: extract tag version & release or debug
- name: extract tag version
run: echo ::set-env name=TAG_VERSION::${GITHUB_REF#refs/tags/v*}
shell: bash
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.301
- name: publish ${{ github.repository }} [v${{ env.TAG_VERSION }}]
run: |
echo ::set-env name=TAG_VERSION::${GITHUB_REF#refs/tags/v*}
grep -q '-' <<< ${GITHUB_REF#refs/tags/v*} && echo ::set-env name=TAG_CONFIGURATION::Debug || echo ::set-env name=TAG_CONFIGURATION::Release
dotnet pack --configuration Debug --verbosity m --force --nologo -p:Platform=AnyCPU -p:Version=$TAG_VERSION
dotnet pack --configuration Debug --verbosity m --force --nologo -p:Platform=x86 -p:Version=$TAG_VERSION
dotnet pack --configuration Debug --verbosity m --force --nologo -p:Platform=x64 -p:Version=$TAG_VERSION
for f in ./*.nupkg
do
STATUSCODE=$(curl -sSX PUT --retry 3 -o /dev/null -w "%{http_code}" -u "${{ github.repository_owner }}:${{ github.token }}" -F package=@$f https://nuget.pkg.github.com/${{ github.repository_owner }}/)
echo "[$STATUSCODE:https://nuget.pkg.github.com/${{ github.repository_owner }}/] $f"
if [ "${STATUSCODE}" != 200 ] && [ "${STATUSCODE}" != 409 ]; then exit 1; fi
done
shell: bash
working-directory: src/Exomia.Framework
publish-nuget-windows:
name: publish release for windows on nuget
needs: [test-windows, publish-github-windows]
if: ${{ github.event_name == 'release' }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: extract tag version
run: echo ::set-env name=TAG_VERSION::${GITHUB_REF#refs/tags/v*}
shell: bash
- uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.300
- name: publish ${{ github.repository }} [v${{ env.TAG_VERSION }} | ${{ env.TAG_CONFIGURATION }}]
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
dotnet-version: 3.1.301
- name: publish ${{ github.repository }} [v${{ env.TAG_VERSION }}]
run: |
dotnet pack src/Exomia.Framework --configuration $TAG_CONFIGURATION --verbosity m --force --nologo -p:Platform=AnyCPU -p:Version=$TAG_VERSION
dotnet pack src/Exomia.Framework --configuration $TAG_CONFIGURATION --verbosity m --force --nologo -p:Platform=x86 -p:Version=$TAG_VERSION
dotnet pack src/Exomia.Framework --configuration $TAG_CONFIGURATION --verbosity m --force --nologo -p:Platform=x64 -p:Version=$TAG_VERSION
dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.EXOMIA_NUGET_API_KEY_PUSH }}
dotnet pack src/Exomia.Framework --configuration Release --verbosity m --force --nologo -p:Platform=AnyCPU -p:Version=$TAG_VERSION
dotnet pack src/Exomia.Framework --configuration Release --verbosity m --force --nologo -p:Platform=x86 -p:Version=$TAG_VERSION
dotnet pack src/Exomia.Framework --configuration Release --verbosity m --force --nologo -p:Platform=x64 -p:Version=$TAG_VERSION
dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.EXOMIA_NUGET_API_KEY_PUSH }} --skip-duplicate
shell: bash
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,14 @@ The exomia/framework is used for building 2D and 3D games and more inspired by t
[Package Manager]
PM> Install-Package Exomia.Framework
```

## Templates

You are bored of typing boiler plate code to get things up and running?
Take a look at our [exomia/templates](https://github.com/exomia/templates) repository!

---
## Social

[![Discord](https://img.shields.io/discord/427640639732187136.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.com/invite/ZFJXe6f)
[![Twitch](https://img.shields.io/twitch/status/exomia.svg?label=&logo=twitch&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://www.twitch.tv/exomia/about)
2 changes: 1 addition & 1 deletion framework.wiki
7 changes: 2 additions & 5 deletions src/Exomia.Framework/Collections/Heap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,14 @@ public sealed class Heap<T>
private int _size;

/// <summary>
/// Gets the number of items in the heap.
/// Gets the number of items in the heap.
/// </summary>
/// <value>
/// The count.
/// </value>
public int Count
{
get
{
return _size;
}
get { return _size; }
}

/// <summary>
Expand Down
24 changes: 21 additions & 3 deletions src/Exomia.Framework/Content/ContentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public object Load(Type assetType, string assetName, bool fromEmbeddedResource =
}

AssetKey assetKey = new AssetKey(assetType, assetName);
lock (GetAssetLocker(assetKey, true))
lock (GetAssetLocker(assetKey, true)!)
{
if (_loadedAssets.TryGetValue(assetKey, out object result))
{
Expand All @@ -257,12 +257,24 @@ public object Load(Type assetType, string assetName, bool fromEmbeddedResource =
}
}

/// <inheritdoc />
public object Load(Type assetType, FileInfo assetFileInfo)
{
return Load(assetType, assetFileInfo.FullName);
}

/// <inheritdoc />
public T Load<T>(string assetName, bool fromEmbeddedResource = false)
{
return (T)Load(typeof(T), assetName, fromEmbeddedResource);
}

/// <inheritdoc />
public T Load<T>(FileInfo assetFileInfo)
{
return (T)Load(typeof(T), assetFileInfo.FullName);
}

/// <inheritdoc />
public void Unload()
{
Expand Down Expand Up @@ -299,7 +311,7 @@ public bool Unload(Type assetType, string assetName)

AssetKey assetKey = new AssetKey(assetType, assetName);

object assetLockerRead = GetAssetLocker(assetKey, false);
object? assetLockerRead = GetAssetLocker(assetKey, false);
if (assetLockerRead == null) { return false; }

object asset;
Expand Down Expand Up @@ -332,6 +344,12 @@ public bool Unload<T>(string assetName)
return Unload(typeof(T), assetName);
}

/// <inheritdoc />
public bool Unload<T>(FileInfo assetFileInfo)
{
return Unload(typeof(T), assetFileInfo.FullName);
}

/// <summary>
/// Resolve stream.
/// </summary>
Expand Down Expand Up @@ -427,7 +445,7 @@ private Stream ResolveEmbeddedResourceStream(Type assetType, string assetName)
/// <returns>
/// The asset locker.
/// </returns>
private object GetAssetLocker(AssetKey assetKey, bool create)
private object? GetAssetLocker(AssetKey assetKey, bool create)
{
lock (_assetLockers)
{
Expand Down
51 changes: 45 additions & 6 deletions src/Exomia.Framework/Content/IContentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#endregion

using System;
using System.IO;
using Exomia.Framework.Content.Resolver;
using Exomia.Framework.Content.Resolver.EmbeddedResource;

Expand Down Expand Up @@ -83,18 +84,18 @@ public interface IContentManager : IDisposable
bool Exists(string assetName);

/// <summary>
/// Loads an asset that has been processed by the Content Pipeline.
/// Loads an asset that has been processed by the content pipeline.
/// </summary>
/// <typeparam name="T"> . </typeparam>
/// <param name="assetName"> Full asset name (with its extension) </param>
/// <typeparam name="T"> Generic type parameter. </typeparam>
/// <param name="assetName"> Asset path and name (with its extension) </param>
/// <param name="fromEmbeddedResource">
/// (Optional)
/// <c>true</c> if the asset should be loaded from an
/// embedded resource; <c>false</c>
/// otherwise.
/// </param>
/// <returns>
/// ``0.
/// A asset of type <typeparamref name="T" />.
/// </returns>
/// <exception cref="Exceptions.AssetNotFoundException">
/// If the asset was not found from all
Expand All @@ -106,6 +107,24 @@ public interface IContentManager : IDisposable
/// </exception>
T Load<T>(string assetName, bool fromEmbeddedResource = false);

/// <summary>
/// Loads an asset that has been processed by the content pipeline.
/// </summary>
/// <typeparam name="T"> Generic type parameter. </typeparam>
/// <param name="assetFileInfo"> Information describing the asset file. </param>
/// <returns>
/// A asset of type <typeparamref name="T" />.
/// </returns>
/// <exception cref="Exceptions.AssetNotFoundException">
/// If the asset was not found from all
/// <see cref="IContentResolver" />.
/// </exception>
/// <exception cref="NotSupportedException">
/// If no content reader was suitable to
/// decode the asset.
/// </exception>
T Load<T>(FileInfo assetFileInfo);

/// <summary>
/// Loads an asset that has been processed by the Content Pipeline.
/// </summary>
Expand All @@ -118,7 +137,7 @@ public interface IContentManager : IDisposable
/// otherwise.
/// </param>
/// <returns>
/// Asset.
/// An asset of type <paramref name="assetType" />.
/// </returns>
/// <exception cref="Exceptions.AssetNotFoundException">
/// If the asset was not found from all
Expand All @@ -130,11 +149,21 @@ public interface IContentManager : IDisposable
/// </exception>
object Load(Type assetType, string assetName, bool fromEmbeddedResource = false);

/// <summary>
/// Loads an asset that has been processed by the Content Pipeline.
/// </summary>
/// <param name="assetType"> Asset Type. </param>
/// <param name="assetFileInfo"> Information describing the asset file. </param>
/// <returns>
/// An asset of type <paramref name="assetType" />.
/// </returns>
object Load(Type assetType, FileInfo assetFileInfo);

/// <summary>
/// Unloads all data that was loaded by this ContentManager. All data will be disposed.
/// </summary>
/// <remarks>
/// Unlike <see cref="ContentManager.Load{T}" /> method, this method is not thread safe and
/// Unlike <see cref="IContentManager.Load(Type, string, bool)" /> method, this method is not thread safe and
/// must be called by a single caller at a single time.
/// </remarks>
void Unload();
Expand All @@ -149,6 +178,16 @@ public interface IContentManager : IDisposable
/// </returns>
bool Unload<T>(string assetName);

/// <summary>
/// Unloads and disposes an asset.
/// </summary>
/// <typeparam name="T"> Generic type parameter. </typeparam>
/// <param name="assetFileInfo"> Information describing the asset file. </param>
/// <returns>
/// <c>true</c> if the asset exists and was unloaded, <c>false</c> otherwise.
/// </returns>
bool Unload<T>(FileInfo assetFileInfo);

/// <summary>
/// Unloads and disposes an asset.
/// </summary>
Expand Down
Loading

0 comments on commit 9a480db

Please sign in to comment.