Skip to content

Commit

Permalink
Merge pull request #275 from AirtestProject/dev
Browse files Browse the repository at this point in the history
v1.3
  • Loading branch information
yimelia authored Jun 13, 2024
2 parents 7c99c4c + 2ac9cb9 commit c0bf130
Show file tree
Hide file tree
Showing 158 changed files with 3,940 additions and 3,672 deletions.
29 changes: 19 additions & 10 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
# https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml
variables:
MIN_VM_IMAGE: macOS-11
MIN_XCODE_VERSION: 12.4
MIN_PLATFORM_VERSION: 14.4
MIN_TV_PLATFORM_VERSION: 14.3
MIN_TV_DEVICE_NAME: Apple TV 4K
MIN_VM_IMAGE: macOS-12
MIN_XCODE_VERSION: 13.1
MIN_PLATFORM_VERSION: 15.0
MIN_TV_PLATFORM_VERSION: 15.0
MIN_TV_DEVICE_NAME: Apple TV 4K (2nd generation)
MIN_IPHONE_DEVICE_NAME: iPhone 11
MIN_IPAD_DEVICE_NAME: iPad Pro (11-inch) (2nd generation)
MIN_IPAD_DEVICE_NAME: iPad Pro (11-inch) (3rd generation)
MAX_VM_IMAGE: macOS-12
MAX_XCODE_VERSION: 13.4
MAX_PLATFORM_VERSION: 15.5
MAX_PLATFORM_VERSION_TV: 15.4
MAX_XCODE_VERSION: 14.2
MAX_PLATFORM_VERSION: 16.2
MAX_PLATFORM_VERSION_TV: 16.1
MAX_IPHONE_DEVICE_NAME: iPhone 13
MAX_TV_DEVICE_NAME: Apple TV 4K (2nd generation)
MAX_IPAD_DEVICE_NAME: iPad Pro (11-inch) (3rd generation)
DEFAULT_NODE_VERSION: "16.x"
DEFAULT_NODE_VERSION: "18.x"

trigger:
batch: true
branches:
include: [master]

pr:
autoCancel: true
branches:
include: [master]

pool:
vmImage: "$(MAX_VM_IMAGE)"
Expand Down
24 changes: 21 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
{
"extends": "@appium/eslint-config-appium",
"extends": ["@appium/eslint-config-appium-ts"],
"overrides": [
{
"files": "test/**/*.js",
"rules": {
"func-names": "off"
"func-names": "off",
"@typescript-eslint/no-var-requires": "off"
}
},
{
"files": "Scripts/**/*.js",
"parserOptions": {"sourceType": "script"},
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
},
{
"files": "ci-jobs/scripts/*.js",
"parserOptions": {"sourceType": "script"},
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
}
]
],
"rules": {
"require-await": "error"
}
}
7 changes: 7 additions & 0 deletions .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,12 @@ jobs:
npm install
mkdir -p ./Resources/WebDriverAgent.bundle
name: Install dev dependencies
- run: |
target_sim_id=$(xcrun simctl list devices available | grep "$DEVICE_NAME (" | cut -d "(" -f2 | cut -d ")" -f1)
open -Fn "$(xcode-select -p)/Applications/Simulator.app"
xcrun simctl bootstatus $target_sim_id -b
name: Preboot Simulator
- run: npm run e2e-test
name: Run functional tests
10 changes: 6 additions & 4 deletions .github/workflows/publish.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ on:

jobs:
build:
runs-on: macos-12
runs-on: macos-13

