Skip to content

Commit 3f90c6c

Browse files
committed
Refactor repo layout, simplify build and use NB.GitVersioning
Change the repository layout to group all the source and test files under the src/ directory, then split by platform (windows, osx, and shared) at the next level. Redirect the build output for all the projects to the top-level out/ directory. This means it's easier to do the path-math for signing and building the installers. Use Nerdbank.GitVersioning to provide a unified Semantic Version model for all of our assemblies and installers. Integrate the Mac-native MSAuth helper Xcode workspace into the main .NET build by chaining the build into the main CLI .NET project so that MSBuild shells out to xcodebuild. Also create a wrapper .NET project for the Mac installer script with a two step process: 'layout.sh' for making the installer payload layout, and 'pack.sh' for constructing the pkg file. Building the MSBuild project will call both layout and pack to produce an unsigned pkg file for development purposes. The signed release build can call 'layout.sh' and 'pack.sh' separately (and do signing of binaries in between).
1 parent ee4483d commit 3f90c6c

File tree

160 files changed

+1147
-508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+1147
-508
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
trigger:
2+
- master
3+
4+
variables:
5+
configuration: Release
6+
7+
jobs:
8+
- job: windows
9+
displayName: Windows
10+
pool:
11+
vmImage: vs2017-win2016
12+
steps:
13+
- template: templates/windows/compile.yml
14+
15+
- job: osx
16+
displayName: macOS
17+
pool:
18+
vmImage: macOS 10.13
19+
steps:
20+
- template: templates/osx/compile.yml
21+
- template: templates/osx/pack.unsigned.yml

.azure-pipelines/pull-request.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
trigger: none
2+
3+
4+
variables:
5+
configuration: Release
6+
7+
jobs:
8+
- job: windows
9+
displayName: Windows
10+
pool:
11+
vmImage: vs2017-win2016
12+
steps:
13+
- template: templates/windows/compile.yml
14+
15+
- job: osx
16+
displayName: macOS
17+
pool:
18+
vmImage: macOS 10.13
19+
steps:
20+
- template: templates/osx/compile.yml
21+
- template: templates/osx/pack.unsigned.yml

