Skip to content

Commit daa15c8

Browse files
authored
Merge pull request #636 from buchwasa/m1
Initial support for Apple Silicon
2 parents dc68962 + 3df4635 commit daa15c8

File tree

15 files changed

+84
-32
lines changed

15 files changed

+84
-32
lines changed

.github/workflows/release.yml

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
osx-build:
1313
name: Build macOS
1414
runs-on: macos-latest
15+
strategy:
16+
matrix:
17+
runtime: [ osx-x64, osx-arm64 ]
1518
steps:
1619
- uses: actions/checkout@v3
1720
with:
@@ -27,15 +30,19 @@ jobs:
2730

2831
- name: Build
2932
run: |
30-
dotnet build --configuration=MacRelease
33+
dotnet build src/osx/Installer.Mac/*.csproj \
34+
--configuration=MacRelease --no-self-contained \
35+
--runtime=${{ matrix.runtime }}
3136
3237
- name: Run macOS unit tests
3338
run: |
3439
dotnet test --configuration=MacRelease
3540
3641
- name: Lay out payload and symbols
3742
run: |
38-
src/osx/Installer.Mac/layout.sh --configuration=MacRelease --output=payload --symbol-output=symbols
43+
src/osx/Installer.Mac/layout.sh \
44+
--configuration=MacRelease --output=payload \
45+
--symbol-output=symbols --runtime=${{ matrix.runtime }}
3946
4047
- name: Create keychain
4148
env:
@@ -58,7 +65,7 @@ jobs:
5865
- name: Upload macOS artifacts
5966
uses: actions/upload-artifact@v3
6067
with:
61-
name: tmp.osx-build
68+
name: tmp.${{ matrix.runtime }}-build
6269
path: |
6370
payload
6471
symbols
@@ -67,6 +74,9 @@ jobs:
6774
name: Sign macOS payload
6875
# ESRP service requires signing to run on Windows
6976
runs-on: windows-latest
77+
strategy:
78+
matrix:
79+
runtime: [ osx-x64, osx-arm64 ]
7080
needs: osx-build
7181
steps:
7282
- name: Check out repository
@@ -75,7 +85,7 @@ jobs:
7585
- name: Download payload
7686
uses: actions/download-artifact@v3
7787
with:
78-
name: tmp.osx-build
88+
name: tmp.${{ matrix.runtime }}-build
7989

8090
- name: Zip unsigned payload
8191
shell: pwsh
@@ -109,7 +119,9 @@ jobs:
109119
APPLE_KEY_CODE: ${{ secrets.APPLE_KEY_CODE }}
110120
APPLE_SIGNING_OP_CODE: ${{ secrets.APPLE_SIGNING_OPERATION_CODE }}
111121
run: |
112-
python .github\run_esrp_signing.py payload $env:APPLE_KEY_CODE $env:APPLE_SIGNING_OP_CODE --params 'Hardening' '--options=runtime'
122+
python .github\run_esrp_signing.py payload `
123+
$env:APPLE_KEY_CODE $env:APPLE_SIGNING_OP_CODE `
124+
--params 'Hardening' '--options=runtime'
113125
114126
- name: Unzip signed payload
115127
shell: pwsh
@@ -120,13 +132,16 @@ jobs:
120132
- name: Upload signed payload
121133
uses: actions/upload-artifact@v3
122134
with:
123-
name: osx-payload-sign
135+
name: ${{ matrix.runtime }}-payload-sign
124136
path: |
125137
signed
126138
127139
osx-pack:
128140
name: Package macOS payload
129141
runs-on: macos-latest
142+
strategy:
143+
matrix:
144+
runtime: [ osx-x64, osx-arm64 ]
130145
needs: osx-payload-sign
131146
steps:
132147
- name: Check out repository
@@ -147,27 +162,34 @@ jobs:
147162
- name: Download signed payload
148163
uses: actions/download-artifact@v3
149164
with:
150-
name: osx-payload-sign
165+
name: ${{ matrix.runtime }}-payload-sign
151166

152167
- name: Create component package
153168
run: |
154-
src/osx/Installer.Mac/pack.sh --payload=payload --version=$GitBuildVersionSimple --output=components/com.microsoft.gitcredentialmanager.component.pkg
169+
src/osx/Installer.Mac/pack.sh --payload=payload \
170+
--version=$GitBuildVersionSimple \
171+
--output=components/com.microsoft.gitcredentialmanager.component.pkg
155172
156173
- name: Create product archive
157174
run: |
158-
src/osx/Installer.Mac/dist.sh --package-path=components --version=$GitBuildVersionSimple --output=pkg/gcm-osx-x64-$GitBuildVersionSimple.pkg || exit 1
175+
src/osx/Installer.Mac/dist.sh --package-path=components \
176+
--version=$GitBuildVersionSimple --runtime=${{ matrix.runtime }} \
177+
--output=pkg/gcm-${{ matrix.runtime }}-$GitBuildVersionSimple.pkg || exit 1
159178
160179
- name: Upload package
161180
uses: actions/upload-artifact@v3
162181
with:
163-
name: tmp.osx-pack
182+
name: tmp.${{ matrix.runtime }}-pack
164183
path: |
165184
pkg
166185
167186
osx-sign:
168187
name: Sign and notarize macOS package
169188
# ESRP service requires signing to run on Windows
170189
runs-on: windows-latest
190+
strategy:
191+
matrix:
192+
runtime: [ osx-x64, osx-arm64 ]
171193
needs: osx-pack
172194
steps:
173195
- name: Check out repository
@@ -176,7 +198,7 @@ jobs:
176198
- name: Download unsigned package
177199
uses: actions/download-artifact@v3
178200
with:
179-
name: tmp.osx-pack
201+
name: tmp.${{ matrix.runtime }}-pack
180202
path: pkg
181203

182204
- name: Zip unsigned package
@@ -236,7 +258,7 @@ jobs:
236258
- name: Publish signed package
237259
uses: actions/upload-artifact@v3
238260
with:
239-
name: osx-sign
261+
name: ${{ matrix.runtime }}-sign
240262
path: signed/*.pkg
241263

242264
# ================================
@@ -468,8 +490,12 @@ jobs:
468490
- name: Archive macOS payload and symbols
469491
run: |
470492
mkdir osx-payload-and-symbols
471-
tar -C osx-payload-sign -czf osx-payload-and-symbols/gcm-osx-x64-$GitBuildVersionSimple.tar.gz .
472-
tar -C tmp.osx-build/symbols -czf osx-payload-and-symbols/gcm-osx-x64-$GitBuildVersionSimple-symbols.tar.gz .
493+
494+
tar -C osx-x64-payload-sign -czf osx-payload-and-symbols/gcm-osx-x64-$GitBuildVersionSimple.tar.gz .
495+
tar -C tmp.osx-x64-build/symbols -czf osx-payload-and-symbols/gcm-osx-x64-$GitBuildVersionSimple-symbols.tar.gz .
496+
497+
tar -C osx-arm64-payload-sign -czf osx-payload-and-symbols/gcm-osx-arm64-$GitBuildVersionSimple.tar.gz .
498+
tar -C tmp.osx-arm64-build/symbols -czf osx-payload-and-symbols/gcm-osx-arm64-$GitBuildVersionSimple-symbols.tar.gz .
473499
474500
- name: Archive Windows payload and symbols
475501
shell: pwsh
@@ -527,7 +553,8 @@ jobs:
527553
uploadDirectoryToRelease('win-x86-payload-and-symbols'),
528554
529555
// Upload macOS artifacts
530-
uploadDirectoryToRelease('osx-sign'),
556+
uploadDirectoryToRelease('osx-x64-sign'),
557+
uploadDirectoryToRelease('osx-arm64-sign'),
531558
uploadDirectoryToRelease('osx-payload-and-symbols'),
532559
533560
// Upload Linux artifacts

src/osx/Installer.Mac/Installer.Mac.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
2222

2323
<Target Name="CoreCompile" DependsOnTargets="GetBuildVersion" Condition="'$(OSPlatform)'=='osx'">
24-
<Message Text="$(MSBuildProjectDirectory)\build.sh --configuration='$(Configuration)' --version='$(BuildVersionSimple)'" Importance="High" />
25-
<Exec Command="$(MSBuildProjectDirectory)\build.sh --configuration='$(Configuration)' --version='$(BuildVersionSimple)'" />
24+
<Message Text="$(MSBuildProjectDirectory)\build.sh --configuration='$(Configuration)' --version='$(BuildVersionSimple)' --runtime='$(RuntimeIdentifier)'" Importance="High" />
25+
<Exec Command="$(MSBuildProjectDirectory)\build.sh --configuration='$(Configuration)' --version='$(BuildVersionSimple)' --runtime='$(RuntimeIdentifier)'" />
2626
</Target>
2727

2828
<Target Name="CoreClean">

src/osx/Installer.Mac/build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ case "$i" in
2222
CONFIGURATION="${i#*=}"
2323
shift # past argument=value
2424
;;
25+
--runtime=*)
26+
RUNTIME="${i#*=}"
27+
shift
28+
;;
2529
--version=*)
2630
VERSION="${i#*=}"
2731
shift # past argument=value
@@ -45,7 +49,7 @@ COMPONENTOUT="$COMPONENTDIR/com.microsoft.gitcredentialmanager.component.pkg"
4549
DISTOUT="$OUTDIR/gcm-osx-x64-$VERSION.pkg"
4650

4751
# Layout and pack
48-
"$INSTALLER_SRC/layout.sh" --configuration="$CONFIGURATION" --output="$PAYLOAD" || exit 1
52+
"$INSTALLER_SRC/layout.sh" --configuration="$CONFIGURATION" --output="$PAYLOAD" --runtime="$RUNTIME" || exit 1
4953
"$INSTALLER_SRC/pack.sh" --payload="$PAYLOAD" --version="$VERSION" --output="$COMPONENTOUT" || exit 1
5054
"$INSTALLER_SRC/dist.sh" --package-path="$COMPONENTDIR" --version="$VERSION" --output="$DISTOUT" || exit 1
5155

src/osx/Installer.Mac/distribution.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<installer-gui-script minSpecVersion="1">
33
<title>Git Credential Manager</title>
44
<background file="background.png" mime-type="image/png" alignment="bottomleft" scaling="tofit" />
5-
<options customize="never" />
5+
<options customize="never" hostArchitectures="x86_64,arm64" />
66
<welcome file="welcome.html" mime-type="text/html" />
77
<conclusion file="conclusion.html" mime-type="text/html" />
88
<license file="LICENSE" />

src/osx/Installer.Mac/layout.sh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ GITLAB_UI_SRC="$SRC/shared/GitLab.UI.Avalonia"
2727

2828
# Build parameters
2929
FRAMEWORK=net6.0
30-
RUNTIME=osx-x64
3130

3231
# Parse script arguments
3332
for i in "$@"
@@ -41,6 +40,10 @@ case "$i" in
4140
PAYLOAD="${i#*=}"
4241
shift # past argument=value
4342
;;
43+
--runtime=*)
44+
RUNTIME="${i#*=}"
45+
shift # past argument=value
46+
;;
4447
--symbol-output=*)
4548
SYMBOLOUT="${i#*=}"
4649
;;
@@ -50,6 +53,24 @@ case "$i" in
5053
esac
5154
done
5255

56+
# Determine a runtime if one was not provided
57+
if [ -z "$RUNTIME" ]; then
58+
TEST_ARCH=`uname -m`
59+
case $TEST_ARCH in
60+
"x86_64")
61+
RUNTIME="osx-x64"
62+
;;
63+
"arm64")
64+
RUNTIME="osx-arm64"
65+
;;
66+
*)
67+
die "Unknown architecture '$TEST_ARCH'"
68+
;;
69+
esac
70+
fi
71+
72+
echo "Building for runtime '$RUNTIME'"
73+
5374
# Perform pre-execution checks
5475
CONFIGURATION="${CONFIGURATION:=Debug}"
5576
if [ -z "$PAYLOAD" ]; then

src/shared/Atlassian.Bitbucket.Tests/Atlassian.Bitbucket.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1313
<PrivateAssets>all</PrivateAssets>
1414
</PackageReference>
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
1616
<PackageReference Include="ReportGenerator" Version="4.8.13" />
1717
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
1818
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />

src/shared/Atlassian.Bitbucket.UI.Avalonia/Atlassian.Bitbucket.UI.Avalonia.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
55
<TargetFramework>net6.0</TargetFramework>
6-
<RuntimeIdentifiers>osx-x64;linux-x64</RuntimeIdentifiers>
6+
<RuntimeIdentifiers>osx-x64;linux-x64;osx-arm64</RuntimeIdentifiers>
77
<RootNamespace>Atlassian.Bitbucket.UI</RootNamespace>
88
<AssemblyName>Atlassian.Bitbucket.UI</AssemblyName>
99
</PropertyGroup>

src/shared/Core.Tests/Core.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
<PrivateAssets>all</PrivateAssets>
1515
</PackageReference>
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
1717
<PackageReference Include="ReportGenerator" Version="4.8.13" />
1818
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
1919
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />

src/shared/Core.UI.Avalonia/Core.UI.Avalonia.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Avalonia" Version="0.10.7" />
15-
<PackageReference Include="Avalonia.Desktop" Version="0.10.7" />
16-
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.7" />
14+
<PackageReference Include="Avalonia" Version="0.10.13" />
15+
<PackageReference Include="Avalonia.Desktop" Version="0.10.13" />
16+
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.13" />
1717
</ItemGroup>
1818

1919
<ItemGroup>

src/shared/Git-Credential-Manager/Git-Credential-Manager.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<OutputType>Exe</OutputType>
55
<TargetFrameworks>net6.0</TargetFrameworks>
66
<TargetFrameworks Condition="'$(OSPlatform)'=='windows'">net472;net6.0</TargetFrameworks>
7-
<RuntimeIdentifiers>win-x86;osx-x64;linux-x64</RuntimeIdentifiers>
7+
<RuntimeIdentifiers>win-x86;osx-x64;linux-x64;osx-arm64</RuntimeIdentifiers>
88
<PlatformTarget Condition="'$(OSPlatform)'=='windows'">x86</PlatformTarget>
99
<AssemblyName>git-credential-manager-core</AssemblyName>
1010
<RootNamespace>GitCredentialManager</RootNamespace>

0 commit comments

Comments
 (0)