Skip to content

Commit

Permalink
feat: #428 add azure devops pipeline to template
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Sep 11, 2024
1 parent 7254173 commit 66a483f
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@
"displayName": "Azure Application Insights",
"description": "Include configuration and integrations for Application Insights, both front-end and back-end.",
"$coalesceLink": "https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview"
},
"AzurePipelines": {
"type": "parameter",
"datatype": "bool",
"displayName": "CI: Azure Pipelines",
"description": "Include an azure-pipelines.yml build template. For deployments, a release pipeline is recommended (which don't support YAML config files).",
"$coalesceLink": "https://learn.microsoft.com/en-us/azure/devops/pipelines/create-first-pipeline?view=azure-devops&tabs=net%2Cbrowser"
}
},
"sources": [
Expand Down Expand Up @@ -157,6 +164,10 @@
{
"condition": "!ExampleModel",
"exclude": ["**/WidgetEdit.vue", "**/WidgetEdit.spec.ts"]
},
{
"condition": "!AzurePipelines",
"exclude": ["**/azure-pipelines.yml"]
}
]
}
Expand Down
85 changes: 85 additions & 0 deletions templates/Coalesce.Vue.Template/content/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
trigger:
- main

pool:
vmImage: "ubuntu-latest"

variables:
webDir: $(Build.Repository.LocalPath)/Coalesce.Starter.Vue.Web

steps:
- checkout: self
lfs: true

- task: UseDotNet@2
inputs:
packageType: "sdk"
version: "8.x"
includePreviewVersions: true
performMultiLevelLookup: true

- task: UseNode@1
inputs:
version: "22.x"

- task: Npm@1
displayName: npm ci
inputs:
command: "ci"
workingDir: $(webDir)

- task: DotNetCoreCLI@2
inputs:
command: "restore"
projects: "**/*.sln"
displayName: Restore Nuget packages

- task: PowerShell@2
inputs:
targetType: "inline"
script: |
dotnet coalesce --what-if --verify
failOnStderr: true
workingDirectory: "$(webDir)"
displayName: Check Coalesce has run

- task: Npm@1
displayName: npm run lint
inputs:
command: "custom"
workingDir: $(webDir)
customCommand: "run lint"

- task: Npm@1
displayName: npm run build
inputs:
command: "custom"
workingDir: $(webDir)
customCommand: "run build"

- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
command: "build"
projects: "**/*.sln"
arguments: "--configuration Release --no-restore --no-incremental -p:CodeAnalysisTreatWarningsAsErrors=true -p:TreatWarningsAsErrors=true"

- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: "test"
projects: "**/*.sln"
arguments: "--no-build --configuration Release"

- task: DotNetCoreCLI@2
displayName: dotnet publish
inputs:
command: "publish"
publishWebProjects: true
arguments: --no-build --configuration Release -o $(Build.ArtifactStagingDirectory)

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: "$(Build.ArtifactStagingDirectory)"
ArtifactName: "drop"
publishLocation: "Container"

0 comments on commit 66a483f

Please sign in to comment.