Skip to content

Commit

Permalink
Updated variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Farshad DASHTI authored and Farshad DASHTI committed Oct 1, 2024
1 parent 5fb3e18 commit 350c6c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-test-caching.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ jobs:
project_name: DfE.CoreLibs.Caching
project_path: src/DfE.CoreLibs.Caching
sonar_project_key: DFE-Digital_corelibs-caching
secrets:
GITHUB__TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR__TOKEN: ${{ secrets.SONAR_TOKEN }}
15 changes: 10 additions & 5 deletions .github/workflows/build-test-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ on:
required: true
type: string
description: "SonarCloud project key"
secrets:
GITHUB__TOKEN:
required: true
SONAR__TOKEN:
required: true

env:
DOTNET_VERSION: '8.0.x'
Expand Down Expand Up @@ -61,20 +66,20 @@ jobs:
run: dotnet tool install --global dotnet-reportgenerator-globaltool

- name: Add nuget package source
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/DFE-Digital/index.json"
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB__TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/DFE-Digital/index.json"

- name: Restore dependencies
run: dotnet restore ${{ inputs.project_path }}

- name: Build, Test and Analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB__TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR__TOKEN }}
ConnectionStrings__DefaultConnection: ${{ env.CONNECTION_STRING }}
CI: true
run: |
dotnet-sonarscanner begin /k:"${{ inputs.sonar_project_key }}" /o:"dfe-digital" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths=CoverageReport/SonarQube.xml
dotnet-sonarscanner begin /k:"${{ inputs.sonar_project_key }}" /o:"dfe-digital" /d:sonar.token="${{ secrets.SONAR__TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths=CoverageReport/SonarQube.xml
dotnet build --no-restore -p:CI=${CI} ${{ inputs.project_path }}
dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" ${{ inputs.project_path }}
reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:./CoverageReport -reporttypes:SonarQube
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR__TOKEN }}"
3 changes: 2 additions & 1 deletion src/DfE.CoreLibs.Caching/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using DfE.CoreLibs.Caching.Settings;
using Microsoft.Extensions.Configuration;


namespace Microsoft.Extensions.DependencyInjection
{
public static class ServiceCollectionExtensions
Expand All @@ -16,4 +17,4 @@ public static IServiceCollection AddServiceCaching(
return services;
}
}
}
}

0 comments on commit 350c6c7

Please sign in to comment.