From 4a640e4ec67f39dbbef3a442d28a1d4422753582 Mon Sep 17 00:00:00 2001 From: Alexandros Kritikos Date: Sat, 7 Dec 2019 23:56:25 +0200 Subject: [PATCH 1/5] :green_heart: Updates CI configuration --- azure-pipelines.yml | 175 +++++++++++++++++++++++--------------------- 1 file changed, 90 insertions(+), 85 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8a9c46c..5d5d17d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,152 +5,157 @@ resources: submodules: true lfs: true trigger: + batch: true branches: include: - master - develop - feature/* - bugfix/* + - release/* paths: include: + - azure-pipelines.yml - src/* - tests/* variables: - group: Environment - + - group: ApiKeys + - name: SONAR_PROJECT + value: REPLACE_ME jobs: -- job: Setup +- job: Version pool: - vmImage: windows-latest + vmImage: ubuntu-latest steps: - - powershell: | - dotnet tool install --tool-path .. gitversion.tool - displayName: Installing Dotnet Tools - - - powershell: | - $git = $(../dotnet-gitversion /output json /showvariable NugetVersion) - echo "##vso[task.setvariable variable=gitVersion;isOutput=true]$(../dotnet-gitversion /output json /showvariable NugetVersion)" - name: versioning - displayName: Setting version from git - - - powershell: | - echo "Current version: $(versioning.gitVersion)" - displayName: Shows currently compiling version - -- job: Building + - pwsh: dotnet tool install --tool-path .. gitversion.tool + displayName: Install GitVersion + - pwsh: | + echo "##vso[task.setvariable variable=gitVersion;isOutput=true]$(../dotnet-gitversion /output json /showvariable SemVer)" + "Current version: $(../dotnet-gitversion /output json /showvariable SemVer)" + displayName: Sets SemVer + name: versioning +- job: Build pool: vmImage: ubuntu-latest dependsOn: - - Setup + - Version variables: - Version: $[ dependencies.Setup.outputs['versioning.gitVersion'] ] + Version: $[ dependencies.Version.outputs['versioning.gitVersion'] ] steps: - checkout: self fetchDepth: 1 - - task: DotNetCoreCLI@2 - displayName: Restoring nugets + displayName: Build Solution inputs: - command: 'restore' - arguments: -Project2ProjectTimeOut 20 - verbosityRestore: Normal - - - task: DotNetCoreCLI@2 - displayName: Building Projects - inputs: - command: build - projects: src/*/*.csproj + command: 'build' configuration: $(BuildConfiguration) - arguments: -o $(build.artifactStagingDirectory)/build + arguments: '-o $(build.artifactStagingDirectory)/build' versioningScheme: byEnvVar versionEnvVar: Version - + verbosityRestore: Minimal - task: PublishBuildArtifacts@1 - displayName: Publish build artifacts + displayName: Publish Build inputs: PathtoPublish: $(build.artifactStagingDirectory)/build ArtifactName: 'drop' - + publishLocation: 'Container' - task: DotNetCoreCLI@2 - displayName: Packing as Nugets + displayName: Pack Nugets inputs: - command: pack - searchPatternPack: 'src/*/*.csproj' + command: 'pack' + packagesToPack: 'src/*/*.csproj' + packDirectory: '$(build.artifactStagingDirectory)/nuget' configuration: $(BuildConfiguration) versioningScheme: byEnvVar versionEnvVar: Version - verbosityPack: normal - packDirectory: $(build.artifactStagingDirectory)/nuget - + verbosityRestore: Minimal + verbosityPack: Minimal - task: PublishBuildArtifacts@1 - name: publishNuget - displayName: Publish nugets + displayName: Publish Nugets inputs: - PathtoPublish: $(build.artifactStagingDirectory)/nuget + PathtoPublish: '$(build.artifactStagingDirectory)/nuget' ArtifactName: 'nuget' - -- job: Testing + publishLocation: 'Container' +- job: Test pool: vmImage: ubuntu-latest dependsOn: - - Setup + - Version variables: - Version: $[ dependencies.Setup.outputs['versioning.gitVersion'] ] + Version: $[ dependencies.Version.outputs['versioning.gitVersion'] ] + GITHUB_KEY: $(GitHubApiKey) + SONAR_ORG: $(SonarCloudOrganization) + SONAR_KEY: $(SonarCloudApiKey) + SONAR_URL: $(SonarCloudHost) + CODECOV_KEY: $(CodeCovApiKey) + COVERALLS_KEY: $(CoverallsApiKey) steps: - checkout: self - fetchDepth: 1 - + - pwsh: | + dotnet tool install --tool-path .. dotnet-sonarscanner + dotnet tool install --tool-path .. coveralls.net + dotnet tool install --tool-path .. Codecov.Tool + displayName: Install Tools + - pwsh: | + ../dotnet-sonarscanner begin /k:"$(SONAR_PROJECT)" /v:"$(Version)" /o:"$(SONAR_ORG)" /d:sonar.host.url="$(SONAR_URL)" /d:sonar.login="$(SONAR_KEY)" /d:sonar.cs.opencover.reportsPaths="$(build.artifactStagingDirectory)/coverage/coverage.opencover.xml" /d:sonar.branch.name="$(Build.SourceBranchName)" /d:sonar.github.repository="$(Build.Repository.Name)" /d:sonar.github.oauth=$(GITHUB_KEY) + condition: ne(variables['Build.Reason'], 'PullRequest') + displayName: SonarCloud (commit) + - pwsh: | + ../dotnet-sonarscanner begin /k:"$(SONAR_PROJECT)" /v:"$(Version)" /o:"$(SONAR_ORG)" /d:sonar.host.url="$(SONAR_URL)" /d:sonar.login="$(SONAR_KEY)" /d:sonar.cs.opencover.reportsPaths="$(build.artifactStagingDirectory)/coverage/coverage.opencover.xml" /d:sonar.github.repository="$(Build.Repository.Name)" /d:sonar.github.oauth=$(GITHUB_KEY) /d:sonar.pullrequest.key="$(System.PullRequest.PullRequestNumber)" /d:sonar.pullrequest.branch="$(Build.SourceBranchName)" /d:sonar.pullrequest.provider="github" + condition: eq(variables['Build.Reason'], 'PullRequest') + displayName: SonarCloud (PR) - task: DotNetCoreCLI@2 - name: dotnetRestore - displayName: Restoring nugets + displayName: Test Solution inputs: - command: 'restore' - arguments: -Project2ProjectTimeOut 20 --packages "$(Build.BinariesDirectory)/.nuget) - verbosityRestore: Normal - - - task: DotNetCoreCLI@2 - name: dotnetBuild - displayName: Building Projects - inputs: - command: build - projects: src/*/*.*proj - configuration: $(BuildConfiguration) - versioningScheme: byEnvVar - versionEnvVar: Version - - - task: DotNetCoreCLI@2 - name: dotnetTest - displayName: Testing implementations - inputs: - command: test - projects: 'tests/*/*.*proj' + command: 'test' configuration: 'Debug' - testRunTitle: 'Running tests' - -- job: Publishing + arguments: '--logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=$(build.artifactStagingDirectory)/coverage/ /p:MergeWith=$(build.artifactStagingDirectory)/coverage/coverage.json' + publishTestResults: true + verbosityPack: Minimal + verbosityRestore: Minimal + testRunTitle: 'Unit Tests' + - pwsh: | + ../dotnet-sonarscanner end /d:sonar.login="$(SONAR_KEY)" + displayName: Publish SonarCloud + - task: PublishBuildArtifacts@1 + displayName: Publish Test Coverage + inputs: + PathtoPublish: $(build.artifactStagingDirectory)/coverage + ArtifactName: 'coverage' + publishLocation: 'Container' + - pwsh: | + ../csmacnz.Coveralls --repoToken "$(COVERALLS_KEY)" --opencover -i $(build.artifactStagingDirectory)/coverage/coverage.opencover.xml --useRelativePaths --commitId "$(Build.SourceVersion)" --commitBranch "$(Build.SourceBranchName)" --commitAuthor "$(Build.RequestedFor)" --commitEmail "$(Build.RequestedForEmail)" --commitMessage "$(Build.SourceVersionMessage)" --jobId "$(Build.BuildId)" + ../codecov --token "$(CodeCovApiKey)" --file $(build.artifactStagingDirectory)/coverage/coverage.opencover.xml --branch "$(Build.SourceBranchName)" --sha "$(Build.SourceVersion)" + condition: ne(variables['Build.Reason'], 'PullRequest') + displayName: Push Coverage (commit) + - pwsh: | + ../csmacnz.Coveralls --repoToken "$(COVERALLS_KEY)" --opencover -i $(build.artifactStagingDirectory)/coverage/coverage.opencover.xml --useRelativePaths --commitId "$(Build.SourceVersion)" --commitBranch "$(Build.SourceBranchName)" --commitAuthor "$(Build.RequestedFor)" --commitEmail "$(Build.RequestedForEmail)" --commitMessage "$(Build.SourceVersionMessage)" --jobId "$(Build.BuildId)" --pullRequest "$(System.PullRequest.PullRequestNumber)" + ../codecov --token "$(CodeCovApiKey)" --file $(build.artifactStagingDirectory)/coverage/coverage.opencover.xml --branch "$(Build.SourceBranchName)" --sha "$(Build.SourceVersion)" --pr "$(System.PullRequest.PullRequestNumber)" + condition: eq(variables['Build.Reason'], 'PullRequest') + displayName: Push Coverage (PR) +- job: Publish pool: vmImage: ubuntu-latest dependsOn: - - Setup - - Building - - Testing - variables: - Version: $[ dependencies.Setup.outputs['versioning.gitVersion'] ] + - Version + - Build + - Test steps: - checkout: none - - task: DownloadPipelineArtifact@2 - displayName: Downloading artifact + displayName: Fetch nugets inputs: + buildType: 'current' artifactName: 'nuget' targetPath: $(build.artifactStagingDirectory)/nuget - - task: DotNetCoreCLI@2 - displayName: Pushing to nuget server + condition: ne(variables['Build.Reason'], 'PullRequest') + displayName: Push Nugets inputs: workingDirectory: $(build.artifactStagingDirectory)/nuget command: 'custom' - custom: nuget + custom: 'nuget' arguments: > push *.nupkg -s $(KritikosNuget) From cc8551f9f7d1512adae943e0a83527e2ca6a9241 Mon Sep 17 00:00:00 2001 From: Alexandros Kritikos Date: Sat, 19 Jun 2021 16:37:47 +0300 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=94=A7=20Properly=20implements=20conf?= =?UTF-8?q?iguration=20submodule?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config | 2 +- .gitignore | 2 +- .vscode | 1 - .vscode/tasks.json | 1 + Dotnet.code-workspace | 2 +- Dotnet.sln.DotSettings | 2 +- README.md | 2 ++ gulpfile.js | 1 - 8 files changed, 7 insertions(+), 6 deletions(-) delete mode 120000 .vscode create mode 120000 .vscode/tasks.json delete mode 120000 gulpfile.js diff --git a/.config b/.config index 9b9cc35..a7d38f3 160000 --- a/.config +++ b/.config @@ -1 +1 @@ -Subproject commit 9b9cc35843015349a3033a0f28d9084b30c0e42c +Subproject commit a7d38f3c6c34168ec05935f8bb4898d77bc114d9 diff --git a/.gitignore b/.gitignore index 0b35e65..e6ab0ae 120000 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -.config/.gitignore \ No newline at end of file +.config/.gitignore-dotnet \ No newline at end of file diff --git a/.vscode b/.vscode deleted file mode 120000 index f10b680..0000000 --- a/.vscode +++ /dev/null @@ -1 +0,0 @@ -.config/.vscode \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 120000 index 0000000..a46957e --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1 @@ +../.config/.vscode/tasks-dotnet.json \ No newline at end of file diff --git a/Dotnet.code-workspace b/Dotnet.code-workspace index faea5b2..45c482d 120000 --- a/Dotnet.code-workspace +++ b/Dotnet.code-workspace @@ -1 +1 @@ -.config/Dotnet.code-workspace \ No newline at end of file +.config/Sample.code-workspace \ No newline at end of file diff --git a/Dotnet.sln.DotSettings b/Dotnet.sln.DotSettings index d5ff3a1..920203b 120000 --- a/Dotnet.sln.DotSettings +++ b/Dotnet.sln.DotSettings @@ -1 +1 @@ -.config/Resharper.sln.DotSettings \ No newline at end of file +.config/Sample.sln.DotSettings \ No newline at end of file diff --git a/README.md b/README.md index 76d424d..810361c 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ A simple template leveraging [.Config][1] dotfiles submodule for rapid project deployment. Simply rename Solution.{code-workspace,sln,sln.DotSettings} to your project name and get started! Afterwards, replace this readme with the actual documentation of your project. +Additionally, change the Project & Repository urls on [src/Directory.Build.props](src/Directory.Build.props). + Additionally, until GitHub properly supports submodule definitions from template repositories, after cloning you should run ```git submodule add https://github.com/kritikos-io/.config``` from the repository root. You can replace the submodule with a compatible fork (to preserve your own default namespace etc) **provided it keeps file naming intact** since most files are appearing as symlinks. diff --git a/gulpfile.js b/gulpfile.js deleted file mode 120000 index 14eda9b..0000000 --- a/gulpfile.js +++ /dev/null @@ -1 +0,0 @@ -.config/gulpfile.js \ No newline at end of file From 1b19576225bc99c8e62090ffac05f8838750965f Mon Sep 17 00:00:00 2001 From: Alexandros Kritikos Date: Sat, 19 Jun 2021 16:47:14 +0300 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=94=A7=20Adds=20handling=20for=20samp?= =?UTF-8?q?les=20&=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config | 2 +- samples/Directory.Build.props | 1 + src/Directory.build.props | 10 ++++++++++ tests/Directory.Build.props | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) create mode 120000 samples/Directory.Build.props create mode 100644 src/Directory.build.props create mode 120000 tests/Directory.Build.props diff --git a/.config b/.config index a7d38f3..0da22b3 160000 --- a/.config +++ b/.config @@ -1 +1 @@ -Subproject commit a7d38f3c6c34168ec05935f8bb4898d77bc114d9 +Subproject commit 0da22b3059abfc03db8a2eb584f8d10328fc353f diff --git a/samples/Directory.Build.props b/samples/Directory.Build.props new file mode 120000 index 0000000..dac8906 --- /dev/null +++ b/samples/Directory.Build.props @@ -0,0 +1 @@ +../.config/Extras.Directory.Build.props \ No newline at end of file diff --git a/src/Directory.build.props b/src/Directory.build.props new file mode 100644 index 0000000..24a2d2f --- /dev/null +++ b/src/Directory.build.props @@ -0,0 +1,10 @@ + + + + + + + http://localhost + http://localhost + + diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props new file mode 120000 index 0000000..92b9d7a --- /dev/null +++ b/tests/Directory.Build.props @@ -0,0 +1 @@ +../.config/Tests.Directory.Build.props \ No newline at end of file From 2045af18ab589f22b908382a5faa114208f6befc Mon Sep 17 00:00:00 2001 From: Alexandros Kritikos Date: Sat, 19 Jun 2021 16:47:37 +0300 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=94=A7=20Implements=20missing=20confi?= =?UTF-8?q?guration=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dotnet.ruleset | 1 + stylecop.json | 1 + xunit.runner.json | 1 + 3 files changed, 3 insertions(+) create mode 120000 dotnet.ruleset create mode 120000 stylecop.json create mode 120000 xunit.runner.json diff --git a/dotnet.ruleset b/dotnet.ruleset new file mode 120000 index 0000000..acdfd2d --- /dev/null +++ b/dotnet.ruleset @@ -0,0 +1 @@ +.config/dotnet.ruleset \ No newline at end of file diff --git a/stylecop.json b/stylecop.json new file mode 120000 index 0000000..68f7168 --- /dev/null +++ b/stylecop.json @@ -0,0 +1 @@ +.config/stylecop.json \ No newline at end of file diff --git a/xunit.runner.json b/xunit.runner.json new file mode 120000 index 0000000..fc25a87 --- /dev/null +++ b/xunit.runner.json @@ -0,0 +1 @@ +.config/xunit.runner.json \ No newline at end of file From 97d0b50fa700e2766f3b7f2ed5821d9e2ab5ff58 Mon Sep 17 00:00:00 2001 From: Alexandros Kritikos Date: Sat, 19 Jun 2021 16:52:04 +0300 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=9A=9A=20Ensures=20required=20folders?= =?UTF-8?q?=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/.gitkeep | 1 + upload/.gitkeep | 1 + 2 files changed, 2 insertions(+) create mode 120000 packages/.gitkeep create mode 120000 upload/.gitkeep diff --git a/packages/.gitkeep b/packages/.gitkeep new file mode 120000 index 0000000..98ae275 --- /dev/null +++ b/packages/.gitkeep @@ -0,0 +1 @@ +../.config/.gitkeep \ No newline at end of file diff --git a/upload/.gitkeep b/upload/.gitkeep new file mode 120000 index 0000000..98ae275 --- /dev/null +++ b/upload/.gitkeep @@ -0,0 +1 @@ +../.config/.gitkeep \ No newline at end of file