.azure-pipelines/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
trigger:
2+
- release
3+
4+
variables:
5+
configuration: Release
6+
7+
jobs:
8+
- job: windows
9+
displayName: Windows
10+
pool:
11+
name: VSEng-MicroBuildVS2017
12+
steps:
13+
- template: templates/windows/compile.yml
14+
15+
- job: osx_step1
16+
displayName: macOS (Build & Layout)
17+
pool:
18+
vmImage: macOS 10.13
19+
steps:
20+
- template: templates/osx/compile.yml
21+
- template: templates/osx/pack.signed/step1-layout.yml
22+
23+
- job: osx_step2
24+
displayName: macOS (Sign payload)
25+
dependsOn: osx_step1
26+
condition: succeeded()
27+
pool:
28+
name: VSEng-MicroBuildVS2017
29+
steps:
30+
- template: templates/osx/pack.signed/step2-signpayload.yml
31+
32+
- job: osx_step3
33+
displayName: macOS (Pack)
34+
dependsOn: osx_step2
35+
condition: succeeded()
36+
pool:
37+
vmImage: macOS 10.13
38+
steps:
39+
- template: templates/osx/pack.signed/step3-pack.yml
40+
41+
- job: osx_step4
42+
displayName: macOS (Sign package)
43+
dependsOn: osx_step3
44+
condition: succeeded()
45+
pool:
46+
name: VSEng-MicroBuildVS2017
47+
steps:
48+
- template: templates/osx/pack.signed/step4-signpack.yml
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
steps:
2+
- task: DotNetCoreInstaller@0
3+
displayName: Install .NET Core SDK 2.2.100
4+
inputs:
5+
packageType: sdk
6+
version: '2.2.100'
7+
8+
- task: DotNetCoreCLI@2
9+
displayName: Compile common code and macOS Helpers
10+
inputs:
11+
command: build
12+
projects: 'Git-Credential-Manager.sln'
13+
arguments: '--configuration=Mac$(configuration)'
14+
15+
- task: DotNetCoreCLI@2
16+
displayName: Run common unit tests
17+
inputs:
18+
command: test
19+
projects: 'Git-Credential-Manager.sln'
20+
arguments: '--configuration=Mac$(configuration)'
21+
publishTestResults: true
22+
#testRunTitle: 'Unit tests - common (macOS)' # option not yet available
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
steps:
2+
- script: src/osx/Installer.Mac/layout.sh --configuration='$(configuration)' --output='$(Build.StagingDirectory)/payload'
3+
displayName: Layout installer payload
4+
5+
- task: PublishPipelineArtifact@0
6+
displayName: Upload unsigned payload
7+
inputs:
8+
artifactName: 'tmp.macpayload_unsigned'
9+
targetPath: '$(Build.StagingDirectory)/payload'
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
steps:
2+
- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@2
3+
displayName: Install signing plugin
4+
inputs:
5+
signType: '$(SignType)'
6+
7+
- task: DownloadPipelineArtifact@1
8+
displayName: Download unsigned payload
9+
inputs:
10+
buildType: 'current'
11+
artifactName: 'tmp.macpayload_unsigned'
12+
downloadPath: '$(Build.StagingDirectory)\payload'
13+
14+
# Must use the NuGet & MSBuild toolchain here rather than `dotnet`
15+
# because the signing tasks target the netfx MSBuild runtime only.
16+
- task: NuGetCommand@2
17+
displayName: Restore MicroBuild packages
18+
inputs:
19+
command: restore
20+
restoreSolution: 'src\osx\SignFiles.Mac\SignFiles.Mac.csproj'
21+
22+
- task: MSBuild@1
23+
displayName: Sign payload
24+
inputs:
25+
solution: 'src\osx\SignFiles.Mac\SignFiles.Mac.csproj'
26+
msbuildArguments: '/p:RootDir="$(Build.StagingDirectory)\payload"'
27+
28+
- task: PublishPipelineArtifact@0
29+
displayName: Upload signed payload
30+
inputs:
31+
artifactName: 'tmp.macpayload_signed'
32+
targetPath: '$(Build.StagingDirectory)\payload'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
steps:
2+
- task: DownloadPipelineArtifact@1
3+
displayName: Download signed payload
4+
inputs:
5+
buildType: 'current'
6+
artifactName: 'tmp.macpayload_signed'
7+
downloadPath: '$(Build.StagingDirectory)/payload'
8+
9+
- task: DotNetCoreInstaller@0
10+
displayName: Install .NET Core SDK 2.2.100
11+
inputs:
12+
packageType: sdk
13+
version: '2.2.100'
14+
15+
- script: dotnet tool install --tool-path './.tmp' nbgv
16+
displayName: Install Nerdbank.GitVersioning tool
17+
18+
- script: ./.tmp/nbgv cloud --common-vars
19+
displayName: Set version variables
20+
21+
- script: src/osx/Installer.Mac/pack.sh --payload='$(Build.StagingDirectory)/payload' --version='$(GitBuildVersion)' --output='$(Build.StagingDirectory)/pkg/gcmcore-osx-$(GitBuildVersion).pkg'
22+
displayName: Pack installer payload
23+
24+
- task: PublishPipelineArtifact@0
25+
displayName: Upload unsigned package
26+
inputs:
27+
artifactName: 'tmp.macpkg_unsigned'
28+
targetPath: '$(Build.StagingDirectory)/pkg/gcmcore-osx-$(GitBuildVersion).pkg'
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
steps:
2+
- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@2
3+
displayName: Install signing plugin
4+
inputs:
5+
signType: '$(SignType)'
6+
7+
- task: DownloadPipelineArtifact@1
8+
displayName: Download unsigned package
9+
inputs:
10+
buildType: 'current'
11+
artifactName: 'tmp.macpkg_unsigned'
12+
downloadPath: '$(Build.StagingDirectory)\pkg'
13+
14+
- task: ms-vseng.MicroBuildTasks.7973a23b-33e3-4b00-a7d9-c06d90f8297f.MicroBuildSignMacFiles@1
15+
displayName: Sign package
16+
inputs:
17+
SigningTarget: '$(Build.StagingDirectory)\pkg'
18+
SigningCert: 8003
19+
condition: and(succeeded(), ne(variables['SignType'], 'test'))
20+
21+
- task: DownloadPipelineArtifact@1
22+
displayName: Download signed payload
23+
inputs:
24+
buildType: 'current'
25+
artifactName: 'tmp.macpayload_signed'
26+
downloadPath: '$(Build.StagingDirectory)\payload'
27+
28+
- script: |
29+
xcopy "$(Build.StagingDirectory)\pkg\*.pkg" "$(Build.StagingDirectory)\publish\"
30+
xcopy "$(Build.StagingDirectory)\payload" "$(Build.StagingDirectory)\publish\payload\"
31+
displayName: Prepare final build artifact
32+
33+
- task: PublishPipelineArtifact@0
34+
displayName: Upload signed package and payload
35+
inputs:
36+
artifactName: 'Installer.Mac.Signed'
37+
targetPath: '$(Build.StagingDirectory)\publish'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
steps:
2+
- task: PublishPipelineArtifact@0
3+
displayName: Publish unsigned installer artifacts
4+
inputs:
5+
artifactName: 'Installer.Mac.Unsigned'
6+
targetPath: 'out/osx/Installer.Mac/pkg/$(configuration)'

build/templates/build-and-test.windows.yml renamed to .azure-pipelines/templates/windows/compile.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,17 @@ steps:
2727
displayName: Run common unit tests
2828
inputs:
2929
testAssemblyVer2: |
30-
common\tests\**\*.Tests.dll
31-
!**\obj\**
30+
out\shared\*.Tests\bin\**\*.Tests.dll
3231
configuration: 'Windows$(configuration)'
33-
testRunTitle: 'Common unit tests (Windows)'
34-
continueOnError: true
32+
otherConsoleOptions: '/Framework:.NETCoreApp,Version=2.1'
33+
testRunTitle: 'Unit tests - common (Windows)'
34+
continueOnError: true
3535

3636
- task: VSTest@2
37-
displayName: Run Windows helpers unit tests
37+
displayName: Run helpers unit tests
3838
inputs:
3939
testAssemblyVer2: |
40-
windows\tests\**\*.Tests.dll
41-
!**\obj\**
40+
out\windows\*.Tests\bin\**\*.Tests.dll
4241
configuration: 'Windows$(configuration)'
43-
testRunTitle: 'Windows helpers unit tests'
44-
continueOnError: true
42+
otherConsoleOptions: '/Framework:.NETFramework,Version=v4.6.1'
43+
testRunTitle: 'Unit tests - helpers (Windows)'

0 commit comments

Comments
 (0)