Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run SonarCloud only on pull requests to master #4

Open
wants to merge 13 commits into
base: security-scan
Choose a base branch
from
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

[![Build Status](https://dev.azure.com/AddactTech/SpaceGameGIT/_apis/build/status/ksbhatt1107.mslearn-tailspin-spacegame-web?branchName=master)](https://dev.azure.com/AddactTech/SpaceGameGIT/_build/latest?definitionId=3&branchName=master)

# Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand Down
2 changes: 1 addition & 1 deletion Tailspin.SpaceGame.Web/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<section class="intro">
<div class="container">
<img class="title" src="/images/space-game-title.svg" alt="Space Game">
<p>An example site for learning</p>
<p>Welcome to the official Space Game Site!</p>
</div>
</section>
<section class="download">
Expand Down
64 changes: 64 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
pool:
vmImage: 'MyAgentPool'
demands:
- npm

variables:
buildConfiguration: 'Release'
wwwrootDir: 'Tailspin.SpaceGame.Web/wwwroot'
dotnetSdkVersion: '2.1.505'

steps:
- task: DotNetCoreInstaller@0
displayName: 'Use .NET Core SDK $(dotnetSdkVersion)'
inputs:
version: '$(dotnetSdkVersion)'

- task: Npm@1
displayName: 'Run npm install'
inputs:
verbose: false

- script: './node_modules/.bin/node-sass $(wwwrootDir) --output $(wwwrootDir)'
displayName: 'Compile Sass assets'

- task: gulp@1
displayName: 'Run gulp tasks'

- script: 'echo "$(Build.DefinitionName), $(Build.BuildId), $(Build.BuildNumber)" > buildinfo.txt'
displayName: 'Write build info'
workingDirectory: $(wwwrootDir)

- task: DotNetCoreCLI@2
displayName: 'Restore project dependencies'
inputs:
command: 'restore'
projects: '**/*.csproj'

- task: DotNetCoreCLI@2
displayName: 'Build the project - $(buildConfiguration)'
inputs:
command: 'build'
arguments: '--no-restore --configuration $(buildConfiguration)'
projects: '**/*.csproj'

- task: DotNetCoreCLI@2
displayName: 'Publish the project - $(buildConfiguration)'
inputs:
command: 'publish'
projects: '**/*.csproj'
publishWebProjects: false
arguments: '--no-build --configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)/$(buildConfiguration)'
zipAfterPublish: true

- template: templates/build.yml
parameters:
buildConfiguration: 'Debug'

- template: templates/build.yml
parameters:
buildConfiguration: 'Release'

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
condition: succeeded()
19 changes: 19 additions & 0 deletions templates/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
parameters:
buildConfiguration: 'Release'

steps:
- task: DotNetCoreCLI@2
displayName: 'Build the project - ${{ parameters.buildConfiguration }}'
inputs:
command: 'build'
arguments: '--no-restore --configuration ${{ parameters.buildConfiguration }}'
projects: '**/*.csproj'

- task: DotNetCoreCLI@2
displayName: 'Publish the project - ${{ parameters.buildConfiguration }}'
inputs:
command: 'publish'
projects: '**/*.csproj'
publishWebProjects: false
arguments: '--no-build --configuration ${{ parameters.buildConfiguration }} --output $(Build.ArtifactStagingDirectory)/${{ parameters.BuildConfiguration }}'
zipAfterPublish: true