Skip to content

Support/1.x from master #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 90

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 30

# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- bug

# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: true

# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: true

# Label to use when marking an issue as stale
staleLabel: stale

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. After 30 days from now, it will be closed if no further
activity occurs. Thank you for your contributions.

# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
21 changes: 21 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: docker

on:
push:
branches: [master]
tags: ["*"]
pull_request:
branches: [master]

jobs:
docker:
name: build & run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: docker build
run: docker build -t json-ld.net .
- name: docker test
run: docker run --rm json-ld.net dotnet test
133 changes: 116 additions & 17 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,131 @@ name: dotnet

on:
push:
branches: [ master ]
branches: [master]
tags: ["*"]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:
runs-on: ubuntu-latest

outputs:
fullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: "5.x"

- id: gitversion
uses: gittools/actions/gitversion/[email protected]

- uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.401

- uses: actions/cache@v2
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-

- run: dotnet restore

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.401
- run: dotnet build --configuration Release --no-restore

- name: Install dependencies
run: dotnet restore
- run: |
dotnet test \
--configuration Release \
--no-build \
--no-restore \
-p:CollectCoverage=true \
-p:CoverletOutputFormat=opencover \
-p:Exclude="[JsonLD.Test*]*"

- name: Build
run: dotnet build --configuration Release --no-restore
- name: Codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)

- run: |
dotnet pack \
--include-source \
--configuration Release \
--no-build \
--no-restore \
-p:PackageVersion="${{ steps.gitversion.outputs.fullSemVer }}" \
src/json-ld.net/json-ld.net.csproj \
--output ${{ github.workspace }}/nugets/

- uses: actions/upload-artifact@v2
with:
name: nugets
path: nugets

nuget-push-dev:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: build

steps:
- name: download artifact
uses: actions/download-artifact@v2
with:
name: nugets

- name: Test
run: dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[JsonLD.Test*]*"
- name: setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1
source-url: https://nuget.pkg.github.com/linked-data-dotnet/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: nuget push
run: dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }}

nuget-push-prod:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: build

steps:
- uses: actions/download-artifact@v2
with:
name: nugets

- uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.401
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}

