Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Windows ARM64 POC #421

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,10 +34,17 @@ jobs:
with:
submodules: recursive
- name: Install Node.js ${{ matrix.arch }}
uses: niik/setup-node@f9547c9
if: matrix.arch != 'arm64'
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@f9547c97f4c519f71dc42e652d6d2c53f9527c1d
with:
node-version: 12
node-arch: x64
- name: Install and build dependencies
run: npm ci
env:
Expand All @@ -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
9 changes: 9 additions & 0 deletions lib/git-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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}`
}
Expand Down
6 changes: 0 additions & 6 deletions script/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)');
Expand Down
7 changes: 6 additions & 1 deletion script/embedded-git.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.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",
"url": "https://github.com/desktop/dugite-native/releases/download/v2.29.2-2/dugite-native-v2.29.2-f9ceb12-macOS.tar.gz",
Expand All @@ -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"
}
}
}
7 changes: 6 additions & 1 deletion test/helpers.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand Down