diff --git a/.azure-pipelines/templates/linux/compile.yml b/.azure-pipelines/templates/linux/compile.yml index 032ef5ca4..bd56e9810 100644 --- a/.azure-pipelines/templates/linux/compile.yml +++ b/.azure-pipelines/templates/linux/compile.yml @@ -6,11 +6,18 @@ steps: version: 3.1.x - task: DotNetCoreCLI@2 - displayName: Compile common code + displayName: Compile common code (amd64) inputs: command: build projects: 'Git-Credential-Manager.sln' - arguments: '--configuration=Linux$(configuration)' + arguments: '--configuration=Linux$(configuration) -r linux-x64' + + - task: DotNetCoreCLI@2 + displayName: Compile common code (arm64) + inputs: + command: build + projects: 'Git-Credential-Manager.sln' + arguments: '--configuration=Linux$(configuration) -r linux-arm64' - task: DotNetCoreCLI@2 displayName: Run common unit tests diff --git a/.github/workflows/build-installers.yml b/.github/workflows/build-installers.yml index 71336f45a..cdf160351 100644 --- a/.github/workflows/build-installers.yml +++ b/.github/workflows/build-installers.yml @@ -26,7 +26,9 @@ jobs: run: dotnet restore --force - name: Build Linux Payloads - run: dotnet build -c Release src/linux/Packaging.Linux/Packaging.Linux.csproj + run: | + dotnet build -c Release -r linux-x64 src/linux/Packaging.Linux/Packaging.Linux.csproj + dotnet build -c Release -r linux-arm64 src/linux/Packaging.Linux/Packaging.Linux.csproj - name: Upload Installers uses: actions/upload-artifact@v2 diff --git a/.github/workflows/build-signed-deb.yml b/.github/workflows/build-signed-deb.yml index b3dba6a28..3e61266d2 100644 --- a/.github/workflows/build-signed-deb.yml +++ b/.github/workflows/build-signed-deb.yml @@ -23,7 +23,9 @@ jobs: run: dotnet restore --force - name: Build Linux Payloads - run: dotnet build -c Release src/linux/Packaging.Linux/Packaging.Linux.csproj + run: | + dotnet build -c Release -r linux-x64 src/linux/Packaging.Linux/Packaging.Linux.csproj + dotnet build -c Release -r linux-arm64 src/linux/Packaging.Linux/Packaging.Linux.csproj - name: Upload Installers uses: actions/upload-artifact@v2 @@ -90,4 +92,4 @@ jobs: with: name: DebianInstallerSigned path: | - Signed/*.deb \ No newline at end of file + Signed/*.deb diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index bffee0884..b13ae9732 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -35,7 +35,9 @@ jobs: - name: Build Linux if: contains(matrix.os, 'ubuntu') - run: dotnet build --configuration LinuxRelease + run: | + dotnet build --configuration LinuxRelease -r linux-x64 + dotnet build --configuration LinuxRelease -r linux-arm64 - name: Build macOS if: contains(matrix.os, 'macos') diff --git a/docs/development.md b/docs/development.md index 6db8a219a..0aedc1753 100644 --- a/docs/development.md +++ b/docs/development.md @@ -49,6 +49,12 @@ To build from the command line, run: dotnet build -c LinuxDebug ``` +If you want to build for a specific architecture, you can provide `linux-x64` or `linux-arm64` as the runtime: + +```shell +dotnet build -c LinuxDebug -r linux-arm64 +``` + You can find a copy of the Debian package (.deb) file in `out/linux/Packaging.Linux/deb/Debug`. The flat binaries can also be found in `out/linux/Packaging.Linux/payload/Debug`. diff --git a/src/linux/Packaging.Linux/Packaging.Linux.csproj b/src/linux/Packaging.Linux/Packaging.Linux.csproj index 3eeb3f45f..6a6e0d779 100644 --- a/src/linux/Packaging.Linux/Packaging.Linux.csproj +++ b/src/linux/Packaging.Linux/Packaging.Linux.csproj @@ -19,8 +19,8 @@ - - + + diff --git a/src/linux/Packaging.Linux/build.sh b/src/linux/Packaging.Linux/build.sh index 05a2b9d76..77270630d 100755 --- a/src/linux/Packaging.Linux/build.sh +++ b/src/linux/Packaging.Linux/build.sh @@ -32,12 +32,33 @@ case "$i" in VERSION="${i#*=}" shift # past argument=value ;; + --runtime=*) + RUNTIME="${i#*=}" + shift # past argument=value + ;; *) # unknown option ;; esac done +# Fall back to host architecture if no explicit runtime is given. +if test -z "$RUNTIME"; then + HOST_ARCH="`dpkg-architecture -q DEB_HOST_ARCH`" + + case $HOST_ARCH in + amd64) + RUNTIME="linux-x64" + ;; + arm64) + RUNTIME="linux-arm64" + ;; + *) + die "Could not determine host architecture!" + ;; + esac +fi + # Directories THISDIR="$( cd "$(dirname "$0")" ; pwd -P )" ROOT="$( cd "$THISDIR"/../../.. ; pwd -P )" @@ -48,7 +69,19 @@ PROJ_OUT="$OUT/linux/Packaging.Linux" # Build parameters FRAMEWORK=netcoreapp3.1 -RUNTIME=linux-x64 +case $RUNTIME in + linux-x64) + ARCH="amd64" + ;; + linux-arm64) + ARCH="arm64" + ;; + *) + die "Incompatible runtime architecture given for build.sh" + ;; +esac + +echo "Building for runtime ${RUNTIME} and arch ${ARCH}" # Perform pre-execution checks CONFIGURATION="${CONFIGURATION:=Debug}" @@ -56,11 +89,6 @@ if [ -z "$VERSION" ]; then die "--version was not set" fi -ARCH="`dpkg-architecture -q DEB_HOST_ARCH`" -if test -z "$ARCH"; then - die "Could not determine host architecture!" -fi - # Outputs PAYLOAD="$PROJ_OUT/payload/$CONFIGURATION" SYMBOLOUT="$PROJ_OUT/payload.sym/$CONFIGURATION" diff --git a/src/shared/Git-Credential-Manager/Git-Credential-Manager.csproj b/src/shared/Git-Credential-Manager/Git-Credential-Manager.csproj index 5d3df4e8e..bb43a87b7 100644 --- a/src/shared/Git-Credential-Manager/Git-Credential-Manager.csproj +++ b/src/shared/Git-Credential-Manager/Git-Credential-Manager.csproj @@ -4,7 +4,7 @@ Exe netcoreapp3.1 net461;netcoreapp3.1 - win-x86;osx-x64;linux-x64 + win-x86;osx-x64;linux-x64;linux-arm64 x86 git-credential-manager-core Microsoft.Git.CredentialManager