From 360f3804eff36af1f272ddb1e74e9af5bc656bb8 Mon Sep 17 00:00:00 2001 From: Emanuel Gaspar Date: Thu, 7 Nov 2024 16:50:50 +0000 Subject: [PATCH 1/4] default to .NET 8 --- .github/workflows/shared-build-deploy-container.yml | 4 ++-- build-push-container-image/action.yml | 4 ++-- code-quality/action.yml | 6 +++--- publish-nuget/action.yml | 8 ++++---- restore-dotnet/action.yml | 4 ++-- test-dotnet/action.yml | 10 +++++----- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/shared-build-deploy-container.yml b/.github/workflows/shared-build-deploy-container.yml index f3fee758..c84343e2 100644 --- a/.github/workflows/shared-build-deploy-container.yml +++ b/.github/workflows/shared-build-deploy-container.yml @@ -29,10 +29,10 @@ on: type: string default: 'api' dotnetVersion: - description: "Version of dotnet to use. Default is v7.x." + description: "Version of dotnet to use. Default is v8.x." required: false type: string - default: "7.x" + default: "8.x" dockerRegistry: description: "Docker registry to push the image to. Default is ghcr.io." required: false diff --git a/build-push-container-image/action.yml b/build-push-container-image/action.yml index 161b7ec2..8894f236 100644 --- a/build-push-container-image/action.yml +++ b/build-push-container-image/action.yml @@ -24,9 +24,9 @@ inputs: description: "Type of container publish (api | worker)." required: true dotnetVersion: - description: "Version of dotnet to use. Default is v7.x." + description: "Version of dotnet to use. Default is v8.x." required: false - default: "7.x" + default: "8.x" dockerRegistry: description: "Docker registry to push the image to." required: false diff --git a/code-quality/action.yml b/code-quality/action.yml index 2da3211a..9b32c294 100644 --- a/code-quality/action.yml +++ b/code-quality/action.yml @@ -10,13 +10,13 @@ inputs: description: "Personal access token used to access the github private nuget source." required: true dotnetVersion: - description: "Version of dotnet to use. Default is v7.x." + description: "Version of dotnet to use. Default is v8.x." required: false - default: "7.x" + default: "8.x" qodanaToken: description: "Token used by Qodana to identify the project being analysed." required: true - + runs: using: composite diff --git a/publish-nuget/action.yml b/publish-nuget/action.yml index cba423c3..27a91d0d 100644 --- a/publish-nuget/action.yml +++ b/publish-nuget/action.yml @@ -21,9 +21,9 @@ inputs: required: false default: "master" dotnetVersion: - description: "Version of dotnet to use. Default is v7.x." + description: "Version of dotnet to use. Default is v8.x." required: false - default: "7.x" + default: "8.x" runs: using: "composite" @@ -42,7 +42,7 @@ runs: - name: Checkout uses: actions/checkout@v4 - + - name: Checkout actions repo uses: actions/checkout@v4 with: @@ -88,7 +88,7 @@ runs: ls ./nuget/*.nupkg for f in ./nuget/*.symbols.nupkg; \ do echo "pushing $f file.." \ - && dotnet nuget push $f --api-key ${{inputs.githubToken}} --source "https://nuget.pkg.github.com/trakx/index.json"; + && dotnet nuget push $f --api-key ${{inputs.githubToken}} --source "https://nuget.pkg.github.com/trakx/index.json"; done - name: Push version tag diff --git a/restore-dotnet/action.yml b/restore-dotnet/action.yml index 2dec155f..f1e694df 100644 --- a/restore-dotnet/action.yml +++ b/restore-dotnet/action.yml @@ -6,9 +6,9 @@ inputs: description: "Personal access token used to access the github private nuget source." required: true dotnetVersion: - description: "Version of dotnet to use. Default is v7.x." + description: "Version of dotnet to use. Default is v8.x." required: false - default: "7.x" + default: "8.x" runs: using: "composite" diff --git a/test-dotnet/action.yml b/test-dotnet/action.yml index e9fd7b7f..a6b83d1b 100644 --- a/test-dotnet/action.yml +++ b/test-dotnet/action.yml @@ -19,9 +19,9 @@ inputs: required: false default: "eu-west-3" dotnetVersion: - description: "Version of dotnet to use. Default is v7.x." + description: "Version of dotnet to use. Default is v8.x." required: false - default: "7.x" + default: "8.x" actionsRepoRef: description: "Run actions from this ref. Default is master." required: false @@ -61,8 +61,8 @@ runs: aws-access-key-id: ${{inputs.awsAccessKeyId}} aws-secret-access-key: ${{inputs.awsAccessKeySecret}} aws-region: ${{inputs.awsRegion}} - - # GitHubActionsTestLogger nuget package should be installed in the test project + + # GitHubActionsTestLogger nuget package should be installed in the test project # coverlet.msbuild nuget package should be installed to generate coverage report - name: .NET Test shell: bash @@ -72,7 +72,7 @@ runs: projectName="${csprojName/.csproj/}" && \ dotnet test $f --configuration Debug --no-build --logger GitHubActions --collect "XPlat Code Coverage" --results-directory "TestResults/$projectName" done - + # .NET Test puts the coverage file under a random directory [Guid]/coverage.cobertura.xml # That's why we locate the coverage file first and pass it to the upload script - name: Publish Coverage From 44df71498a9da6f61a58e6155d56aa3856a6b42f Mon Sep 17 00:00:00 2001 From: Emanuel Gaspar Date: Thu, 7 Nov 2024 17:57:48 +0000 Subject: [PATCH 2/4] Remove extra restores, unnecessary loops for dotnet and codacy (#110) * feat/test-solution * restore in restore-dotnet only * fix syntax * codacy single shot * https://coverage.codacy.com/get.sh --- restore-dotnet/action.yml | 15 +++++++-------- test-dotnet/action.yml | 28 ++++++++++------------------ 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/restore-dotnet/action.yml b/restore-dotnet/action.yml index f1e694df..ac19ecdb 100644 --- a/restore-dotnet/action.yml +++ b/restore-dotnet/action.yml @@ -24,10 +24,10 @@ runs: - name: Add Trakx github nuget source shell: bash run: dotnet nuget add source "https://nuget.pkg.github.com/trakx/index.json" - --name "github" - --username "trakx-bot" - --password ${{inputs.packageReadonlyPat}} - --store-password-in-clear-text + --name "github" + --username "trakx-bot" + --password ${{inputs.packageReadonlyPat}} + --store-password-in-clear-text - name: Restore Cache uses: actions/cache@v4 @@ -38,10 +38,9 @@ runs: - name: .NET Restore packages shell: bash - run: | - for f in $(find . -name "*.sln"); do echo "restoring solution $f" && \ - dotnet restore $f --locked-mode - done + env: + DOTNET_NUGET_SIGNATURE_VERIFICATION: false + run: dotnet restore --locked-mode - name: Remove Trakx github source shell: bash diff --git a/test-dotnet/action.yml b/test-dotnet/action.yml index a6b83d1b..3d6acc6a 100644 --- a/test-dotnet/action.yml +++ b/test-dotnet/action.yml @@ -44,17 +44,12 @@ runs: - name: Restore and cache private nuget packages uses: ./github-actions-test-dotnet/restore-dotnet + env: + DOTNET_NOLOGO: true with: dotnetVersion: ${{inputs.dotnetVersion}} packageReadonlyPat: ${{inputs.packageReadonlyPat}} - - name: .NET Build - shell: bash - run: | - for f in $(find . -name "*.sln"); do echo "restoring solution $f" && \ - dotnet build $f --configuration Debug --no-restore - done - - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4.0.1 with: @@ -66,12 +61,12 @@ runs: # coverlet.msbuild nuget package should be installed to generate coverage report - name: .NET Test shell: bash - run: | - for f in $(find . -name "*.Tests.csproj"); do echo "testing project $f" && \ - csprojName=${f##*/} && \ - projectName="${csprojName/.csproj/}" && \ - dotnet test $f --configuration Debug --no-build --logger GitHubActions --collect "XPlat Code Coverage" --results-directory "TestResults/$projectName" - done + run: dotnet test + --no-restore + --configuration Debug + --logger GitHubActions + --collect "XPlat Code Coverage" + --results-directory "TestResults/" # .NET Test puts the coverage file under a random directory [Guid]/coverage.cobertura.xml # That's why we locate the coverage file first and pass it to the upload script @@ -80,8 +75,5 @@ runs: env: CODACY_PROJECT_TOKEN: ${{inputs.codacyToken}} run: | - for f in $(find ./TestResults -name "coverage.cobertura.xml"); do echo "sending coverage report $f" && \ - bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l csharp -r $f \ - --partial; \ - done - bash <(curl -Ls https://coverage.codacy.com/get.sh) final + bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l csharp \ + $(find ./TestResults -name 'coverage.cobertura.xml' | sed 's,^, -r ,' | xargs echo) From 98db7a5eb3894470d36a64c64f11307592188b10 Mon Sep 17 00:00:00 2001 From: Emanuel Gaspar Date: Fri, 8 Nov 2024 08:29:18 +0000 Subject: [PATCH 3/4] remove .NET version defaults (#112) --- .github/workflows/shared-build-deploy-container.yml | 5 ++--- build-push-container-image/action.yml | 5 ++--- code-quality/action.yml | 5 ++--- publish-nuget/action.yml | 5 ++--- restore-dotnet/action.yml | 5 ++--- test-dotnet/action.yml | 5 ++--- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.github/workflows/shared-build-deploy-container.yml b/.github/workflows/shared-build-deploy-container.yml index c84343e2..6518547c 100644 --- a/.github/workflows/shared-build-deploy-container.yml +++ b/.github/workflows/shared-build-deploy-container.yml @@ -29,10 +29,9 @@ on: type: string default: 'api' dotnetVersion: - description: "Version of dotnet to use. Default is v8.x." - required: false + description: "Version of dotnet to use." + required: true type: string - default: "8.x" dockerRegistry: description: "Docker registry to push the image to. Default is ghcr.io." required: false diff --git a/build-push-container-image/action.yml b/build-push-container-image/action.yml index 8894f236..33ef8d3e 100644 --- a/build-push-container-image/action.yml +++ b/build-push-container-image/action.yml @@ -24,9 +24,8 @@ inputs: description: "Type of container publish (api | worker)." required: true dotnetVersion: - description: "Version of dotnet to use. Default is v8.x." - required: false - default: "8.x" + description: "Version of dotnet to use." + required: true dockerRegistry: description: "Docker registry to push the image to." required: false diff --git a/code-quality/action.yml b/code-quality/action.yml index 9b32c294..0d17d0ec 100644 --- a/code-quality/action.yml +++ b/code-quality/action.yml @@ -10,9 +10,8 @@ inputs: description: "Personal access token used to access the github private nuget source." required: true dotnetVersion: - description: "Version of dotnet to use. Default is v8.x." - required: false - default: "8.x" + description: "Version of dotnet to use." + required: true qodanaToken: description: "Token used by Qodana to identify the project being analysed." required: true diff --git a/publish-nuget/action.yml b/publish-nuget/action.yml index 27a91d0d..fd736007 100644 --- a/publish-nuget/action.yml +++ b/publish-nuget/action.yml @@ -21,9 +21,8 @@ inputs: required: false default: "master" dotnetVersion: - description: "Version of dotnet to use. Default is v8.x." - required: false - default: "8.x" + description: "Version of dotnet to use." + required: true runs: using: "composite" diff --git a/restore-dotnet/action.yml b/restore-dotnet/action.yml index ac19ecdb..c4d6ad07 100644 --- a/restore-dotnet/action.yml +++ b/restore-dotnet/action.yml @@ -6,9 +6,8 @@ inputs: description: "Personal access token used to access the github private nuget source." required: true dotnetVersion: - description: "Version of dotnet to use. Default is v8.x." - required: false - default: "8.x" + description: "Version of dotnet to use." + required: true runs: using: "composite" diff --git a/test-dotnet/action.yml b/test-dotnet/action.yml index 3d6acc6a..90bac589 100644 --- a/test-dotnet/action.yml +++ b/test-dotnet/action.yml @@ -19,9 +19,8 @@ inputs: required: false default: "eu-west-3" dotnetVersion: - description: "Version of dotnet to use. Default is v8.x." - required: false - default: "8.x" + description: "Version of dotnet to use." + required: true actionsRepoRef: description: "Run actions from this ref. Default is master." required: false From 84867e444d1e5454fa4e07ee0ee1a8c46162f178 Mon Sep 17 00:00:00 2001 From: Emanuel Gaspar Date: Fri, 8 Nov 2024 14:30:13 +0000 Subject: [PATCH 4/4] fix/restore-dotnet-test-loop (#115) * fix/restore-dotnet-test-loop * cleanup syntax * add slash --- test-dotnet/action.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/test-dotnet/action.yml b/test-dotnet/action.yml index 90bac589..81bc0a17 100644 --- a/test-dotnet/action.yml +++ b/test-dotnet/action.yml @@ -56,16 +56,25 @@ runs: aws-secret-access-key: ${{inputs.awsAccessKeySecret}} aws-region: ${{inputs.awsRegion}} - # GitHubActionsTestLogger nuget package should be installed in the test project - # coverlet.msbuild nuget package should be installed to generate coverage report + # GitHubActionsTestLogger nuget package should be installed in the test project. + # coverlet.msbuild nuget package should be installed to generate coverage report. + # The loop is necessary to prevent the following error: + # "Could not find a test logger with AssemblyQualifiedName, URI or FriendlyName 'GitHubActions'." - name: .NET Test shell: bash - run: dotnet test - --no-restore - --configuration Debug - --logger GitHubActions - --collect "XPlat Code Coverage" - --results-directory "TestResults/" + run: | + for f in $(find . -name "*.Tests.csproj"); + do + echo "testing project $f" && \ + csprojName=${f##*/} && \ + projectName="${csprojName/.csproj/}" && \ + dotnet test $f \ + --no-restore \ + --configuration Debug \ + --logger GitHubActions \ + --collect "XPlat Code Coverage" \ + --results-directory "TestResults/$projectName" + done # .NET Test puts the coverage file under a random directory [Guid]/coverage.cobertura.xml # That's why we locate the coverage file first and pass it to the upload script