From 9dcfa0c28e51e7826f1a93a45151e6a52f9f2322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Thu, 25 Jun 2020 14:27:06 +0200 Subject: [PATCH 01/12] Adjust formatting --- .github/workflows/dotnet.yml | 50 ++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 1ca89c8..e5adca4 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -2,32 +2,38 @@ name: dotnet on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 2.1.401 - - - name: Install dependencies - run: dotnet restore - - - name: Build - run: dotnet build --configuration Release --no-restore - - - name: Test - run: dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[JsonLD.Test*]*" - - - name: Codecov - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: bash <(curl -s https://codecov.io/bash) + - uses: actions/checkout@v2 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 2.1.401 + + - name: Install dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Test + run: | + dotnet test \ + . \ + --configuration Release \ + -p:CollectCoverage=true \ + -p:CoverletOutputFormat=opencover \ + -p:Exclude="[JsonLD.Test*]*" + + - name: Codecov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: bash <(curl -s https://codecov.io/bash) From 07789a218f8b29507d6485a5c73a435bf67cde60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Thu, 25 Jun 2020 14:28:52 +0200 Subject: [PATCH 02/12] Cache NuGet packages --- .github/workflows/dotnet.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index e5adca4..505cb0a 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -18,6 +18,12 @@ jobs: with: dotnet-version: 2.1.401 + - uses: actions/cache@v2 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + restore-keys: ${{ runner.os }}-nuget- + - name: Install dependencies run: dotnet restore From 4751656017732b62d2e4373c247cb0b95537a2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Thu, 25 Jun 2020 14:30:07 +0200 Subject: [PATCH 03/12] Break out tests to a separate build --- .github/workflows/dotnet.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 505cb0a..5c50add 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -30,11 +30,27 @@ jobs: - name: Build run: dotnet build --configuration Release --no-restore + - uses: actions/upload-artifact@v2 + with: + name: build + path: . + + test: + runs-on: ubuntu-latest + needs: build + + steps: + - uses: actions/download-artifact@v1 + with: + name: build + - name: Test run: | dotnet test \ . \ --configuration Release \ + --no-build \ + --no-restore \ -p:CollectCoverage=true \ -p:CoverletOutputFormat=opencover \ -p:Exclude="[JsonLD.Test*]*" From d01a5061fba7e473022f58229bc213a4e6c079fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Thu, 25 Jun 2020 14:45:22 +0200 Subject: [PATCH 04/12] Extract to the current directory and do ls -la after for debugging --- .github/workflows/dotnet.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 5c50add..1d06b22 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -40,9 +40,12 @@ jobs: needs: build steps: - - uses: actions/download-artifact@v1 + - uses: actions/download-artifact@v2 with: name: build + path: . + + - run: ls -la - name: Test run: | From 2629b892b8327ccef7a7d09a4fcdb678f3ee191d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Thu, 25 Jun 2020 16:04:54 +0200 Subject: [PATCH 05/12] Add GitVersion and NuGet Pack jobs --- .github/workflows/dotnet.yml | 50 ++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 1d06b22..f852aef 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -7,6 +7,24 @@ on: branches: [master] jobs: + gitversion: + runs-on: ubuntu-latest + + outputs: + fullSemVer: ${{ steps.gitversion.outputs.fullSemVer }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: gittools/actions/gitversion/setup@v0.9.3 + with: + versionSpec: "5.x" + + - id: gitversion + uses: gittools/actions/gitversion/execute@v0.9.3 + build: runs-on: ubuntu-latest @@ -45,8 +63,6 @@ jobs: name: build path: . - - run: ls -la - - name: Test run: | dotnet test \ @@ -62,3 +78,33 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: bash <(curl -s https://codecov.io/bash) + + nuget-pack: + runs-on: ubuntu-latest + needs: [build, gitversion] + + steps: + - uses: actions/download-artifact@v2 + with: + name: build + path: . + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 2.1.401 + + - name: NuGet Pack + run: | + dotnet pack \ + --include-source \ + --no-build \ + --no-restore \ + -p:PackageVersion="${{ needs.gitversion.outputs.fullSemVer }}" \ + src/json-ld.net/json-ld.net.csproj \ + --output nugets/ + + - uses: actions/upload-artifact@v2 + with: + name: nugets + path: nugets From b096da7822656097936316f6dcd93a0c882fdd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Thu, 25 Jun 2020 18:20:42 +0200 Subject: [PATCH 06/12] Specify NuGet package directory --- .github/workflows/dotnet.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index f852aef..acb39ea 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -37,6 +37,8 @@ jobs: 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') }} From a5c09250f69c1ccd1f93f8422c5ff73aaec75fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Thu, 25 Jun 2020 22:26:23 +0200 Subject: [PATCH 07/12] Remove . for dotnet test --- .github/workflows/dotnet.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index acb39ea..26167c3 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -68,7 +68,6 @@ jobs: - name: Test run: | dotnet test \ - . \ --configuration Release \ --no-build \ --no-restore \ From 0f348f0bfb593ac685a8350ea88f265b38b5b5e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Thu, 25 Jun 2020 23:18:00 +0200 Subject: [PATCH 08/12] Revert the job-splitting Revert the job-splitting as uploading and downloading the build artifacts take several minutes to complete. --- .github/workflows/dotnet.yml | 52 +++++------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 26167c3..b89e90e 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -7,7 +7,7 @@ on: branches: [master] jobs: - gitversion: + build: runs-on: ubuntu-latest outputs: @@ -25,14 +25,7 @@ jobs: - id: gitversion uses: gittools/actions/gitversion/execute@v0.9.3 - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 + - uses: actions/setup-dotnet@v1 with: dotnet-version: 2.1.401 @@ -44,29 +37,11 @@ jobs: key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} restore-keys: ${{ runner.os }}-nuget- - - name: Install dependencies - run: dotnet restore - - - name: Build - run: dotnet build --configuration Release --no-restore - - - uses: actions/upload-artifact@v2 - with: - name: build - path: . - - test: - runs-on: ubuntu-latest - needs: build + - run: dotnet restore - steps: - - uses: actions/download-artifact@v2 - with: - name: build - path: . + - run: dotnet build --configuration Release --no-restore - - name: Test - run: | + - run: | dotnet test \ --configuration Release \ --no-build \ @@ -80,28 +55,13 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: bash <(curl -s https://codecov.io/bash) - nuget-pack: - runs-on: ubuntu-latest - needs: [build, gitversion] - - steps: - - uses: actions/download-artifact@v2 - with: - name: build - path: . - - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 2.1.401 - - name: NuGet Pack run: | dotnet pack \ --include-source \ --no-build \ --no-restore \ - -p:PackageVersion="${{ needs.gitversion.outputs.fullSemVer }}" \ + -p:PackageVersion="${{ steps.gitversion.outputs.fullSemVer }}" \ src/json-ld.net/json-ld.net.csproj \ --output nugets/ From 0d7090929a863fe8c095f4198c6fa5f50303d667 Mon Sep 17 00:00:00 2001 From: Andrew Stewart Gibson Date: Fri, 3 Jul 2020 10:24:29 +0100 Subject: [PATCH 09/12] Update dotnet.yml dotnet pack defaults to Debug but we build Release --- .github/workflows/dotnet.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b89e90e..1bf1d78 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -59,6 +59,7 @@ jobs: run: | dotnet pack \ --include-source \ + --configuration Release \ --no-build \ --no-restore \ -p:PackageVersion="${{ steps.gitversion.outputs.fullSemVer }}" \ From cb0fb9027396aaebded23d7de378874f30b5bbb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Thu, 1 Oct 2020 23:21:07 +0200 Subject: [PATCH 10/12] Add jobs for package publishing - Add NuGet push to production job `nuget-push-prod`. - Add NuGet push to development job `nuget-push-dev`. - Add job `release-artifacts` to upload `.nuget` to the GitHub Release corresponding to the current tag (if any). --- .github/workflows/dotnet.yml | 67 +++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 1bf1d78..194efc8 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -3,6 +3,7 @@ name: dotnet on: push: branches: [master] + tags: ["*"] pull_request: branches: [master] @@ -18,12 +19,12 @@ jobs: with: fetch-depth: 0 - - uses: gittools/actions/gitversion/setup@v0.9.3 + - uses: gittools/actions/gitversion/setup@v0.9.4 with: versionSpec: "5.x" - id: gitversion - uses: gittools/actions/gitversion/execute@v0.9.3 + uses: gittools/actions/gitversion/execute@v0.9.4 - uses: actions/setup-dotnet@v1 with: @@ -55,8 +56,7 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: bash <(curl -s https://codecov.io/bash) - - name: NuGet Pack - run: | + - run: | dotnet pack \ --include-source \ --configuration Release \ @@ -64,9 +64,66 @@ jobs: --no-restore \ -p:PackageVersion="${{ steps.gitversion.outputs.fullSemVer }}" \ src/json-ld.net/json-ld.net.csproj \ - --output nugets/ + --output ${{ github.workspace }}/nugets/ - uses: actions/upload-artifact@v2 with: name: nugets path: nugets + + nuget-push-dev: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') != true + needs: build + + steps: + - uses: actions/download-artifact@v2 + with: + name: nugets + + - 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 }} + + - 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: 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 From 3861efaeb277a257e35cfb8368a7c1cdaeeaebcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Fri, 2 Oct 2020 02:01:55 +0200 Subject: [PATCH 11/12] Add RepositoryUrl to project file --- src/json-ld.net/json-ld.net.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/json-ld.net/json-ld.net.csproj b/src/json-ld.net/json-ld.net.csproj index 3bd4f7c..62f84ac 100644 --- a/src/json-ld.net/json-ld.net.csproj +++ b/src/json-ld.net/json-ld.net.csproj @@ -17,6 +17,7 @@ Implements the W3C JSON-LD 1.0 standard. false false false + https://github.com/linked-data-dotnet/json-ld.net @@ -36,4 +37,4 @@ Implements the W3C JSON-LD 1.0 standard. - \ No newline at end of file + From 2ab7e59b4654e0a383162f4a3b6bb8e95b8950bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Fri, 2 Oct 2020 22:03:14 +0200 Subject: [PATCH 12/12] Push packages on the master branch only --- .github/workflows/dotnet.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 194efc8..1869752 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -73,22 +73,25 @@ jobs: nuget-push-dev: runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') != true + if: github.ref == 'refs/heads/master' needs: build steps: - - uses: actions/download-artifact@v2 + - name: download artifact + uses: actions/download-artifact@v2 with: name: nugets - - uses: actions/setup-dotnet@v1 + - 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 }} - - run: dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ 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