-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Farshad DASHTI
authored and
Farshad DASHTI
committed
Oct 15, 2024
0 parents
commit 7a3b9a9
Showing
89 changed files
with
4,031 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
############################################################################### | ||
# Set default behavior to automatically normalize line endings. | ||
############################################################################### | ||
* text=auto | ||
|
||
############################################################################### | ||
# Set default behavior for command prompt diff. | ||
# | ||
# This is need for earlier builds of msysgit that does not have it on by | ||
# default for csharp files. | ||
# Note: This is only used by command line | ||
############################################################################### | ||
#*.cs diff=csharp | ||
|
||
############################################################################### | ||
# Set the merge driver for project and solution files | ||
# | ||
# Merging from the command prompt will add diff markers to the files if there | ||
# are conflicts (Merging from VS is not affected by the settings below, in VS | ||
# the diff markers are never inserted). Diff markers may cause the following | ||
# file extensions to fail to load in VS. An alternative would be to treat | ||
# these files as binary and thus will always conflict and require user | ||
# intervention with every merge. To do so, just uncomment the entries below | ||
############################################################################### | ||
#*.sln merge=binary | ||
#*.csproj merge=binary | ||
#*.vbproj merge=binary | ||
#*.vcxproj merge=binary | ||
#*.vcproj merge=binary | ||
#*.dbproj merge=binary | ||
#*.fsproj merge=binary | ||
#*.lsproj merge=binary | ||
#*.wixproj merge=binary | ||
#*.modelproj merge=binary | ||
#*.sqlproj merge=binary | ||
#*.wwaproj merge=binary | ||
|
||
############################################################################### | ||
# behavior for image files | ||
# | ||
# image files are treated as binary by default. | ||
############################################################################### | ||
#*.jpg binary | ||
#*.png binary | ||
#*.gif binary | ||
|
||
############################################################################### | ||
# diff behavior for common document formats | ||
# | ||
# Convert binary document formats to text before diffing them. This feature | ||
# is only available from the command line. Turn it on by uncommenting the | ||
# entries below. | ||
############################################################################### | ||
#*.doc diff=astextplain | ||
#*.DOC diff=astextplain | ||
#*.docx diff=astextplain | ||
#*.DOCX diff=astextplain | ||
#*.dot diff=astextplain | ||
#*.DOT diff=astextplain | ||
#*.pdf diff=astextplain | ||
#*.PDF diff=astextplain | ||
#*.rtf diff=astextplain | ||
#*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Build DfE.CoreLibs.AsyncProcessing | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.AsyncProcessing/**' | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.AsyncProcessing/**' | ||
|
||
jobs: | ||
build-and-test: | ||
uses: ./.github/workflows/build-test-template.yml | ||
with: | ||
project_name: DfE.CoreLibs.AsyncProcessing | ||
project_path: src/DfE.CoreLibs.AsyncProcessing | ||
secrets: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Build DfE.CoreLibs.Caching | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.Caching/**' | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.Caching/**' | ||
|
||
jobs: | ||
build-and-test: | ||
uses: ./.github/workflows/build-test-template.yml | ||
with: | ||
project_name: DfE.CoreLibs.Caching | ||
project_path: src/DfE.CoreLibs.Caching | ||
secrets: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Build DfE.CoreLibs.Contracts | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.Contracts/**' | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.Contracts/**' | ||
|
||
jobs: | ||
build-and-test: | ||
uses: ./.github/workflows/build-test-template.yml | ||
with: | ||
project_name: DfE.CoreLibs.Contracts | ||
project_path: src/DfE.CoreLibs.Contracts | ||
run_tests: false | ||
secrets: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Build DfE.CoreLibs.Http | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.Http/**' | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.Http/**' | ||
|
||
jobs: | ||
build-and-test: | ||
uses: ./.github/workflows/build-test-template.yml | ||
with: | ||
project_name: DfE.CoreLibs.Http | ||
project_path: src/DfE.CoreLibs.Http | ||
secrets: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: .NET Build and Test Template | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
project_name: | ||
required: true | ||
type: string | ||
description: "The name of the project" | ||
project_path: | ||
required: true | ||
type: string | ||
description: "The relative path to the project directory" | ||
run_tests: | ||
required: false | ||
type: boolean | ||
default: true | ||
description: "Flag to run or skip tests" | ||
secrets: | ||
SONAR_TOKEN: | ||
required: true | ||
env: | ||
DOTNET_VERSION: '8.0.x' | ||
EF_VERSION: '6.0.5' | ||
JAVA_VERSION: '17' | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: read | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
- name: Setup JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'microsoft' | ||
java-version: ${{ env.JAVA_VERSION }} | ||
|
||
- name: Cache SonarCloud packages | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
|
||
- name: Install SonarCloud scanners | ||
run: dotnet tool install --global dotnet-sonarscanner | ||
|
||
- name: Install EF for tests | ||
run: dotnet tool install --global dotnet-ef --version ${{ env.EF_VERSION }} | ||
|
||
- name: Install dotnet reportgenerator | ||
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" | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore ${{ inputs.project_path }} | ||
|
||
- name: Set Test Project Path | ||
run: | | ||
test_project_path="${{ inputs.project_path }}" | ||
test_project_path="${test_project_path/src\//src\/Tests\/}.Tests" | ||
echo "test_project_path=$test_project_path" >> $GITHUB_ENV | ||
- name: Build, Test and Analyze | ||
env: | ||
CI: true | ||
run: | | ||
echo "run_tests is set to: ${{ inputs.run_tests }}" | ||
if [ "${{ inputs.run_tests }}" == "true" ]; then | ||
dotnet-sonarscanner begin /k:"DFE-Digital_rsd-core-libs" /o:"dfe-digital" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths=CoverageReport/SonarQube.xml; | ||
else | ||
dotnet-sonarscanner begin /k:"DFE-Digital_rsd-core-libs" /o:"dfe-digital" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"; | ||
fi | ||
dotnet build --no-restore -p:CI=${CI} ${{ inputs.project_path }} | ||
- name: Run Tests | ||
if: ${{ inputs.run_tests }} | ||
run: dotnet test --verbosity normal --collect:"XPlat Code Coverage" ${{ env.test_project_path }} | ||
|
||
- name: Generate Code Coverage Report | ||
if: ${{ inputs.run_tests }} | ||
run: reportgenerator -reports:./**/coverage.cobertura.xml -targetdir:./CoverageReport -reporttypes:SonarQube | ||
|
||
- name: Complete Sonar Scan | ||
run: dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Build DfE.CoreLibs.Testing | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.Testing/**' | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.Testing/**' | ||
|
||
jobs: | ||
build-and-test: | ||
uses: ./.github/workflows/build-test-template.yml | ||
with: | ||
project_name: DfE.CoreLibs.Testing | ||
project_path: src/DfE.CoreLibs.Testing | ||
run_tests: false | ||
secrets: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Build DfE.CoreLibs.Utilities | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.Utilities/**' | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/DfE.CoreLibs.Utilities/**' | ||
|
||
jobs: | ||
build-and-test: | ||
uses: ./.github/workflows/build-test-template.yml | ||
with: | ||
project_name: DfE.CoreLibs.Utilities | ||
project_path: src/DfE.CoreLibs.Utilities | ||
secrets: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
Oops, something went wrong.