Skip to content

Commit 61889b2

Browse files
authored
Merge pull request #5 from Techsola/ci
Add CI builds and PR validation checks
2 parents 11cf110 + ea52429 commit 61889b2

File tree

5 files changed

+91
-12
lines changed

5 files changed

+91
-12
lines changed

.github/workflows/CI.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request: ~
7+
8+
env:
9+
DOTNET_NOLOGO: true
10+
11+
jobs:
12+
build:
13+
14+
runs-on: windows-2022 # Currently, windows-latest is windows-2019 which doesn't have .NET 6
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Pack and test
20+
run: ./build.ps1
21+
22+
- name: Upload bin artifact
23+
if: always()
24+
uses: actions/upload-artifact@v2
25+
with:
26+
name: Bin
27+
path: artifacts/Bin
28+
29+
- name: Upload logs artifact
30+
if: always()
31+
uses: actions/upload-artifact@v2
32+
with:
33+
name: Logs
34+
path: artifacts/Logs

build.ps1

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
# Options
4+
$configuration = 'Release'
5+
$artifactsDir = Join-Path (Resolve-Path .) 'artifacts'
6+
$binDir = Join-Path $artifactsDir 'Bin'
7+
$testResultsDir = Join-Path $artifactsDir 'Test results'
8+
$logsDir = Join-Path $artifactsDir 'Logs'
9+
10+
$dotnetArgs = @(
11+
'--configuration', $configuration
12+
'/p:ContinuousIntegrationBuild=' + ($env:CI -or $env:TF_BUILD)
13+
)
14+
15+
# Build
16+
dotnet build /bl:$logsDir\build.binlog @dotnetArgs
17+
if ($LastExitCode) { exit 1 }
18+
19+
# Publish
20+
Remove-Item -Recurse -Force $binDir -ErrorAction Ignore
21+
22+
dotnet publish src\TfvcMigrator --no-build --output $binDir /bl:$logsDir\publish.binlog @dotnetArgs
23+
if ($LastExitCode) { exit 1 }
24+
25+
# Test
26+
Remove-Item -Recurse -Force $testResultsDir -ErrorAction Ignore
27+
28+
dotnet test --no-build --logger trx --results-directory $testResultsDir /bl:$logsDir\test.binlog @dotnetArgs
29+
if ($LastExitCode) { exit 1 }

src/TfvcMigrator.Tests/TfvcMigrator.Tests.csproj

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>
55
<Nullable>enable</Nullable>
6+
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
67
</PropertyGroup>
78

89
<ItemGroup>
9-
<PackageReference Include="NSubstitute" Version="4.2.2" />
10-
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.14" />
11-
<PackageReference Include="NUnit" Version="3.13.1" />
12-
<PackageReference Include="NUnit.Analyzers" Version="3.1.0" />
13-
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0-beta.2" />
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
10+
<PackageReference Include="NSubstitute" Version="4.3.0" />
11+
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.15">
12+
<PrivateAssets>all</PrivateAssets>
13+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
</PackageReference>
15+
<PackageReference Include="NUnit" Version="3.13.2" />
16+
<PackageReference Include="NUnit.Analyzers" Version="3.3.0" />
17+
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
1519
<PackageReference Include="Shouldly" Version="4.0.3" />
1620
</ItemGroup>
1721

src/TfvcMigrator/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using System.Text;
1414
using System.Threading;
1515
using System.Threading.Tasks;
16-
using TaskTupleAwaiter;
1716
using TfvcMigrator.Operations;
1817

1918
namespace TfvcMigrator
@@ -38,13 +37,13 @@ public static Task Main(string[] args)
3837
"--root-path-changes",
3938
parseArgument: result => result.Tokens.Select(token => ParseRootPathChange(token.Value)).ToImmutableArray())
4039
{
41-
Argument = { Arity = ArgumentArity.OneOrMore },
40+
Arity = ArgumentArity.OneOrMore,
4241
Description = "Followed by one or more arguments with the format CS1234:$/New/Path. Changes the path that is mapped as the Git repository root to a new path during a specified changeset."
4342
},
4443
new Option<string?>("--pat") { Description = "Optional PAT, required to access TFVC repositories hosted on Azure DevOps Services. If not provided Default Client Credentials will be used, these are only suitable for on-premise TFS/Azure DevOps Server." },
4544
};
4645

47-
command.Handler = CommandHandler.Create(
46+
command.SetHandler(
4847
new Func<Uri, string, string, string?, int?, int?, ImmutableArray<RootPathChange>, string?, Task >(MigrateAsync));
4948

5049
return command.InvokeAsync(args);

src/TfvcMigrator/TfvcMigrator.csproj

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,30 @@
55
<TargetFramework>net6.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
8+
9+
<Product>TFVC Migrator</Product>
10+
<Authors>Technology Solutions Associates</Authors>
11+
<Copyright>Copyright © 2020–2022 Technology Solutions Associates</Copyright>
12+
<AssemblyTitle>TFVC Migrator</AssemblyTitle>
13+
14+
<PublishSingleFile>true</PublishSingleFile>
15+
<SelfContained>false</SelfContained>
16+
<RollForward>Major</RollForward>
17+
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
18+
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
19+
<EmbedAllSources>true</EmbedAllSources>
20+
<DebugType>embedded</DebugType>
821
</PropertyGroup>
922

1023
<ItemGroup>
1124
<None Include="..\.editorconfig" Link=".editorconfig" />
1225
</ItemGroup>
1326

1427
<ItemGroup>
15-
<PackageReference Include="LibGit2Sharp" Version="0.27.0-preview-0096" />
28+
<PackageReference Include="LibGit2Sharp" Version="0.27.0-preview-0175" />
1629
<PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="16.170.0" />
17-
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" />
18-
<PackageReference Include="TaskTupleAwaiter" Version="1.2.3" />
30+
<PackageReference Include="System.CommandLine" Version="2.0.0-beta2.21617.1" />
31+
<PackageReference Include="TaskTupleAwaiter" Version="2.0.0" />
1932
</ItemGroup>
2033

2134
</Project>

0 commit comments

Comments
 (0)