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

Build-pipeline #8069

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
37 changes: 37 additions & 0 deletions azure-pipelines-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# ASP.NET Core Build and Test Pipeline
# Adjusted for macOS and self-hosted agents in the 'learn' pool.

trigger:
- main

pool:
name: learn

variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'

steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '6.0.428'

- script: dotnet restore $(solution)
displayName: 'Restore NuGet Packages'

- script: dotnet build $(solution) --configuration $(buildConfiguration)
displayName: 'Build Solution'

- script: dotnet test $(solution) --configuration $(buildConfiguration)
displayName: 'Run Tests'

- script: dotnet publish $(solution) --configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)
displayName: 'Publish Solution'

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
66 changes: 64 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,65 @@
pool: MyAgentPool
trigger:
- '*'

pool:
name: 'learn'

steps:
- bash: echo hello world
# Step 1: Ensure the repository is cloned
- checkout: self
displayName: 'Checkout repository'

# Step 2: Debug repository and working directory
- script: pwd
displayName: 'Show current working directory'

- script: ls -R
displayName: 'List all files in the repository'

- script: |
if [ -f Tailspin.SpaceGame.Web/Tailspin.SpaceGame.Web.sln ]; then
echo "Solution file found at Tailspin.SpaceGame.Web/Tailspin.SpaceGame.Web.sln"
else
echo "Solution file not found!"
exit 1
fi
displayName: 'Check if solution file exists'

# Step 3: Set up .NET SDK
- task: UseDotNet@2
displayName: 'Use .NET SDK 6.x'
inputs:
version: '6.x'

# Step 4: Restore project dependencies
- task: DotNetCoreCLI@2
displayName: 'Restore project dependencies'
inputs:
command: 'restore'
projects: 'Tailspin.SpaceGame.Web/Tailspin.SpaceGame.Web.sln'

# Step 5: Build the project in Release mode
- task: DotNetCoreCLI@2
displayName: 'Build the project - Release'
inputs:
command: 'build'
arguments: '--no-restore --configuration Release'
projects: 'Tailspin.SpaceGame.Web/Tailspin.SpaceGame.Web.sln'

# Step 6: Publish the project
- task: DotNetCoreCLI@2
displayName: 'Publish the project - Release'
inputs:
command: 'publish'
projects: 'Tailspin.SpaceGame.Web/Tailspin.SpaceGame.Web.sln'
publishWebProjects: false
arguments: '--no-build --configuration Release --output $(Build.ArtifactStagingDirectory)/Release'
zipAfterPublish: true

# Step 7: Publish artifacts
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Release'
ArtifactName: 'drop'
publishLocation: 'Container'
Loading