- run: dotnet nuget push nugets/*.nupkg --skip-duplicate

release-artifacts:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')

steps:
- uses: actions/download-artifact@v1
with:
name: nugets

- name: Codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)
- name: Upload to stable release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: nugets
asset_name: json-ld.net
tag: ${{ github.ref }}
overwrite: true
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# If you want to build and test under Linux using a docker container, here's how:
#
#> docker build -t json-ld.net .
#> docker run --rm json-ld.net dotnet test -v normal

# .NET Core 2.1 on Ubuntu 18.04 LTS
FROM mcr.microsoft.com/dotnet/core/sdk:2.1-bionic

WORKDIR /App

# First we ONLY copy sln and csproj files so that we don't have to re-cache
# dotnet restore every time a .cs file changes
COPY src/json-ld.net/json-ld.net.csproj src/json-ld.net/json-ld.net.csproj
COPY test/json-ld.net.tests/json-ld.net.tests.csproj test/json-ld.net.tests/json-ld.net.tests.csproj
COPY JsonLD.sln JsonLD.sln
RUN dotnet restore

# Then we copy everything and run dotnet build
COPY . .
RUN dotnet build
3 changes: 0 additions & 3 deletions src/json-ld.net/Core/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ namespace JsonLD.Core
/// <author>tristan</author>
//[System.Serializable]
public class Context : JObject
#if !PORTABLE && !IS_CORECLR
, ICloneable
#endif
{
private JsonLdOptions options;

Expand Down
4 changes: 0 additions & 4 deletions src/json-ld.net/Core/JsonLdApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2196,7 +2196,6 @@ public virtual RDFDataset ToRDF()
/// <exception cref="JsonLD.Core.JsonLdError"></exception>
public virtual object Normalize(RDFDataset dataset)
{
#if !PORTABLE
// create quads and map bnodes to their associated quads
IList<RDFDataset.Quad> quads = new List<RDFDataset.Quad>();
IDictionary<string,IDictionary<string,object>> bnodes = new Dictionary<string,IDictionary<string,object>>();
Expand Down Expand Up @@ -2247,9 +2246,6 @@ public virtual object Normalize(RDFDataset dataset)
NormalizeUtils normalizeUtils = new NormalizeUtils(quads, bnodes, new UniqueNamer
("_:c14n"), opts);
return normalizeUtils.HashBlankNodes(bnodes.Keys);
#else
throw new PlatformNotSupportedException();
#endif
}
}
}
8 changes: 0 additions & 8 deletions src/json-ld.net/Core/JsonLdProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -487,24 +487,16 @@ public static object ToRDF(JToken input)
/// <exception cref="JsonLDNet.Core.JsonLdError"></exception>
public static object Normalize(JToken input, JsonLdOptions options)
{
#if !PORTABLE
JsonLdOptions opts = options.Clone();
opts.format = null;
RDFDataset dataset = (RDFDataset)ToRDF(input, opts);
return new JsonLdApi(options).Normalize(dataset);
#else
throw new PlatformNotSupportedException();
#endif
}

/// <exception cref="JsonLD.Core.JsonLdError"></exception>
public static object Normalize(JToken input)
{
#if !PORTABLE
return Normalize(input, new JsonLdOptions(string.Empty));
#else
throw new PlatformNotSupportedException();
#endif
}
}
}
12 changes: 0 additions & 12 deletions src/json-ld.net/Core/NormalizeUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public NormalizeUtils(IList<RDFDataset.Quad> quads, IDictionary<string, IDiction
/// <exception cref="JsonLD.Core.JsonLdError"></exception>
public virtual object HashBlankNodes(IEnumerable<string> unnamed_)
{
#if !PORTABLE
IList<string> unnamed = new List<string>(unnamed_);
IList<string> nextUnnamed = new List<string>();
IDictionary<string, IList<string>> duplicates = new Dictionary<string, IList<string
Expand Down Expand Up @@ -203,9 +202,6 @@ public virtual object HashBlankNodes(IEnumerable<string> unnamed_)
}
}
}
#else
throw new PlatformNotSupportedException();
#endif
}

private sealed class _IComparer_145 : IComparer<NormalizeUtils.HashResult>
Expand Down Expand Up @@ -245,7 +241,6 @@ private class HashResult
/// <param name="callback">(err, result) called once the operation completes.</param>
private static NormalizeUtils.HashResult HashPaths(string id, IDictionary<string, IDictionary<string, object>> bnodes, UniqueNamer namer, UniqueNamer pathNamer)
{
#if !PORTABLE
MessageDigest md = null;

try
Expand Down Expand Up @@ -460,9 +455,6 @@ private static NormalizeUtils.HashResult HashPaths(string id, IDictionary<string
{
md?.Dispose();
}
#else
throw new PlatformNotSupportedException();
#endif
}

/// <summary>Hashes all of the quads about a blank node.</summary>
Expand Down Expand Up @@ -500,7 +492,6 @@ private static string HashQuads(string id, IDictionary<string, IDictionary<strin
/// <returns></returns>
private static string Sha1hash(ICollection<string> nquads)
{
#if !PORTABLE
try
{
// create SHA-1 digest
Expand All @@ -515,9 +506,6 @@ private static string Sha1hash(ICollection<string> nquads)
{
throw;
}
#else
throw new PlatformNotSupportedException();
#endif
}

// TODO: this is something to optimize
Expand Down
11 changes: 0 additions & 11 deletions src/json-ld.net/Util/JavaCompat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

#if !PORTABLE
using System.Security.Cryptography;
#endif

namespace JsonLD
{
Expand Down Expand Up @@ -281,13 +278,7 @@ public Matcher Matcher(string str)

public string GetPattern()
{
#if !PORTABLE && !IS_CORECLR
return this.pattern;
#elif !PORTABLE
return _rx;
#else
throw new PlatformNotSupportedException();
#endif
}

new public static bool Matches(string val, string rx)
Expand Down Expand Up @@ -357,7 +348,6 @@ public bool Find()
}


#if !PORTABLE
internal class MessageDigest : IDisposable
{
SHA1 md;
Expand Down Expand Up @@ -392,5 +382,4 @@ public void Dispose()
md.Dispose();
}
}
#endif
}
Loading