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

Configure Azure Pipelines #8046

Open
wants to merge 112 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
53226a6
Add unit tests
tpetchel Apr 4, 2019
0dc38dc
Support build configurations
tpetchel Apr 5, 2019
c6bf3a2
Add SDK version variable
tpetchel Apr 10, 2019
239f769
Add unit tests
tpetchel Apr 4, 2019
1ae708a
Support build configurations
tpetchel Apr 5, 2019
b7bee9f
Add SDK version variable
tpetchel Apr 10, 2019
5cdd89e
Add ProjectGuid
tpetchel Apr 12, 2019
82cb9dc
Merge branch 'unit-tests' of https://github.com/MicrosoftDocs/mslearn…
tpetchel Apr 12, 2019
e78924e
Change from mode to region
tpetchel Apr 12, 2019
8d5ff35
Simplify configuration
tpetchel Apr 23, 2019
7c01f3c
Run and publish unit tests
tpetchel Apr 23, 2019
eb6ee7a
Run and publish unit tests
tpetchel Apr 23, 2019
3097a58
Run and publish unit tests
tpetchel Apr 23, 2019
79fd0d4
Add code coverage
tpetchel Apr 23, 2019
1660663
Add code coverage
tpetchel Apr 23, 2019
81c6931
Add coverlet.msbuild
tpetchel Apr 24, 2019
41e4387
Add output directory
tpetchel Apr 24, 2019
20fd01a
Remove reportDirectory
tpetchel Apr 24, 2019
0e714ac
opencover
tpetchel Apr 24, 2019
4689da9
opencover,cobertura
tpetchel Apr 24, 2019
83e992d
quotes
tpetchel Apr 24, 2019
2016d43
cobertura only
tpetchel Apr 24, 2019
7bed41c
cobertura2
tpetchel Apr 25, 2019
76cd7eb
Ignore CodeCoverage directory
tpetchel Apr 25, 2019
9013b43
Add coverlet.msbuild package reference
tpetchel Apr 25, 2019
63b0406
Add code coverage
tpetchel Apr 25, 2019
0ef3292
add failing test
tpetchel Apr 25, 2019
94607bf
Run and publish unit tests
tpetchel Apr 5, 2019
04c9a46
Run and publish unit tests
tpetchel Apr 5, 2019
39ce8d6
Run and publish unit tests
tpetchel Apr 5, 2019
7c41b63
Create failing test
tpetchel Apr 10, 2019
bb2a1fc
Add SDK version variable
tpetchel Apr 10, 2019
e83071a
Create failing test
tpetchel Apr 10, 2019
1d6e3cb
Use ExpectedResult
tpetchel Apr 10, 2019
fd81b2b
Ignore CodeCoverage directory
tpetchel Apr 25, 2019
7bcf238
Run and publish unit tests
tpetchel Apr 5, 2019
e733683
Run and publish unit tests
tpetchel Apr 5, 2019
c0103c4
Run and publish unit tests
tpetchel Apr 5, 2019
f6c55d7
Create failing test
tpetchel Apr 10, 2019
6986d06
Create failing test
tpetchel Apr 10, 2019
74624ac
Use ExpectedResult
tpetchel Apr 10, 2019
855d95b
Add failing test
tpetchel Apr 25, 2019
199902e
Update build configuration
tpetchel Apr 25, 2019
218b0a3
Merge branch 'master' into failed-test
tpetchel May 22, 2019
08e261b
Update README.md
tpetchel May 22, 2019
55bbd08
Merge branch 'master' into unit-tests
tpetchel May 22, 2019
b68cd1b
Fix formatting
tpetchel May 31, 2019
9a4b57d
Merge branch 'master' into failed-test
tpetchel Aug 6, 2019
5938c7c
Merge branch 'master' into unit-tests
tpetchel Aug 6, 2019
7f8f9a8
Merge branch 'master' into unit-tests
tpetchel Sep 25, 2019
834cec5
Merge branch 'master' into failed-test
tpetchel Sep 25, 2019
a471be6
Merge branch 'master' into failed-test
tpetchel Oct 14, 2019
798e261
Merge branch 'master' into unit-tests
tpetchel Oct 14, 2019
d220b92
Add trigger
tpetchel Nov 5, 2019
9e3a50a
Add trigger
tpetchel Nov 5, 2019
ca30eb3
update to .NET Core 3.1
jamcneil Jan 14, 2020
f6adcec
update for failed-test branch
jamcneil Jan 14, 2020
af7eaee
update failed-test branch pipeline yml
jamcneil Jan 14, 2020
a0d82bb
Merge pull request #1198 from jamcneil/jm/unit-test-branch-update
tpetchel Jan 21, 2020
5557eb8
Merge pull request #1199 from jamcneil/jm/failed-test-update
tpetchel Jan 21, 2020
9430451
Merge branch 'master' into unit-tests
tpetchel Jun 1, 2020
7947ec4
Bump coverlet.msbuild to 2.9.0
tpetchel Jun 1, 2020
2d00eea
Bump Ubuntu, .NET Core, and .NET Core installer versions
tpetchel Jun 1, 2020
849dbde
Merge branch 'master' into failed-test
tpetchel Jun 2, 2020
394f1b0
Remove reference to coverlet.msbuild
tpetchel Jun 2, 2020
fa320fb
Bump Ubuntu, .NET Core versions; use local manifest
tpetchel Jun 2, 2020
b8cb445
Remove reference to coverlet.msbuild
tpetchel Jun 2, 2020
afeea19
Merge pull request #3491 from MicrosoftDocs/tp/unit-tests-patch1
tpetchel Jun 3, 2020
3633f42
Merge pull request #3490 from MicrosoftDocs/tp/failed-test-patch1
tpetchel Jun 3, 2020
d7cdf8f
Merge branch 'main' into unit-tests-21q3r
tpetchel May 26, 2021
e7c59fc
Bump TargetFramework
tpetchel May 26, 2021
812420e
Migrate from Newtonsoft.Json to System.Text.Json
tpetchel May 26, 2021
7d6b355
Bump package versions
tpetchel May 26, 2021
cb71776
Bump .NET, Ubuntu versions
tpetchel May 26, 2021
a5bd0ed
Merge branch 'main' into failed-test
tpetchel May 26, 2021
9caaaec
Bump .NET, Ubuntu versions
tpetchel May 26, 2021
13d6d75
Remove "Core"
tpetchel May 26, 2021
0c1b35c
Migrate from Newtonsoft.Json to System.Text.Json
tpetchel May 26, 2021
48cbae9
Bump package versions
tpetchel May 26, 2021
8185d99
Merge pull request #4975 from MicrosoftDocs/failed-test-21q3r
tpetchel Jun 9, 2021
f6d1803
Merge pull request #4974 from MicrosoftDocs/unit-tests-21q3r
tpetchel Jun 9, 2021
c381bc1
Float the dotnetSdkVersion
tpetchel Jun 21, 2021
0cb5b08
Float the dotnetSdkVersion
tpetchel Jun 21, 2021
ae2c891
Merge branch 'main' into failed-test
tpetchel Dec 10, 2021
2a32637
Merge branch 'main' into failed-test
tpetchel Dec 10, 2021
6e752ab
Simplify LINQ query
tpetchel Dec 10, 2021
26ea721
Merge branch 'main' into unit-tests
tpetchel Dec 10, 2021
59415db
Simplify LINQ query
tpetchel Dec 28, 2021
3834acc
Merge branch 'main' into failed-test
tpetchel Jun 3, 2022
8b700ee
Merge branch 'main' into unit-tests
tpetchel Jun 3, 2022
1b4869e
Merge branch 'main' into failed-test
tpetchel Jun 3, 2022
2de851f
Merge branch 'main' into unit-tests
tpetchel Jun 3, 2022
acd4c47
Bump dotnet 5.x to 6.x in Test project and Pipeline (#6458)
Nighteyez07 Jul 25, 2022
211fa16
Bump pipeline and unit test project from dotnet 5.x to 6.x (#6459)
Nighteyez07 Jul 25, 2022
882875e
Custom - Set up CI with Azure Pipelines
AlexAndriamahaleo Oct 23, 2024
3635363
Remove update yaml file
Oct 25, 2024
69657f9
Add build tasks
Oct 25, 2024
d1c6e72
Add the build configuration
Oct 25, 2024
a992184
Improve the text at the top of the home page
Oct 25, 2024
ace43b1
Add build badge
Oct 25, 2024
8a6d7b5
Fix typing error on the home page
Oct 25, 2024
63b0fa8
Merge pull request #1 from AlexAndriamahaleo/bugfix/home-page-typo
AlexAndriamahaleo Oct 25, 2024
c9ada8c
Run and publish unit tests
Oct 25, 2024
a823e44
Add coverlet.msbuild package
Oct 25, 2024
15b2435
Add code coverage
Oct 25, 2024
51cb69d
Merge branch 'unit-tests'
Oct 25, 2024
b1c7d5e
Merge branch 'code-coverage'
Oct 25, 2024
2311091
Configure code coverage tests
Oct 25, 2024
772ed20
Return correct number of items
Oct 25, 2024
3442bb1
Update dotnet-tools
Oct 25, 2024
ac400c9
Merge branch 'failed-test'
Oct 25, 2024
9d5e79c
update for package pipeline
Oct 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-reportgenerator-globaltool": {
"version": "5.3.11",
"commands": [
"reportgenerator"
],
"rollForward": false
}
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ _TeamCity*
*.coverage
*.coveragexml

[Cc]ode[Cc]overage/

# NCrunch
_NCrunch_*
.*crunch*.local.xml
Expand Down
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/FormationOrsysOctobre2024/Space%20Game%20Alex%20-%20web/_apis/build/status%2FAlexAndriamahaleo.mslearn-tailspin-spacegame-web?branchName=main)](https://dev.azure.com/FormationOrsysOctobre2024/Space%20Game%20Alex%20-%20web/_build/latest?definitionId=85&branchName=main)

# Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using NUnit.Framework;
using TailSpin.SpaceGame.Web;
using TailSpin.SpaceGame.Web.Models;

namespace Tests
{
public class DocumentDBRepository_GetItemsAsyncShould
{
private IDocumentDBRepository<Score> _scoreRepository;

[SetUp]
public void Setup()
{
using (Stream scoresData = typeof(IDocumentDBRepository<Score>)
.Assembly
.GetManifestResourceStream("Tailspin.SpaceGame.Web.SampleData.scores.json"))
{
_scoreRepository = new LocalDocumentDBRepository<Score>(scoresData);
}
}

[TestCase("Milky Way")]
[TestCase("Andromeda")]
[TestCase("Pinwheel")]
[TestCase("NGC 1300")]
[TestCase("Messier 82")]
public void FetchOnlyRequestedGameRegion(string gameRegion)
{
const int PAGE = 0; // take the first page of results
const int MAX_RESULTS = 10; // sample up to 10 results

// Form the query predicate.
// This expression selects all scores for the provided game region.
Func<Score, bool> queryPredicate = score => (score.GameRegion == gameRegion);

// Fetch the scores.
Task<IEnumerable<Score>> scoresTask = _scoreRepository.GetItemsAsync(
queryPredicate, // the predicate defined above
score => 1, // we don't care about the order
PAGE,
MAX_RESULTS
);
IEnumerable<Score> scores = scoresTask.Result;

// Verify that each score's game region matches the provided game region.
Assert.That(scores, Is.All.Matches<Score>(score => score.GameRegion == gameRegion));
}

[TestCase(0, ExpectedResult = 0)]
[TestCase(1, ExpectedResult = 1)]
[TestCase(10, ExpectedResult = 10)]
public int ReturnRequestedCount(int count)
{
const int PAGE = 0; // take the first page of results

// Fetch the scores.
Task<IEnumerable<Score>> scoresTask = _scoreRepository.GetItemsAsync(
score => true, // return all scores
score => 1, // we don't care about the order
PAGE,
count // fetch this number of results
);
IEnumerable<Score> scores = scoresTask.Result;

// Verify that we received the specified number of items.
return scores.Count();
}
}
}
23 changes: 23 additions & 0 deletions Tailspin.SpaceGame.Web.Tests/Tailspin.SpaceGame.Web.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<ProjectGuid>{773BA444-0D67-4F37-8762-17E108CCD5F5}</ProjectGuid>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Tailspin.SpaceGame.Web\Tailspin.SpaceGame.Web.csproj" />
</ItemGroup>

</Project>
8 changes: 7 additions & 1 deletion Tailspin.SpaceGame.Web.sln
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tailspin.SpaceGame.Web", "Tailspin.SpaceGame.Web\Tailspin.SpaceGame.Web.csproj", "{A0C4E31E-AC75-4F39-9F59-0AA19D9B8F46}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tailspin.SpaceGame.Web.Tests", "Tailspin.SpaceGame.Web.Tests\Tailspin.SpaceGame.Web.Tests.csproj", "{773BA444-0D67-4F37-8762-17E108CCD5F5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -13,5 +15,9 @@ Global
{A0C4E31E-AC75-4F39-9F59-0AA19D9B8F46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0C4E31E-AC75-4F39-9F59-0AA19D9B8F46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0C4E31E-AC75-4F39-9F59-0AA19D9B8F46}.Release|Any CPU.Build.0 = Release|Any CPU
{773BA444-0D67-4F37-8762-17E108CCD5F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{773BA444-0D67-4F37-8762-17E108CCD5F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{773BA444-0D67-4F37-8762-17E108CCD5F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{773BA444-0D67-4F37-8762-17E108CCD5F5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions Tailspin.SpaceGame.Web/LocalDocumentDBRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public LocalDocumentDBRepository(string fileName)
_items = JsonSerializer.Deserialize<List<T>>(File.ReadAllText(fileName));
}

public LocalDocumentDBRepository(Stream stream)
{
// Serialize the items from the provided JSON document.
_items = JsonSerializer.Deserialize<List<T>>(new StreamReader(stream).ReadToEnd());
}

/// <summary>
/// Retrieves the item from the store with the given identifier.
/// </summary>
Expand Down
22 changes: 22 additions & 0 deletions Tailspin.SpaceGame.Web/Tailspin.SpaceGame.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,26 @@
<ItemGroup>
<Folder Include="wwwroot\images\avatars\" />
</ItemGroup>
<ItemGroup>
<Content Remove="SampleData\profiles.json" />
<Content Remove="SampleData\scores.json" />
<Content Remove="SampleData\profiles.json" />
<Content Remove="SampleData\scores.json" />
</ItemGroup>
<ItemGroup>
<Content Update="SampleData\profiles.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="SampleData\scores.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="SampleData\profiles.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</EmbeddedResource>
<EmbeddedResource Include="SampleData\scores.json">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</EmbeddedResource>
</ItemGroup>
</Project>
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
109 changes: 106 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,106 @@
pool: MyAgentPool
steps:
- bash: echo hello world
trigger:
- '*'

pool:
vmImage: 'ubuntu-20.04'
demands:
- npm

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

steps:
- task: UseDotNet@2
displayName: 'Use .NET 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: 'Install .NET Core tools from local manifest'
inputs:
command: custom
custom: tool
arguments: 'restore'

- task: DotNetCoreCLI@2
displayName: 'Run unit tests - $(buildConfiguration)'
inputs:
command: 'test'
arguments: '--no-build --configuration $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(Build.SourcesDirectory)/TestResults/Coverage/'
publishTestResults: true
projects: '**/*.Tests.csproj'

- task: DotNetCoreCLI@2
displayName: 'Create code coverage report'
inputs:
command: custom
custom: tool
arguments: 'run reportgenerator -reports:$(Build.SourcesDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:HtmlInline_AzurePipelines'

- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage report'
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(Build.SourcesDirectory)/**/coverage.cobertura.xml'

- task: DotNetCoreCLI@2
displayName: 'Pack the project - $(buildConfiguration)'
inputs:
command: 'pack'
projects: '**/*.csproj'
arguments: '--no-build --configuration $(buildConfiguration)'
versioningScheme: byPrereleaseNumber
majorVersion: '1'
minorVersion: '0'
patchVersion: '0'

- task: NuGetCommand@2
displayName: 'Publish NuGet package'
inputs:
command: push
feedPublish: '$(System.TeamProject)/Tailspin.SpaceGame.Web.Models'
allowPackageConflicts: true
condition: succeeded()

- 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

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
condition: succeeded()