From af7425a7d617d5ff881862473dfbfb307310392c Mon Sep 17 00:00:00 2001 From: Dennis Ameling Date: Sat, 23 Jan 2021 11:46:51 +0100 Subject: [PATCH 1/3] First work for Windows arm64 --- .github/workflows/ci.yml | 11 +++++++++++ lib/git-environment.ts | 9 +++++++++ script/config.js | 6 ------ script/embedded-git.json | 7 ++++++- test/helpers.ts | 7 ++++++- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 003727c1..54fb1a2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,9 @@ jobs: - os: windows-2019 friendlyName: Windows arch: x86 + - os: windows-2019 + friendlyName: Windows + arch: arm64 - os: ubuntu-18.04 friendlyName: Linux timeout-minutes: 10 @@ -31,10 +34,17 @@ jobs: with: submodules: recursive - name: Install Node.js ${{ matrix.arch }} + if: matrix.arch != 'arm64' uses: niik/setup-node@f9547c9 with: node-version: 12 node-arch: ${{ matrix.arch }} + - name: Install Node.js ${{ matrix.arch }} + if: matrix.arch == 'arm64' + uses: niik/setup-node@f9547c9 + with: + node-version: 12 + node-arch: x64 - name: Install and build dependencies run: npm ci env: @@ -44,6 +54,7 @@ jobs: - name: Lint run: npm run is-it-pretty - name: Test + if: matrix.arch != 'arm64' run: npm run test env: TEST: 1 diff --git a/lib/git-environment.ts b/lib/git-environment.ts index e1cc0fcf..cd9f8ad3 100644 --- a/lib/git-environment.ts +++ b/lib/git-environment.ts @@ -55,6 +55,8 @@ function resolveGitExecPath(): string { if (process.platform === 'win32') { if (process.arch === 'x64') { return path.join(gitDir, 'mingw64', 'libexec', 'git-core') + } else if (process.arch === 'arm64') { + return path.join(gitDir, 'arm64', 'libexec', 'git-core') } return path.join(gitDir, 'mingw32', 'libexec', 'git-core') @@ -82,6 +84,13 @@ export function setupEnvironment( if (process.platform === 'win32') { if (process.arch === 'x64') { envPath = `${gitDir}\\mingw64\\bin;${gitDir}\\mingw64\\usr\\bin;${envPath}` + } else if (process.arch === 'arm64') { + /** + * Git for Windows arm64 doesn't have all binaries available natively yet, + * but we can leverage 32-bit emulation on this platform. Therefore we fallback + * to mingw32 binaries in case native ones aren't available. + */ + envPath = `${gitDir}\\arm64\\bin;${gitDir}\\arm64\\usr\\bin;${gitDir}\\mingw32\\bin;${gitDir}\\mingw32\\usr\\bin;${envPath}` } else { envPath = `${gitDir}\\mingw32\\bin;${gitDir}\\mingw32\\usr\\bin;${envPath}` } diff --git a/script/config.js b/script/config.js index 45200e6a..b04aa079 100644 --- a/script/config.js +++ b/script/config.js @@ -22,12 +22,6 @@ function getConfig() { arch = process.env.npm_config_arch; } - if (process.platform === 'win32' && arch === 'arm64') { - // Use the Dugite Native ia32 package for Windows arm64 (arm64 can run 32-bit code through emulation) - console.log('Downloading 32-bit Dugite Native for Windows arm64'); - arch = 'ia32'; - } - if (process.platform === 'darwin' && arch === 'arm64') { // Use the Dugite Native x64 package for MacOS arm64 (arm64 can run x64 code through emulation with Rosetta) console.log('Downloading x64 Dugite Native for Apple Silicon (arm64)'); diff --git a/script/embedded-git.json b/script/embedded-git.json index e047a761..a8f25590 100644 --- a/script/embedded-git.json +++ b/script/embedded-git.json @@ -9,6 +9,11 @@ "url": "https://github.com/desktop/dugite-native/releases/download/v2.29.2-2/dugite-native-v2.29.2-f9ceb12-windows-x86.tar.gz", "checksum": "a983bd0e0fedc994906a3759a19325038a29ba8f172f93576d7b2ea0c5f72e44" }, + "win32-arm64": { + "name": "dugite-native-v2.30.0-f58d9fd-windows-arm64.tar.gz", + "url": "https://github.com/dennisameling/dugite-native/releases/download/v2.30.0-beta/dugite-native-v2.30.0-f58d9fd-windows-arm64.tar.gz", + "checksum": "2d5cb56283a3522ed80a16634c3b84e61da3e090c80db66f182136a35bfb1c2e" + }, "darwin-x64": { "name": "dugite-native-v2.29.2-f9ceb12-macOS.tar.gz", "url": "https://github.com/desktop/dugite-native/releases/download/v2.29.2-2/dugite-native-v2.29.2-f9ceb12-macOS.tar.gz", @@ -19,4 +24,4 @@ "url": "https://github.com/desktop/dugite-native/releases/download/v2.29.2-2/dugite-native-v2.29.2-f9ceb12-ubuntu.tar.gz", "checksum": "c23de590ba88f73cb3dc96a7d34d6b9b0432bb801c8c330529a72d6f6a0fd14e" } -} \ No newline at end of file +} diff --git a/test/helpers.ts b/test/helpers.ts index 09cfe5df..1b731f5f 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -1,7 +1,12 @@ import { GitProcess, IGitResult, GitError } from '../lib' // NOTE: bump these versions to the latest stable releases -export const gitVersion = '2.29.2' +let gitV = '2.29.2' +if (process.arch == 'arm64') { + gitV = '2.31.' +} + +export const gitVersion = gitV export const gitLfsVersion = '2.13.2' const temp = require('temp').track() From d165d3b416567670329e8c3d1e73a5ff552abc63 Mon Sep 17 00:00:00 2001 From: Dennis Ameling Date: Mon, 8 Mar 2021 15:21:40 +0100 Subject: [PATCH 2/3] Bump dugite-native arm64 version --- script/embedded-git.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/embedded-git.json b/script/embedded-git.json index a8f25590..b10e47c6 100644 --- a/script/embedded-git.json +++ b/script/embedded-git.json @@ -10,9 +10,9 @@ "checksum": "a983bd0e0fedc994906a3759a19325038a29ba8f172f93576d7b2ea0c5f72e44" }, "win32-arm64": { - "name": "dugite-native-v2.30.0-f58d9fd-windows-arm64.tar.gz", - "url": "https://github.com/dennisameling/dugite-native/releases/download/v2.30.0-beta/dugite-native-v2.30.0-f58d9fd-windows-arm64.tar.gz", - "checksum": "2d5cb56283a3522ed80a16634c3b84e61da3e090c80db66f182136a35bfb1c2e" + "name": "dugite-native-v2.29.2-5aad8ba-windows-arm64.tar.gz", + "url": "https://github.com/dennisameling/dugite-native/releases/download/v2.31.0-rc6/dugite-native-v2.29.2-5aad8ba-windows-arm64.tar.gz", + "checksum": "abd38f61068f7c67a8747517910f3762e12b2f873427e480a82985dff02e42a8" }, "darwin-x64": { "name": "dugite-native-v2.29.2-f9ceb12-macOS.tar.gz", From d8ada643ba8bc5d091473acdd8ac7522121ab145 Mon Sep 17 00:00:00 2001 From: Dennis Ameling Date: Mon, 8 Mar 2021 15:31:44 +0100 Subject: [PATCH 3/3] Fix commit ref --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54fb1a2b..77d23b10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,13 +35,13 @@ jobs: submodules: recursive - name: Install Node.js ${{ matrix.arch }} if: matrix.arch != 'arm64' - uses: niik/setup-node@f9547c9 + uses: niik/setup-node@f9547c97f4c519f71dc42e652d6d2c53f9527c1d with: node-version: 12 node-arch: ${{ matrix.arch }} - name: Install Node.js ${{ matrix.arch }} if: matrix.arch == 'arm64' - uses: niik/setup-node@f9547c9 + uses: niik/setup-node@f9547c97f4c519f71dc42e652d6d2c53f9527c1d with: node-version: 12 node-arch: x64