forked from appium/java-client
-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (153 loc) · 6.52 KB
/
ci.yml
File metadata and controls
173 lines (153 loc) · 6.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Appium Java Client CI
on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
- '*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CI: true
ANDROID_SDK_VERSION: "28"
ANDROID_EMU_NAME: test
ANDROID_EMU_TARGET: default
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
XCODE_VERSION: "15.4"
IOS_DEVICE_NAME: iPhone 15
IOS_PLATFORM_VERSION: "17.5"
FLUTTER_ANDROID_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/latest/download/app-debug.apk"
FLUTTER_IOS_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/latest/download/ios.zip"
PREBUILT_WDA_PATH: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app
jobs:
build:
strategy:
matrix:
include:
- java: 11
# Need to use specific (not `-latest`) version of macOS to be sure the required version of Xcode/simulator is available
platform: macos-14
e2e-tests: ios
- java: 17
# Need to use specific (not `-latest`) version of macOS to be sure the required version of Xcode/simulator is available
platform: macos-14
e2e-tests: flutter-ios
- java: 17
platform: ubuntu-latest
e2e-tests: android
- java: 17
platform: ubuntu-latest
e2e-tests: flutter-android
- java: 21
platform: ubuntu-latest
fail-fast: false
runs-on: ${{ matrix.platform }}
name: JDK ${{ matrix.java }} - ${{ matrix.platform }} ${{ matrix.e2e-tests }}
steps:
- uses: actions/checkout@v4
- name: Enable KVM group perms
if: matrix.e2e-tests == 'android' || matrix.e2e-tests == 'flutter-android'
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
# FIXME: Sonatype returns 401 for the snapshots repository
# latest_snapshot=$(curl -sf https://oss.sonatype.org/content/repositories/snapshots/org/seleniumhq/selenium/selenium-api/ | \
# python -c "import sys,re; print(re.findall(r'\d+\.\d+\.\d+-SNAPSHOT', sys.stdin.read())[-1])")
# echo ">>> $latest_snapshot"
# echo "latest_snapshot=$latest_snapshot" >> "$GITHUB_ENV"
# ./gradlew clean build -PisCI -Pselenium.version=$latest_snapshot
run: |
GROUP_ID="org.seleniumhq.selenium"
ARTIFACT_ID="selenium-api"
REPO_URL="https://repo1.maven.org/maven2"
GROUP_PATH="${GROUP_ID//.//}"
METADATA_URL="${REPO_URL}/${GROUP_PATH}/${ARTIFACT_ID}/maven-metadata.xml"
metadata=$(curl -s "$METADATA_URL")
latest_snapshot=$(python3 -c "
import sys, xml.etree.ElementTree as ET
root = ET.fromstring(sys.stdin.read())
print(root.findtext('./versioning/latest'))
" <<< "$metadata")
if [ -z "$latest_snapshot" ]; then
echo "❌ Failed to extract latest released version of ${ARTIFACT_ID} from $metadata"
exit 1
fi
echo "✅ Latest released version of ${ARTIFACT_ID} is: $latest_snapshot"
echo "latest_snapshot=$latest_snapshot" >> "$GITHUB_ENV"
./gradlew clean build -PisCI -Pselenium.version=$latest_snapshot
- name: Install Node.js
if: ${{ matrix.e2e-tests }}
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install Appium
if: ${{ matrix.e2e-tests }}
run: npm install --location=global appium
- name: Install UIA2 driver
if: matrix.e2e-tests == 'android' || matrix.e2e-tests == 'flutter-android'
run: appium driver install uiautomator2
- name: Install Flutter Integration driver
if: matrix.e2e-tests == 'flutter-android' || matrix.e2e-tests == 'flutter-ios'
run: appium driver install appium-flutter-integration-driver --source npm
- name: Run Android E2E tests
if: matrix.e2e-tests == 'android'
uses: reactivecircus/android-emulator-runner@v2
with:
script: ./gradlew e2eAndroidTest -PisCI -Pselenium.version=$latest_snapshot
api-level: ${{ env.ANDROID_SDK_VERSION }}
avd-name: ${{ env.ANDROID_EMU_NAME }}
disable-spellchecker: true
disable-animations: true
target: ${{ env.ANDROID_EMU_TARGET }}
- name: Run Flutter Android E2E tests
if: matrix.e2e-tests == 'flutter-android'
uses: reactivecircus/android-emulator-runner@v2
with:
script: ./gradlew e2eFlutterTest -Pplatform="android" -Pselenium.version=$latest_snapshot -PisCI -PflutterApp=${{ env.FLUTTER_ANDROID_APP }}
api-level: ${{ env.ANDROID_SDK_VERSION }}
avd-name: ${{ env.ANDROID_EMU_NAME }}
disable-spellchecker: true
disable-animations: true
target: ${{ env.ANDROID_EMU_TARGET }}
- name: Select Xcode
if: matrix.e2e-tests == 'ios' || matrix.e2e-tests == 'flutter-ios'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "${{ env.XCODE_VERSION }}"
- name: Prepare iOS simulator
if: matrix.e2e-tests == 'ios' || matrix.e2e-tests == 'flutter-ios'
uses: futureware-tech/simulator-action@v4
with:
model: "${{ env.IOS_DEVICE_NAME }}"
os_version: "${{ env.IOS_PLATFORM_VERSION }}"
wait_for_boot: true
shutdown_after_job: false
- name: Install XCUITest driver
if: matrix.e2e-tests == 'ios' || matrix.e2e-tests == 'flutter-ios'
run: appium driver install xcuitest
- name: Download prebuilt WDA
if: matrix.e2e-tests == 'ios' || matrix.e2e-tests == 'flutter-ios'
run: appium driver run xcuitest download-wda-sim --platform=ios --outdir=$(dirname "$PREBUILT_WDA_PATH")
- name: Run iOS E2E tests
if: matrix.e2e-tests == 'ios'
run: ./gradlew e2eIosTest -PisCI -Pselenium.version=$latest_snapshot
- name: Run Flutter iOS E2E tests
if: matrix.e2e-tests == 'flutter-ios'
run: ./gradlew e2eFlutterTest -Pplatform="ios" -Pselenium.version=$latest_snapshot -PisCI -PflutterApp=${{ env.FLUTTER_IOS_APP }}