diff --git a/.github/stale.yml b/.github/stale.yml index cff40f55..09785f4e 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -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 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..e39e5d1e --- /dev/null +++ b/.github/workflows/docker.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 1ca89c87..18697529 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -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/setup@v0.9.4 + with: + versionSpec: "5.x" + + - id: gitversion + uses: gittools/actions/gitversion/execute@v0.9.4 + + - 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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..1680d804 --- /dev/null +++ b/Dockerfile @@ -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 diff --git a/src/json-ld.net/Core/Context.cs b/src/json-ld.net/Core/Context.cs index ee3fb67d..5c096c30 100644 --- a/src/json-ld.net/Core/Context.cs +++ b/src/json-ld.net/Core/Context.cs @@ -14,9 +14,6 @@ namespace JsonLD.Core /// tristan //[System.Serializable] public class Context : JObject -#if !PORTABLE && !IS_CORECLR - , ICloneable -#endif { private JsonLdOptions options; diff --git a/src/json-ld.net/Core/JsonLdApi.cs b/src/json-ld.net/Core/JsonLdApi.cs index 6672070a..6c595f69 100644 --- a/src/json-ld.net/Core/JsonLdApi.cs +++ b/src/json-ld.net/Core/JsonLdApi.cs @@ -2196,7 +2196,6 @@ public virtual RDFDataset ToRDF() /// public virtual object Normalize(RDFDataset dataset) { -#if !PORTABLE // create quads and map bnodes to their associated quads IList quads = new List(); IDictionary> bnodes = new Dictionary>(); @@ -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 } } } diff --git a/src/json-ld.net/Core/JsonLdProcessor.cs b/src/json-ld.net/Core/JsonLdProcessor.cs index b77acbb1..5ba2e7b0 100644 --- a/src/json-ld.net/Core/JsonLdProcessor.cs +++ b/src/json-ld.net/Core/JsonLdProcessor.cs @@ -487,24 +487,16 @@ public static object ToRDF(JToken input) /// 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 } /// public static object Normalize(JToken input) { -#if !PORTABLE return Normalize(input, new JsonLdOptions(string.Empty)); -#else - throw new PlatformNotSupportedException(); -#endif } } } diff --git a/src/json-ld.net/Core/NormalizeUtils.cs b/src/json-ld.net/Core/NormalizeUtils.cs index bf746edc..6d6adce1 100644 --- a/src/json-ld.net/Core/NormalizeUtils.cs +++ b/src/json-ld.net/Core/NormalizeUtils.cs @@ -29,7 +29,6 @@ public NormalizeUtils(IList quads, IDictionary public virtual object HashBlankNodes(IEnumerable unnamed_) { -#if !PORTABLE IList unnamed = new List(unnamed_); IList nextUnnamed = new List(); IDictionary> duplicates = new Dictionary unnamed_) } } } -#else - throw new PlatformNotSupportedException(); -#endif } private sealed class _IComparer_145 : IComparer @@ -245,7 +241,6 @@ private class HashResult /// (err, result) called once the operation completes. private static NormalizeUtils.HashResult HashPaths(string id, IDictionary> bnodes, UniqueNamer namer, UniqueNamer pathNamer) { -#if !PORTABLE MessageDigest md = null; try @@ -460,9 +455,6 @@ private static NormalizeUtils.HashResult HashPaths(string id, IDictionaryHashes all of the quads about a blank node. @@ -500,7 +492,6 @@ private static string HashQuads(string id, IDictionary private static string Sha1hash(ICollection nquads) { -#if !PORTABLE try { // create SHA-1 digest @@ -515,9 +506,6 @@ private static string Sha1hash(ICollection nquads) { throw; } -#else - throw new PlatformNotSupportedException(); -#endif } // TODO: this is something to optimize diff --git a/src/json-ld.net/Util/JavaCompat.cs b/src/json-ld.net/Util/JavaCompat.cs index 90e4c48f..3c6e0102 100644 --- a/src/json-ld.net/Util/JavaCompat.cs +++ b/src/json-ld.net/Util/JavaCompat.cs @@ -6,10 +6,7 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; - -#if !PORTABLE using System.Security.Cryptography; -#endif namespace JsonLD { @@ -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) @@ -357,7 +348,6 @@ public bool Find() } -#if !PORTABLE internal class MessageDigest : IDisposable { SHA1 md; @@ -392,5 +382,4 @@ public void Dispose() md.Dispose(); } } -#endif } diff --git a/src/json-ld.net/json-ld.net.csproj b/src/json-ld.net/json-ld.net.csproj index 3bd4f7cf..3fc28a80 100644 --- a/src/json-ld.net/json-ld.net.csproj +++ b/src/json-ld.net/json-ld.net.csproj @@ -5,35 +5,28 @@ Implements the W3C JSON-LD 1.0 standard. 1.0.7 NuGet;linked-data-dotnet - netstandard1.3;netstandard2.0;netcoreapp2.1 + netstandard1.1;netstandard2.0;net40 json-ld.net json-ld.net json-ld;jsonld;json;linked-data;rdf;semantic;web http://json-ld.org/images/json-ld-logo-64.png https://github.com/linked-data-dotnet/json-ld.net/ https://raw.githubusercontent.com/linked-data-dotnet/json-ld.net/master/LICENSE - $(PackageTargetFallback);dnxcore50;portable-net45+win8 - 1.6.0 + $(PackageTargetFallback);dnxcore50;portable-net45+win8 false false false + https://github.com/linked-data-dotnet/json-ld.net - - - - - - $(DefineConstants);PORTABLE - - - $(DefineConstants);IS_CORECLR - - - + - - \ No newline at end of file + + + + + + diff --git a/test/json-ld.net.tests/json-ld.net.tests.csproj b/test/json-ld.net.tests/json-ld.net.tests.csproj index 2195496c..6e77e310 100644 --- a/test/json-ld.net.tests/json-ld.net.tests.csproj +++ b/test/json-ld.net.tests/json-ld.net.tests.csproj @@ -7,6 +7,7 @@ false false true + JsonLD.Test