Skip to content

Commit

Permalink
Merge pull request #273 from Somfic/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Somfic authored Sep 1, 2023
2 parents 2c0231e + 60e012c commit 70e8121
Show file tree
Hide file tree
Showing 12 changed files with 757 additions and 89 deletions.
104 changes: 32 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,22 @@ jobs:
path: reports/*.trx
reporter: dotnet-trx

semver:
name: semver
release:
name: release
needs: test
runs-on: ubuntu-latest
outputs:
label: ${{steps.VERSION.outputs.label}}
semver: ${{steps.VERSION.outputs.semver}}
nuget: ${{steps.VERSION.outputs.nuget}}
prerelease: ${{steps.VERSION.outputs.prerelease}}
applicable: ${{steps.VERSION.outputs.applicable}}
previous: ${{steps.LAST.outputs.tag}}
if: github.event_name == 'push'
env:
nuget_key: ${{ secrets.NUGET_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v3


- name: Setup .NET 7
uses: actions/setup-dotnet@v3
with:
dotnet-version: "7.0.x"

- name: Setup GitVersion
run: dotnet tool install --global GitVersion.Tool

Expand All @@ -65,23 +66,34 @@ jobs:

- name: Update version
run: dotnet-gitversion /updateprojectfiles /updateassemblyinfo /output buildserver

- name: Build
run: dotnet build --configuration Release

- name: Set job output
id: VERSION
run: |
echo '::set-output name=label::${{env.GitVersion_PreReleaseLabel}}'
echo '::set-output name=semver::${{env.GitVersion_LegacySemVer}}'
echo '::set-output name=nuget::${{env.GitVersion_NuGetPreReleaseTagV2}}'
echo '::set-output name=prerelease::${{env.GitVersion_PreReleaseLabel == 'alpha' || env.GitVersion_PreReleaseLabel == 'beta' }}'
echo '::set-output name=applicable::${{github.ref == 'refs/heads/main' || env.GitVersion_PreReleaseLabel == 'alpha' || env.GitVersion_PreReleaseLabel == 'beta'}}'
- name: Pack
if: ${{env.nuget_key != ''}}
run: dotnet pack --configuration Release --output nupkgs --include-symbols --include-source

- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{ env.GitVersion_LegacySemVer }}
name: v${{ env.GitVersion_LegacySemVer }}
prerelease: ${{ env.GitVersion_PreReleaseLabel == 'alpha' || env.GitVersion_PreReleaseLabel == 'beta' }}

- name: Publish project to NuGet
if: ${{env.nuget_key != ''}}
run: dotnet nuget push '**/*.nupkg' -k ${{ env.nuget_key }} -s https://api.nuget.org/v3/index.json --skip-duplicate

- name: Push version bump
if: ${{env.GitVersion_PreReleaseLabel == '' || env.GitVersion_PreReleaseLabel == 'alpha' || env.GitVersion_PreReleaseLabel == 'beta'}}
uses: EndBug/add-and-commit@v9
with:
author_name: github-actions[bot]
author_email: github-actions[bot]@users.noreply.github.com
message: "Bumped version to ${{env.GitVersion_LegacySemVer}}"
message: "Bumped version to ${{ env.GitVersion_LegacySemVer }}"

approve:
name: approve
Expand All @@ -93,56 +105,4 @@ jobs:
uses: juliangruber/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.number }}

release:
name: release
needs: semver
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
nuget_key: ${{ secrets.NUGET_KEY }}
steps:
- name: Setup Ruby v3
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"

- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{needs.semver.outputs.semver}}
name: v${{needs.semver.outputs.semver}}
prerelease: ${{needs.semver.outputs.prerelease}}

publish:
name: publish
needs: semver
runs-on: ubuntu-latest
if: github.event_name == 'push' && needs.semver.outputs.applicable == 'true'
env:
nuget_key: ${{ secrets.NUGET_KEY }}
steps:
- name: Checkout code
if: ${{env.nuget_key != ''}}
uses: actions/checkout@v3

- name: Setup .NET 7
if: ${{env.nuget_key != ''}}
uses: actions/setup-dotnet@v3
with:
dotnet-version: "7.0.x"

- name: Restore dependencies
if: ${{env.nuget_key != ''}}
run: dotnet restore

- name: Pack
if: ${{env.nuget_key != ''}}
run: dotnet pack --configuration Release --output nupkgs --include-symbols --include-source

- name: Publish project to NuGet
if: ${{env.nuget_key != ''}}
run: dotnet nuget push '**/*.nupkg' -k ${{env.nuget_key}} -s https://api.nuget.org/v3/index.json --skip-duplicate
number: ${{ github.event.number }}
3 changes: 3 additions & 0 deletions EliteAPI.Web.Spansh/EliteAPI.Web.Spansh.csproj.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=search_005Crequests_005Cbodies/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=search_005Crequests_005Cbodies_005Cfilters/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
42 changes: 42 additions & 0 deletions EliteAPI.Web.Spansh/Search/Requests/Bodies/BodiesRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System.Runtime.Serialization;

Check warning on line 1 in EliteAPI.Web.Spansh/Search/Requests/Bodies/BodiesRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Redundant using directive

Using directive is not required by the code and can be safely removed
using EliteAPI.Web.Models;
using EliteAPI.Web.Spansh.Search.Requests.Sort;
using Newtonsoft.Json;

namespace EliteAPI.Web.Spansh.Search.Requests;

public class BodiesRequest : IWebApiRequest
{
[JsonProperty("filters")]
public FilterOptions Filters { get; init; } = new();

[JsonProperty("sort")]
public ICollection<SortOption> Sorting { get; init; } = new List<SortOption> { new() }.ToArray();

[JsonProperty("reference_system")]
public string ReferenceSystem { get; init; } = "Sol";

[JsonProperty("size")]
public long Size { get; init; } = 50;

[JsonProperty("page")]
public long Page { get; init; } = 0;

Check warning on line 23 in EliteAPI.Web.Spansh/Search/Requests/Bodies/BodiesRequest.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Redundant member initializer

Initializing property by default value is redundant

public class FilterOptions
{
[JsonProperty("atmosphere", NullValueHandling = NullValueHandling.Ignore)]
public AtmosphereFilter? Atmosphere { get; init; }

[JsonProperty("distance", NullValueHandling = NullValueHandling.Ignore)]
public MinMaxFilter? Distance { get; init; }
}

public class SortOption
{
[JsonProperty("distance")]
public DistanceSort Distance { get; init; } = new() { Direction = "asc" };
}

public string Endpoint => "bodies/search";
public HttpMethod Method => HttpMethod.Post;
}
Loading

0 comments on commit 70e8121

Please sign in to comment.