Skip to content

Commit

Permalink
Add github actions for doing build (#146)
Browse files Browse the repository at this point in the history
* Add github actions for doing build

* Fixed typo

* Add sourcelink

---------

Co-authored-by: Alex Davies <[email protected]>
  • Loading branch information
alex-davies and Alex Davies authored Apr 20, 2024
1 parent 48cdec1 commit dbc408f
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 44 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: release
on:
push:
tags:
- 'v*'
jobs:
release:

runs-on: ubuntu-latest

steps:
- name: Set RELEASE_VERSION
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV #GITHUB_REF:11 skips first 11 characters of GITHUB_REF (GITHUB_REF will look like 'refs/tags/v*.*.*')
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.*
- name: Pack
run: dotnet pack --output ./artifacts --configuration Release -p:GeneratePackageOnBuild=false -p:Version=$RELEASE_VERSION
- name: Publish packages
run: dotnet nuget push ./artifacts/**.nupkg --source nuget.org --api-key ${{secrets.NUGET_TOKEN}}
30 changes: 30 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: test

on:
pull_request:
branches: [master]
types: [synchronize, opened, reopened, ready_for_review, unlabeled]
paths-ignore:
- 'README.md'
push:
branches: [master]
paths-ignore:
- 'README.md'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.*
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
14 changes: 11 additions & 3 deletions JsonApiSerializer.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
# Visual Studio Version 17
VisualStudioVersion = 17.9.34607.119
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiSerializer", "src\JsonApiSerializer\JsonApiSerializer.csproj", "{3CFAD26B-A705-4180-A210-E0B7BBDF6404}"
EndProject
Expand All @@ -13,10 +13,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{32D2F3FF
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution", "solution", "{52EDA15C-678C-4F6B-A58B-2FF9F26B5B84}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "..github", "..github", "{9E69D917-8AB1-422F-B77B-E682948AC69D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{E399B66E-1B80-43A9-8322-320D7421E9D6}"
ProjectSection(SolutionItems) = preProject
.github\workflows\release.yaml = .github\workflows\release.yaml
.github\workflows\test.yaml = .github\workflows\test.yaml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -38,6 +45,7 @@ Global
GlobalSection(NestedProjects) = preSolution
{3CFAD26B-A705-4180-A210-E0B7BBDF6404} = {2CC10E19-7EEE-4E16-8473-89BB78642787}
{ACED8723-0D2D-40E1-9E92-C0E755A60F3A} = {32D2F3FF-275C-4CD1-ABBE-9D3865DFC297}
{E399B66E-1B80-43A9-8322-320D7421E9D6} = {9E69D917-8AB1-422F-B77B-E682948AC69D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {74E57F44-FD27-494F-ADFF-973B551D31B0}
Expand Down
34 changes: 0 additions & 34 deletions appveyor.yml

This file was deleted.

11 changes: 8 additions & 3 deletions src/JsonApiSerializer/JsonApiSerializer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>7.3</LangVersion>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>2.0.0</Version>
<Authors>Alex Davies</Authors>
<Company>Codecutout</Company>
<Description>JsonApiSerializer supports configurationless serializing and deserializing objects into the json:api format (http://jsonapi.org).</Description>
<PackageLicense>MIT</PackageLicense>
<PackageProjectUrl>https://github.com/codecutout/JsonApiSerializer</PackageProjectUrl>
<PackageTags>jsonapiserializer jsonapi json:api json.net serialization deserialization jsonapi.net</PackageTags>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="DotNet.ReproducibleBuilds" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ResourceObjectConverter : JsonConverter

public override bool CanConvert(Type objectType)
{
return TypeInfoShim.GetPropertyFromInhertianceChain(objectType.GetTypeInfo(), "Id") != null;
return TypeInfoShim.GetPropertyFromInheritanceChain(objectType.GetTypeInfo(), "Id") != null;
}

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public override bool CanConvert(Type objectType)
internal bool IsExplicitRelationship(Type objectType)
{
var typeInfo = objectType.GetTypeInfo();
return TypeInfoShim.GetPropertyFromInhertianceChain(typeInfo, PropertyNames.Data) != null
|| TypeInfoShim.GetPropertyFromInhertianceChain(typeInfo, PropertyNames.Links) != null;
return TypeInfoShim.GetPropertyFromInheritanceChain(typeInfo, PropertyNames.Data) != null
|| TypeInfoShim.GetPropertyFromInheritanceChain(typeInfo, PropertyNames.Links) != null;
}

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
Expand Down
2 changes: 1 addition & 1 deletion src/JsonApiSerializer/Util/TypeInfoShim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static PropertyInfo GetProperty(TypeInfo info, string property)
#endif
}

public static PropertyInfo GetPropertyFromInhertianceChain(TypeInfo info, string property)
public static PropertyInfo GetPropertyFromInheritanceChain(TypeInfo info, string property)
{
var propInfo = GetProperty(info, property);
if (propInfo == null && info.IsInterface)
Expand Down

0 comments on commit dbc408f

Please sign in to comment.