env:
XCODE_VERSION: 14.1
XCODE_VERSION: 14.3.1
ZIP_PKG_NAME_IOS: "WebDriverAgentRunner-Runner.zip"
PKG_PATH_IOS: "appium_wda_ios"
ZIP_PKG_NAME_TVOS: "WebDriverAgentRunner_tvOS-Runner.zip"
Expand Down Expand Up @@ -44,9 +44,10 @@ jobs:
-scheme WebDriverAgentRunner \
-destination generic/platform=iOS \
CODE_SIGNING_ALLOWED=NO ARCHS=arm64
- name: Creating a zip of WebDriverAgentRunner-Runner.app for iOS
- name: Creating a zip of WebDriverAgentRunner-Runner.app for iOS after removing test frameworks
run: |
pushd appium_wda_ios/Build/Products/Debug-iphoneos
rm -rf WebDriverAgentRunner-Runner.app/Frameworks/XC*.framework
zip -r $ZIP_PKG_NAME_IOS WebDriverAgentRunner-Runner.app
popd
mv $PKG_PATH_IOS/Build/Products/Debug-iphoneos/$ZIP_PKG_NAME_IOS ./
Expand All @@ -58,9 +59,10 @@ jobs:
-scheme WebDriverAgentRunner_tvOS \
-destination generic/platform=tvOS \
CODE_SIGNING_ALLOWED=NO ARCHS=arm64
- name: Creating a zip of WebDriverAgentRunner-Runner.app for tvOS
- name: Creating a zip of WebDriverAgentRunner-Runner.app for tvOS after removing test frameworks
run: |
pushd appium_wda_tvos/Build/Products/Debug-appletvos
rm -rf WebDriverAgentRunner_tvOS-Runner.app/Frameworks/XC*.framework
zip -r $ZIP_PKG_NAME_TVOS WebDriverAgentRunner_tvOS-Runner.app
popd
mv $PKG_PATH_TVOS/Build/Products/Debug-appletvos/$ZIP_PKG_NAME_TVOS ./
Expand Down
14 changes: 2 additions & 12 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,9 @@ jobs:
outputs:
versions: ${{ steps.generate-matrix.outputs.versions }}
steps:
- name: Generate Node.js versions matrix
- name: Select 3 most recent LTS versions of Node.js
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 "versions=${VERSIONS}" >> "$GITHUB_OUTPUT"
run: echo "versions=$(curl -s https://endoflife.date/api/nodejs.json | jq -c '[[.[] | select(.lts != false)][:3] | .[].cycle | tonumber]')" >> "$GITHUB_OUTPUT"

test:
needs:
Expand All @@ -33,8 +25,6 @@ jobs:
- 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
Expand Down
102 changes: 69 additions & 33 deletions .github/workflows/wda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,60 @@ name: Building WebDriverAgent

on:
workflow_dispatch:
workflow_run:
workflows: ["Release"]
types:
- completed

env:
HOST: macos-13
XCODE_VERSION: 14.3.1
DESTINATION_SIM: platform=iOS Simulator,name=iPhone 14 Pro
DESTINATION_SIM_tvOS: platform=tvOS Simulator,name=Apple TV

jobs:
build:
host_machine:
runs-on: ubuntu-latest
outputs:
host: ${{ steps.macos_host.outputs.host }}
steps:
- run: |
echo "host=${{ env.HOST }}" >> $GITHUB_OUTPUT
id: macos_host
for_real_devices:
needs: [host_machine]
name: Build WDA for real iOS and tvOS devices
runs-on: macos-12
runs-on: ${{ needs.host_machine.outputs.host }}

env:
XCODE_VERSION: 14.1
ZIP_PKG_NAME_IOS: "WebDriverAgentRunner-Runner.zip"
PKG_PATH_IOS: "appium_wda_ios"
ZIP_PKG_NAME_TVOS: "WebDriverAgentRunner_tvOS-Runner.zip"
PKG_PATH_TVOS: "appium_wda_tvos"

