Skip to content

Commit

Permalink
Merge pull request #23 from ashakoor/main
Browse files Browse the repository at this point in the history
v0.7.0-beta
  • Loading branch information
Cytraen authored Feb 12, 2021
2 parents acbcc69 + 07614fb commit e7f0e49
Show file tree
Hide file tree
Showing 315 changed files with 12,950 additions and 9,094 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest

env:
dotnet_sdk_version: '5.0.102'
dotnet_sdk_version: '5.0.103'
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
TEST_BUNGIE_API_KEY: ${{ secrets.TEST_BUNGIE_API_KEY }}
Expand All @@ -35,17 +35,17 @@ jobs:
- name: Build client
run: dotnet build ./BungieSharper -c Release

- name: Pack schema NuGet package
run: dotnet pack ./BungieSharper.Schema -c Release --no-build --output SchemaPackage --version-suffix "ci.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}" -p:ContinuousIntegrationBuild=true
- name: Pack entities NuGet package
run: dotnet pack ./BungieSharper.Entities -c Release --no-build --output EntitiesPackage --version-suffix "ci.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}" -p:ContinuousIntegrationBuild=true

- name: Pack client NuGet package
run: dotnet pack ./BungieSharper -c Release --no-build --output ClientPackage --version-suffix "ci.$(date -u +%Y%m%dT%H%M%S)+sha.${GITHUB_SHA:0:9}" -p:ContinuousIntegrationBuild=true

- name: Upload schema artifact (nupkg/snupkg)
- name: Upload entities artifact (nupkg/snupkg)
uses: actions/upload-artifact@v1
with:
name: BungieSharper.Schema - ${{ env.SHA }}
path: SchemaPackage
name: BungieSharper.Entities - ${{ env.SHA }}
path: EntitiesPackage

- name: Upload client artifact (nupkg/snupkg)
uses: actions/upload-artifact@v1
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
runs-on: ubuntu-latest
env:
dotnet_sdk_version: '5.0.102'
dotnet_sdk_version: '5.0.103'
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
TEST_BUNGIE_API_KEY: ${{ secrets.TEST_BUNGIE_API_KEY }}
Expand All @@ -30,8 +30,8 @@ jobs:
- name: Build client
run: dotnet build ./BungieSharper -c Release -p:Version=${{ steps.get_version.outputs.VERSION }}

- name: Pack schema NuGet package
run: dotnet pack ./BungieSharper.Schema -c Release --no-build --output Packages -p:ContinuousIntegrationBuild=true -p:Version=${{ steps.get_version.outputs.VERSION }}
- name: Pack entities NuGet package
run: dotnet pack ./BungieSharper.Entities -c Release --no-build --output Packages -p:ContinuousIntegrationBuild=true -p:Version=${{ steps.get_version.outputs.VERSION }}

- name: Pack client NuGet package
run: dotnet pack ./BungieSharper -c Release --no-build --output Packages -p:ContinuousIntegrationBuild=true -p:Version=${{ steps.get_version.outputs.VERSION }}
Expand All @@ -47,26 +47,26 @@ jobs:
draft: true
prerelease: false

- name: Upload schema .nupkg release binary
id: upload-schema-nupkg-release-asset
- name: Upload entities .nupkg release binary
id: upload-entities-nupkg-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Packages/BungieSharper.Schema.${{ steps.get_version.outputs.VERSION }}.nupkg
asset_name: BungieSharper.Schema.${{ steps.get_version.outputs.VERSION }}.nupkg
asset_path: ./Packages/BungieSharper.Entities.${{ steps.get_version.outputs.VERSION }}.nupkg
asset_name: BungieSharper.Entities.${{ steps.get_version.outputs.VERSION }}.nupkg
asset_content_type: application/zip

- name: Upload schema .snupkg release binary
id: upload-schema-snupkg-release-asset
- name: Upload entities .snupkg release binary
id: upload-entities-snupkg-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Packages/BungieSharper.Schema.${{ steps.get_version.outputs.VERSION }}.snupkg
asset_name: BungieSharper.Schema.${{ steps.get_version.outputs.VERSION }}.snupkg
asset_path: ./Packages/BungieSharper.Entities.${{ steps.get_version.outputs.VERSION }}.snupkg
asset_name: BungieSharper.Entities.${{ steps.get_version.outputs.VERSION }}.snupkg
asset_content_type: application/zip

