| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
18 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -161,11 +161,16 @@ jobs: | |||
| 161 | 161 | run: npm install | |
| 162 | 162 | ||
| 163 | 163 | - name: Test | |
| 164 | + # need arm64 runners or an emulator to run tests | ||
| 164 | 165 | if: matrix.arch != 'arm64' | |
| 165 | 166 | env: | |
| 166 | 167 | GIT_SSH: ${{ github.workspace }}\vendor\plink.exe | |
| 167 | 168 | run: | | |
| 168 | - powershell -command "Start-Process ${{ github.workspace }}\vendor\pageant.exe ${{ github.workspace }}\vendor\private.ppk" | ||
| 169 | + $encodedKey = Get-Content -Path test\private.ppk.enc | ||
| 170 | + $finalPath = Join-Path -Path $HOME -ChildPath .ssh_tests\private.ppk | ||
| 171 | + mkdir ~\.ssh_tests | ||
| 172 | + Set-Content -Value $([System.Convert]::FromBase64String($encodedKey)) -Path $finalPath -AsByteStream | ||
| 173 | + powershell -command "Start-Process .\vendor\pageant\pageant_${{ matrix.arch }}.exe $finalPath" | ||
| 169 | 174 | node utils/retry npm test | |
| 170 | 175 | ||
| 171 | 176 | # You're probably wondering why this isn't a single `run: |` step, it certainly is for *nix, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,3 +48,4 @@ jsconfig.json | |||
| 48 | 48 | ||
| 49 | 49 | test/id_rsa | |
| 50 | 50 | test/nodegit-test-rsa | |
| 51 | + test/private.ppk | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -155,21 +155,28 @@ | |||
| 155 | 155 | "-std=c++<(cxx_version)" | |
| 156 | 156 | ], | |
| 157 | 157 | }], | |
| 158 | - ["<(is_electron) == 1 and <(electron_openssl_static) == 1", { | ||
| 158 | + ["<(is_electron) == 1", { | ||
| 159 | + "conditions": [ | ||
| 160 | + ["<(electron_openssl_static) == 1", { | ||
| 161 | + "libraries": [ | ||
| 162 | + "<(electron_openssl_root)/lib/libssl.a", | ||
| 163 | + "<(electron_openssl_root)/lib/libcrypto.a" | ||
| 164 | + ] | ||
| 165 | + }], | ||
| 166 | + ["<(electron_openssl_static) != 1", { | ||
| 167 | + "library_dirs": [ | ||
| 168 | + "<(electron_openssl_root)/lib" | ||
| 169 | + ], | ||
| 170 | + "libraries": [ | ||
| 171 | + "-lcrypto", | ||
| 172 | + "-lssl" | ||
| 173 | + ] | ||
| 174 | + }] | ||
| 175 | + ], | ||
| 159 | 176 | "include_dirs": [ | |
| 160 | 177 | "<(electron_openssl_root)/include" | |
| 161 | 178 | ], | |
| 162 | - "libraries": [ | ||
| 163 | - "<(electron_openssl_root)/lib64/libssl.a", | ||
| 164 | - "<(electron_openssl_root)/lib64/libcrypto.a" | ||
| 165 | - ] | ||
| 166 | 179 | }], | |
| 167 | - ["<(is_electron) == 1 and <(electron_openssl_static) != 1", { | ||
| 168 | - "libraries": [ | ||
| 169 | - "-lcrypto", | ||
| 170 | - "-lssl" | ||
| 171 | - ] | ||
| 172 | - }] | ||
| 173 | 180 | ], | |
| 174 | 181 | }], | |
| 175 | 182 | [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -65,7 +65,7 @@ npm install nodegit --msvs_version=2013 | |||
| 65 | 65 | ``` | |
| 66 | 66 | ||
| 67 | 67 | ### Electron and OpenSSL ### | |
| 68 | - A local version of OpenSSL is required when building for Electron on Windows and macOS. This is due to Electron using BoringSSL, as we are not able to link to it like we are OpenSSL in Node. Additionally, OpenSSL can be statically linked on Linux by setting the `NODEGIT_OPENSSL_STATIC_LINK` environment variable to `1`. | ||
| 68 | + A local version of OpenSSL is required when building for Electron. This is due to Electron using BoringSSL, as we are not able to link to it like we are OpenSSL in Node. | ||
| 69 | 69 | ||
| 70 | 70 | `acquireOpenSSL.js` will attempt to download OpenSSL prebuilts from S3. If preferred, it can also be built locally by setting the environment variable `npm_config_openssl_bin_url=skip`. On macOS, this should Just Work(tm). On Windows, things are a little trickier. | |
| 71 | 71 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,5 +17,20 @@ Unit tests for NodeGit. | |||
| 17 | 17 | Test utilities with garbage collector, index, and repository setup, that can be used in tests. | |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | - ## Note | ||
| 21 | - \*.enc are encrypted in base64 and unencrypted before the test suite runs as \*. | ||
| 20 | + ## Keys | ||
| 21 | + | ||
| 22 | + Note: all files are encoded in base64 in `\*.enc` and decoded before the test suite runs. | ||
| 23 | + | ||
| 24 | + ### encrypted_rsa | ||
| 25 | + - passphrase "test-password" | ||
| 26 | + - registered as deploy key on [nodegit/test](https://github.com/nodegit/test) repo named "Encrypted test key" | ||
| 27 | + | ||
| 28 | + ### id_rsa | ||
| 29 | + - registered as deploy key on [nodegit/test](https://github.com/nodegit/test) repo named "Unencrypted Test Key" | ||
| 30 | + | ||
| 31 | + ### private.ppk | ||
| 32 | + - same key as id_rsa | ||
| 33 | + - ppk format is used by putty/pageant and converted/generated by puttygen | ||
| 34 | + | ||
| 35 | + ### nodegit-test-rsa | ||
| 36 | + - registered as deploy key on [nodegit/private](https://github.com/nodegit/private) repo named "Tests" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,6 +40,8 @@ function unencryptKey(fileName) { | |||
| 40 | 40 | .toString('ascii'); | |
| 41 | 41 | fs.writeFileSync(path.join(__dirname, fileName), asciiContents, 'utf8'); | |
| 42 | 42 | } | |
| 43 | + | ||
| 44 | + unencryptKey('private.ppk'); | ||
| 43 | 45 | unencryptKey('id_rsa'); | |
| 44 | 46 | unencryptKey('nodegit-test-rsa'); | |
| 45 | 47 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,47 @@ | |||
| 1 | + UHVUVFktVXNlci1LZXktRmlsZS0zOiBzc2gtcnNhCkVuY3J5cHRpb246IG5vbmUKQ29tbWVudDog | ||
| 2 | + bm9uYW1lClB1YmxpYy1MaW5lczogMTIKQUFBQUIzT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ZGhp | ||
| 39 | + WHBiQkMyUzJYeXJLcG1jK1hKUTgycWVPdwpkNmU5b0pWMTNQN0pTc1lhRWp2UVR5TnI2QTZuNDgy | ||
| 40 | + L3FtUmR1MVIzQUFBQkFRQ1c4emFSOU9lTzFwM1hpMTRYCjkwM245Y2NjUlVwZEw4RlJQNnkxaStU | ||
| 41 | + WmY3ZFJaZWt5bVg2Rm1Pam0wL25vVzNIcGVaMmJiRGlBUERadVc0ZlEKbWdaMGd6bG9kRENlSnZQ | ||
| 42 | + cXZTUXNRZUhKNGMyR3NUbjFUczMzWFNUVnhVS3d3amxGdkxqbzJCQXZpQWhmd2FDdwpSbFRoaWtH | ||
| 43 | + L0J0LzBtWE5tMXpwcVlucUFzWldvcmo5VVZBNjJPVzgxQ1VYMS9kVTFrY1JBaWNjbFFsak5TRFhi | ||
| 44 | + CnppYlU3am91enNDM0VVRURwbUdkbVRRWHhYc0I1MVVOaHl5VmgyZ0FWcUMwMDJtSndnRVVzanBx | ||
| 45 | + c2FMNk03M2EKejgzODhvRHBYYnAxQ0tMRHloOHZKcElOSDBqTk5kRDF3V29BUlFlSHMvTmJRRktR | ||
| 46 | + OElOSXZQc1p6MFpHZkc3Lwp1UytKClByaXZhdGUtTUFDOiBmMjY3ZTM0MzYwOTViZDc5OWYwNzQw | ||
| 47 | + NDExZmJhMDM0YzZjOWNiN2VhYzk1ZDg4NDk3ZGVlYmMxNGZjZWQ0ZDU2Cg== | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,8 +3,6 @@ var assert = require("assert"); | |||
| 3 | 3 | var fse = require("fs-extra"); | |
| 4 | 4 | var local = path.join.bind(path, __dirname); | |
| 5 | 5 | var _ = require("lodash"); | |
| 6 | - const util = require("util"); | ||
| 7 | - const exec = util.promisify(require("child_process").exec); | ||
| 8 | 6 | ||
| 9 | 7 | ||
| 10 | 8 | const generatePathWithLength = (base, length) => { | |
@@ -237,62 +235,6 @@ describe("Clone", function() { | |||
| 237 | 235 | }); | |
| 238 | 236 | }); | |
| 239 | 237 | ||
| 240 | - if (process.platform === "win32") { | ||
| 241 | - it("can clone with ssh using old agent with sha1 signing support only", | ||
| 242 | - async function () { | ||
| 243 | - var pageant = local("../../vendor/pageant.exe"); | ||
| 244 | - var old_pageant = local("../../vendor/pageant_sha1.exe"); | ||
| 245 | - var privateKey = local("../../vendor/private.ppk"); | ||
| 246 | - var test = this; | ||
| 247 | - var url = "git@github.com:nodegit/test.git"; | ||
| 248 | - var opts = { | ||
| 249 | - fetchOpts: { | ||
| 250 | - callbacks: { | ||
| 251 | - certificateCheck: () => 0, | ||
| 252 | - credentials: function(url, userName) { | ||
| 253 | - return NodeGit.Credential.sshKeyFromAgent(userName); | ||
| 254 | - } | ||
| 255 | - } | ||
| 256 | - } | ||
| 257 | - }; | ||
| 258 | - | ||
| 259 | - try { | ||
| 260 | - await exec("taskkill /im pageant.exe /f /t"); | ||
| 261 | - } catch (e) { | ||
| 262 | - try { | ||
| 263 | - await exec("taskkill /im pageant_sha1.exe /f /t"); | ||
| 264 | - } catch(e) {} | ||
| 265 | - } | ||
| 266 | - try { | ||
| 267 | - await exec(`powershell -command "Start-Process ${old_pageant} ${privateKey}`); | ||
| 268 | - } catch (e) { | ||
| 269 | - try { | ||
| 270 | - await exec(`powershell -command "Start-Process ${pageant} ${privateKey}`); | ||
| 271 | - } catch (e) {} | ||
| 272 | - return assert.fail("Cannot run old pageant"); | ||
| 273 | - } | ||
| 274 | - | ||
| 275 | - try { | ||
| 276 | - const repo = await Clone(url, clonePath, opts); | ||
| 277 | - test.repository = repo; | ||
| 278 | - } catch(e) { | ||
| 279 | - return assert.fail("Clone error: " + e.message); | ||
| 280 | - } | ||
| 281 | - | ||
| 282 | - try { | ||
| 283 | - await exec("taskkill /im pageant_sha1.exe /f /t"); | ||
| 284 | - } catch(e) {} | ||
| 285 | - | ||
| 286 | - try { | ||
| 287 | - await exec(`powershell -command "Start-Process ${pageant} ${privateKey}`); | ||
| 288 | - } catch (e) { | ||
| 289 | - return assert.fail("Cannot run pageant"); | ||
| 290 | - } | ||
| 291 | - | ||
| 292 | - return assert.ok(test.repository instanceof Repository); | ||
| 293 | - }); | ||
| 294 | - } | ||
| 295 | - | ||
| 296 | 238 | it("can clone with ssh", function() { | |
| 297 | 239 | var test = this; | |
| 298 | 240 | var url = "git@github.com:nodegit/test.git"; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,8 @@ import { createWriteStream, promises as fs } from "fs"; | |||
| 10 | 10 | import { performance } from "perf_hooks"; | |
| 11 | 11 | import { promisify } from "util"; | |
| 12 | 12 | ||
| 13 | + import { hostArch, targetArch } from "./buildFlags.js"; | ||
| 14 | + | ||
| 13 | 15 | const pipeline = promisify(stream.pipeline); | |
| 14 | 16 | ||
| 15 | 17 | import packageJson from '../package.json' with { type: "json" }; | |
@@ -22,26 +24,6 @@ const extractPath = path.join(vendorPath, "openssl"); | |||
| 22 | 24 | ||
| 23 | 25 | const exists = (filePath) => fs.stat(filePath).then(() => true).catch(() => false); | |
| 24 | 26 | ||
| 25 | - const convertArch = (archStr) => { | ||
| 26 | - const convertedArch = { | ||
| 27 | - 'ia32': 'x86', | ||
| 28 | - 'x86': 'x86', | ||
| 29 | - 'x64': 'x64', | ||
| 30 | - 'arm64': 'arm64' | ||
| 31 | - }[archStr]; | ||
| 32 | - | ||
| 33 | - if (!convertedArch) { | ||
| 34 | - throw new Error('unsupported architecture'); | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - return convertedArch; | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - const hostArch = convertArch(process.arch); | ||
| 41 | - const targetArch = process.env.npm_config_arch | ||
| 42 | - ? convertArch(process.env.npm_config_arch) | ||
| 43 | - : hostArch; | ||
| 44 | - | ||
| 45 | 27 | const pathsToIncludeForPackage = [ | |
| 46 | 28 | "include", "lib" | |
| 47 | 29 | ]; | |
@@ -152,20 +134,13 @@ const buildLinux = async (buildCwd) => { | |||
| 152 | 134 | ||
| 153 | 135 | const configureArgs = [ | |
| 154 | 136 | buildConfig, | |
| 155 | - // Electron(at least on centos7) imports the libcups library at runtime, which has a | ||
| 156 | - // dependency on the system libssl/libcrypto which causes symbol conflicts and segfaults. | ||
| 157 | - // To fix this we need to hide all the openssl symbols to prevent them from being overridden | ||
| 158 | - // by the runtime linker. | ||
| 159 | - // "-fvisibility=hidden", | ||
| 160 | - // compile static libraries | ||
| 161 | - "no-shared", | ||
| 162 | - // disable ssl2, ssl3, and compression | ||
| 163 | - "no-ssl2", | ||
| 137 | + // disable ssl3, and compression | ||
| 164 | 138 | "no-ssl3", | |
| 165 | 139 | "no-comp", | |
| 166 | 140 | // set install directory | |
| 167 | 141 | `--prefix="${extractPath}"`, | |
| 168 | - `--openssldir="${extractPath}"` | ||
| 142 | + `--openssldir="${extractPath}"`, | ||
| 143 | + "--libdir=lib", | ||
| 169 | 144 | ]; | |
| 170 | 145 | await execPromise(`./Configure ${configureArgs.join(" ")}`, { | |
| 171 | 146 | cwd: buildCwd | |
@@ -175,12 +150,16 @@ const buildLinux = async (buildCwd) => { | |||
| 175 | 150 | ||
| 176 | 151 | // only build the libraries, not the fuzzer or apps | |
| 177 | 152 | await execPromise("make build_libs", { | |
| 178 | - cwd: buildCwd | ||
| 153 | + cwd: buildCwd, | ||
| 154 | + maxBuffer: 10 * 1024 * 1024 | ||
| 179 | 155 | }, { pipeOutput: true }); | |
| 180 | 156 | ||
| 181 | - await execPromise("make test", { | ||
| 182 | - cwd: buildCwd | ||
| 183 | - }, { pipeOutput: true }); | ||
| 157 | + if (hostArch === targetArch) { | ||
| 158 | + await execPromise("make test", { | ||
| 159 | + cwd: buildCwd, | ||
| 160 | + maxBuffer: 10 * 1024 * 1024 | ||
| 161 | + }, { pipeOutput: true }); | ||
| 162 | + } | ||
| 184 | 163 | ||
| 185 | 164 | // only install software, not the docs | |
| 186 | 165 | await execPromise("make install_sw", { | |
@@ -341,11 +320,6 @@ const buildOpenSSLIfNecessary = async ({ | |||
| 341 | 320 | return; | |
| 342 | 321 | } | |
| 343 | 322 | ||
| 344 | - if (process.platform === "linux" && process.env.NODEGIT_OPENSSL_STATIC_LINK !== "1") { | ||
| 345 | - console.log(`Skipping OpenSSL build, NODEGIT_OPENSSL_STATIC_LINK !== 1`); | ||
| 346 | - return; | ||
| 347 | - } | ||
| 348 | - | ||
| 349 | 323 | await removeOpenSSLIfOudated(openSSLVersion); | |
| 350 | 324 | ||
| 351 | 325 | try { | |
@@ -396,11 +370,6 @@ const downloadOpenSSLIfNecessary = async ({ | |||
| 396 | 370 | return; | |
| 397 | 371 | } | |
| 398 | 372 | ||
| 399 | - if (process.platform === "linux" && process.env.NODEGIT_OPENSSL_STATIC_LINK !== "1") { | ||
| 400 | - console.log(`Skipping OpenSSL download, NODEGIT_OPENSSL_STATIC_LINK !== 1`); | ||
| 401 | - return; | ||
| 402 | - } | ||
| 403 | - | ||
| 404 | 373 | try { | |
| 405 | 374 | await fs.stat(extractPath); | |
| 406 | 375 | console.log("Skipping OpenSSL download, dir exists"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,29 @@ try { | |||
| 10 | 10 | isGitRepo = false; | |
| 11 | 11 | } | |
| 12 | 12 | ||
| 13 | + const convertArch = (archStr) => { | ||
| 14 | + const convertedArch = { | ||
| 15 | + 'ia32': 'x86', | ||
| 16 | + 'x86': 'x86', | ||
| 17 | + 'x64': 'x64', | ||
| 18 | + 'arm64': 'arm64' | ||
| 19 | + }[archStr]; | ||
| 20 | + | ||
| 21 | + if (!convertedArch) { | ||
| 22 | + throw new Error('unsupported architecture'); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + return convertedArch; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + const hostArch = convertArch(process.arch); | ||
| 29 | + const targetArch = process.env.npm_config_arch | ||
| 30 | + ? convertArch(process.env.npm_config_arch) | ||
| 31 | + : hostArch; | ||
| 32 | + | ||
| 13 | 33 | module.exports = { | |
| 34 | + hostArch, | ||
| 35 | + targetArch, | ||
| 14 | 36 | debugBuild: !!process.env.BUILD_DEBUG, | |
| 15 | 37 | isElectron: process.env.npm_config_runtime === "electron", | |
| 16 | 38 | isGitRepo: isGitRepo, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments