-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d67e31
commit a08cd19
Showing
10 changed files
with
297 additions
and
369 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Functional Tests | ||
|
||
on: [pull_request] | ||
|
||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
include: | ||
- xcodeVersion: 11.7 | ||
osVersion: macos-11 | ||
- xcodeVersion: 12.4 | ||
osVersion: macos-11 | ||
- xcodeVersion: 13.4 | ||
osVersion: macos-12 | ||
- xcodeVersion: 14.2 | ||
osVersion: macos-12 | ||
|
||
env: | ||
CI: true | ||
_FORCE_LOGS: 1 | ||
# https://github.com/actions/runner-images/tree/main/images/macos | ||
runs-on: ${{ matrix.osVersion }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
check-latest: true | ||
- uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: "${{ matrix.xcodeVersion }}" | ||
- run: npm install | ||
name: Install dev dependencies | ||
- run: npm run e2e-test | ||
name: Run e2e tests on Xcode@${{ matrix.xcodeVersion }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Unit Tests | ||
|
||
on: [pull_request, push] | ||
|
||
|
||
jobs: | ||
prepare_matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
versions: ${{ steps.generate-matrix.outputs.versions }} | ||
steps: | ||
- name: Generate Node.js versions matrix | ||
id: generate-matrix | ||
run: | | ||
sudo apt-get install -y lynx | ||
lynx -dump https://endoflife.date/nodejs | grep -E -o '[0-9]+ \(LTS\)' | grep -E -o '([0-9]+)' > eol.list | ||
cat eol.list | ||
lts1=$(cat eol.list | head -1) | ||
lts2=$(cat eol.list | head -2 | tail -1) | ||
lts3=$(cat eol.list | head -3 | tail -1) | ||
VERSIONS="[$lts1, $lts2, $lts3]" | ||
echo ::set-output name=versions::${VERSIONS} | ||
test: | ||
needs: | ||
- prepare_matrix | ||
strategy: | ||
matrix: | ||
node-version: ${{ fromJSON(needs.prepare_matrix.outputs.versions) }} | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm i -g npm | ||
name: Update NPM | ||
- run: npm install --no-package-lock | ||
name: Install dev dependencies | ||
- run: npm run lint | ||
name: Run linter | ||
- run: npm run test | ||
name: Run unit tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
// transpile:main | ||
|
||
import * as xcode from './lib/xcode'; | ||
|
||
|
||
const { | ||
getPath, getVersion, getAutomationTraceTemplatePath, getMaxIOSSDK, | ||
getAutomationTraceTemplatePathWithoutRetry, getMaxIOSSDKWithoutRetry, | ||
getConnectedDevices, clearInternalCache, getInstrumentsPath, | ||
getCommandLineToolsVersion, getMaxTVOSSDK, getMaxTVOSSDKWithoutRetry, | ||
import { | ||
getPath, | ||
getVersion, | ||
getMaxIOSSDK, | ||
getMaxTVOSSDK, | ||
getClangVersion, | ||
} = xcode; | ||
} from './lib/xcode'; | ||
|
||
const xcode = { | ||
getPath, | ||
getVersion, | ||
getMaxIOSSDK, | ||
getMaxTVOSSDK, | ||
getClangVersion | ||
}; | ||
|
||
export { | ||
getPath, getVersion, getAutomationTraceTemplatePath, getMaxIOSSDK, | ||
getAutomationTraceTemplatePathWithoutRetry, getMaxIOSSDKWithoutRetry, | ||
getConnectedDevices, clearInternalCache, getInstrumentsPath, | ||
getCommandLineToolsVersion, getMaxTVOSSDK, getMaxTVOSSDKWithoutRetry, | ||
getClangVersion, | ||
getPath, | ||
getVersion, | ||
getMaxIOSSDK, | ||
getMaxTVOSSDK, | ||
getClangVersion | ||
}; | ||
export default xcode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import _ from 'lodash'; | ||
import B from 'bluebird'; | ||
import { exec } from 'teen_process'; | ||
import { fs, plist } from '@appium/support'; | ||
import path from 'path'; | ||
|
||
export const XCRUN_TIMEOUT = 15000; | ||
|
||
/** | ||
* Executes 'xcrun' command line utility | ||
* | ||
* @param {string[]} args xcrun arguments | ||
* @param {number} timeout [15000] The maximum number of milliseconds to wait until xcrun exists | ||
* @returns {Promise<import("teen_process").ExecResult>} The result of xcrun execution | ||
* @throws {Error} If xcrun returned non-zero exit code or timed out | ||
*/ | ||
export async function runXcrunCommand (args, timeout = XCRUN_TIMEOUT) { | ||
try { | ||
return await exec('xcrun', args, {timeout}); | ||
} catch (err) { | ||
// the true error can be hidden within the stderr | ||
if (err.stderr) { | ||
err.message = `${err.message}: ${err.stderr}`; | ||
} | ||
|
||
throw err; | ||
} | ||
} | ||
|
||
/** | ||
* Uses macOS Spotlight service to detect where the given app is installed | ||
* | ||
* @param {string} bundleId Bundle identifier of the target app | ||
* @returns {Promise<string[]>} Full paths to where the app with the given bundle id is present. | ||
*/ | ||
export async function findAppPaths (bundleId) { | ||
let stdout; | ||
try { | ||
({stdout} = await exec('/usr/bin/mdfind', [ | ||
`kMDItemCFBundleIdentifier=${bundleId}` | ||
])); | ||
} catch (e) { | ||
return []; | ||
} | ||
|
||
const matchedPaths = _.trim(stdout) | ||
.split('\n') | ||
.map(_.trim) | ||
.filter(Boolean); | ||
if (_.isEmpty(matchedPaths)) { | ||
return []; | ||
} | ||
const results = matchedPaths.map((p) => (async () => { | ||
if (await fs.exists(p)) { | ||
return p; | ||
} | ||
})()); | ||
return (await B.all(results)).filter(Boolean); | ||
} | ||
|
||
/** | ||
* Finds and retrieves the content of the Xcode's Info.plist file | ||
* | ||
* @param {string} developerRoot Full path to the Contents/Developer folder under Xcode.app root | ||
* @returns {Promise<object>} All plist entries as an object or an empty object if no plist was found | ||
*/ | ||
export async function readXcodePlist (developerRoot) { | ||
const plistPath = path.resolve(developerRoot, '..', 'Info.plist'); | ||
return await fs.exists(plistPath) | ||
? await plist.parsePlistFile(plistPath) | ||
: {}; | ||
} |
Oops, something went wrong.