- name: Upload client .nupkg release binary
Expand All @@ -91,17 +91,17 @@ jobs:
asset_name: BungieSharper.${{ steps.get_version.outputs.VERSION }}.snupkg
asset_content_type: application/zip

- name: Upload schema to NuGet
- name: Upload entities to NuGet
run: |
dotnet nuget push ./Packages/BungieSharper.Schema.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push ./Packages/BungieSharper.Entities.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Upload client to NuGet
run: |
dotnet nuget push ./Packages/BungieSharper.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Upload schema to GitHub Packages
- name: Upload entities to GitHub Packages
run: |
dotnet nuget push ./Packages/BungieSharper.Schema.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/ashakoor/index.json --skip-duplicate
dotnet nuget push ./Packages/BungieSharper.Entities.${{ steps.get_version.outputs.VERSION }}.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/ashakoor/index.json --skip-duplicate
- name: Upload client to GitHub Packages
run: |
Expand Down
159 changes: 154 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Created by https://www.toptal.com/developers/gitignore/api/git,csharp,dotnetcore,jetbrains+all,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=git,csharp,dotnetcore,jetbrains+all,visualstudiocode
# Created by https://www.toptal.com/developers/gitignore/api/git,venv,csharp,python,dotnetcore,jetbrains+all,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=git,venv,csharp,python,dotnetcore,jetbrains+all,visualstudiocode

### Csharp ###
## Ignore Visual Studio temporary files, build results, and
Expand Down Expand Up @@ -470,16 +470,165 @@ modules.xml
# Sonarlint plugin
.idea/sonarlint

### Python ###
# Byte-compiled / optimized / DLL files
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
pytestdebug.log

# Translations
*.mo
*.pot

# Django stuff:
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
doc/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
pythonenv*

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# profiling data
.prof

### venv ###
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
pip-selfcheck.json

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/git,csharp,dotnetcore,jetbrains+all,visualstudiocode
# End of https://www.toptal.com/developers/gitignore/api/git,venv,csharp,python,dotnetcore,jetbrains+all,visualstudiocode
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Authors>ashakoor</Authors>
<Copyright>Copyright © 2020-2021 ashakoor</Copyright>
<PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>
<RepositoryUrl>https://github.com/ashakoor/BungieSharper</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>

<TargetFramework>net5.0</TargetFramework>
<Version>0.7.0-beta</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<ProjectReference Include="..\BungieSharper.CodeGen.Entities\BungieSharper.CodeGen.Entities.csproj" />
</ItemGroup>

</Project>
43 changes: 43 additions & 0 deletions BungieSharper.CodeGen.Entities.Tests/EntityTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System.IO;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Xunit;

namespace BungieSharper.CodeGen.Entities.Tests
{
public class EntityTest : IClassFixture<SpecFixture>
{
private readonly string SpecStringContent;

public EntityTest(SpecFixture specStringFixture)
{
SpecStringContent = specStringFixture.SpecFileContent;
}

[Fact]
public async Task DeserializeAndSerializeTest()
{
var _serializerOptions = new JsonSerializerOptions
{
WriteIndented = true
};

_serializerOptions.Converters.Add(new JsonLongConverter());
_serializerOptions.Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping;

var openApiObj = JsonSerializer.Deserialize<OpenApiObject>(SpecStringContent, _serializerOptions);

var serialized = JsonSerializer.Serialize(openApiObj, _serializerOptions);

var removeWhitespace = new Regex(@"\s+");

await File.WriteAllTextAsync("testOutput.json", serialized);

var noWhitespaceInput = removeWhitespace.Replace(SpecStringContent, "").ToLowerInvariant();
var noWhitespaceSerialized = removeWhitespace.Replace(serialized, "").ToLowerInvariant();

Assert.Equal(noWhitespaceInput.Length, noWhitespaceSerialized.Length);
}
}
}
Loading

0 comments on commit e7f0e49

Please sign in to comment.