steps:
- name: Checkout
uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "${{ env.XCODE_VERSION }}"
- name: Build iOS
run: |
xcodebuild clean build-for-testing \
-project WebDriverAgent.xcodeproj \
-derivedDataPath $PKG_PATH_IOS \
-scheme WebDriverAgentRunner \
-destination generic/platform=iOS \
CODE_SIGNING_ALLOWED=NO ARCHS=arm64
- name: Creating a zip of WebDriverAgentRunner-Runner.app for iOS
run: |
pushd appium_wda_ios/Build/Products/Debug-iphoneos
zip -r $ZIP_PKG_NAME_IOS WebDriverAgentRunner-Runner.app
popd
mv $PKG_PATH_IOS/Build/Products/Debug-iphoneos/$ZIP_PKG_NAME_IOS ./
- name: Build tvOS
run: |
xcodebuild clean build-for-testing \
-project WebDriverAgent.xcodeproj \
-derivedDataPath $PKG_PATH_TVOS \
-scheme WebDriverAgentRunner_tvOS \
-destination generic/platform=tvOS \
CODE_SIGNING_ALLOWED=NO ARCHS=arm64
- name: Creating a zip of WebDriverAgentRunner-Runner.app for tvOS
run: |
pushd appium_wda_tvos/Build/Products/Debug-appletvos
zip -r $ZIP_PKG_NAME_TVOS WebDriverAgentRunner_tvOS-Runner.app
popd
mv $PKG_PATH_TVOS/Build/Products/Debug-appletvos/$ZIP_PKG_NAME_TVOS ./
- name: Create a zip file of WebDriverAgentRunner-Runner.app for iOS
run: sh $GITHUB_WORKSPACE/Scripts/ci/build-real.sh
env:
DERIVED_DATA_PATH: appium_wda_ios
SCHEME: WebDriverAgentRunner
DESTINATION: generic/platform=iOS
WD: appium_wda_ios/Build/Products/Debug-iphoneos
ZIP_PKG_NAME: "${{ env.ZIP_PKG_NAME_IOS }}"

- name: Create a zip file of WebDriverAgentRunner-Runner.app for tvOS
run: sh $GITHUB_WORKSPACE/Scripts/ci/build-real.sh
env:
DERIVED_DATA_PATH: appium_wda_tvos
SCHEME: WebDriverAgentRunner_tvOS
DESTINATION: generic/platform=tvOS
WD: appium_wda_tvos/Build/Products/Debug-appletvos
ZIP_PKG_NAME: "${{ env.ZIP_PKG_NAME_TVOS }}"

- name: Upload the built generic app package for iOS
uses: actions/[email protected]
with:
Expand All @@ -57,3 +64,32 @@ jobs:
uses: actions/[email protected]
with:
path: "${{ env.ZIP_PKG_NAME_TVOS }}"

for_simulator_devices:
needs: [host_machine]
name: Build WDA for ${{ matrix.target }} simulators
runs-on: ${{ needs.host_machine.outputs.host }}

strategy:
matrix:
# '' is for iOS
target: ['', '_tvOS']
arch: [x86_64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "${{ env.XCODE_VERSION }}"
- name: Create a zip of WebDriverAgentRunner${{ matrix.target }} for simulator for ${{ matrix.arch }}
run: |
DESTINATION=$DESTINATION_SIM${{ matrix.target }} sh $GITHUB_WORKSPACE/Scripts/ci/build-sim.sh
env:
TARGET: ${{ matrix.target }}
SCHEME: WebDriverAgentRunner${{ matrix.target }}
ARCHS: ${{ matrix.arch }}
ZIP_PKG_NAME: "WebDriverAgentRunner${{ matrix.target }}-Build-Sim-${{ matrix.arch }}.zip"
- name: Upload the built generic app package for WebDriverAgentRunner${{ matrix.target }} with ${{ matrix.arch }}
uses: actions/[email protected]
with:
path: "WebDriverAgentRunner${{ matrix.target }}-Build-Sim-${{ matrix.arch }}.zip"
2 changes: 1 addition & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
require: ['@babel/register'],
require: ['ts-node/register'],
forbidOnly: Boolean(process.env.CI)
};
Loading

0 comments on commit c0bf130

Please sign in to comment.