Skip to content

Commit 3b962f5

Browse files
authored
ci: runs tests on windows host as GitHub Actions (#272)
* ci: runs tests on windows host as GitHub Actions * tweak * move env * tweak ffi * only bundle install once * only bundle install once * do install dependencies in the same section * remove bundle exec on win * fix warning * tweak rubocop * specify version * specify version.. * do not run 2.7 on windows for now
1 parent f60b4f1 commit 3b962f5

File tree

4 files changed

+45
-25
lines changed

4 files changed

+45
-25
lines changed

.github/workflows/unittest.yml

+40-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515

1616
runs-on: ubuntu-latest
1717

18+
env:
19+
UNIT_TEST: true
20+
1821
steps:
1922
- uses: actions/checkout@v2
2023
- name: Set up Ruby
@@ -26,6 +29,40 @@ jobs:
2629
- name: Run tests
2730
run: |
2831
bundle exec rake rubocop
29-
UNIT_TEST=true bundle exec parallel_test test/unit/ -n 4
30-
UNIT_TEST=true AUTOMATION_NAME_DROID=espresso bundle exec parallel_test test/unit/android -n 4
31-
UNIT_TEST=true AUTOMATION_NAME_DROID=appium AUTOMATION_NAME_IOS=appium bundle exec parallel_test test/unit -n 4
32+
bundle exec parallel_test test/unit/ -n 4
33+
AUTOMATION_NAME_DROID=espresso bundle exec parallel_test test/unit/android -n 4
34+
AUTOMATION_NAME_DROID=appium AUTOMATION_NAME_IOS=appium bundle exec parallel_test test/unit -n 4
35+
36+
test-win:
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
# Does not add 2.7 on Windows so far since a command fails only on Windows
41+
ruby: [2.2, 2.3, 2.4, 2.5, 2.6]
42+
43+
runs-on: windows-latest
44+
45+
env:
46+
UNIT_TEST: true
47+
48+
steps:
49+
- uses: actions/checkout@v2
50+
- name: Set up Ruby
51+
uses: ruby/setup-ruby@v1
52+
with:
53+
ruby-version: ${{ matrix.ruby }}
54+
- name: Install dependencies
55+
run: |
56+
gem install ffi
57+
bundle install
58+
gem uninstall --force eventmachine && gem install eventmachine --platform ruby
59+
- name: Run tests
60+
run: |
61+
parallel_test test/unit/ -n 4
62+
63+
setx AUTOMATION_NAME_DROID espresso
64+
parallel_test test/unit/android -n 4
65+
66+
setx AUTOMATION_NAME_DROID appium
67+
setx AUTOMATION_NAME_IOS appium
68+
parallel_test test/unit -n 4

.rubocop.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Metrics/ClassLength:
1111
Metrics/AbcSize:
1212
Enabled: false
1313
Metrics/CyclomaticComplexity:
14-
Max: 13
14+
Max: 14
1515
Metrics/PerceivedComplexity:
16-
Max: 13
16+
Max: 14
1717
Metrics/ParameterLists:
1818
Enabled: false
1919
Lint/NestedMethodDefinition:

azure-pipelines.yml

-20
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,6 @@
44
# https://docs.microsoft.com/azure/devops/pipelines/languages/ruby
55
jobs:
66
- template: ./ci-jobs/functional_test.yml
7-
- job: Run_unit_tests_on_Windows_environment
8-
pool:
9-
vmImage: 'vs2017-win2016'
10-
variables:
11-
UNIT_TEST: true
12-
steps:
13-
- task: UseRubyVersion@0
14-
inputs:
15-
versionSpec: '2.5'
16-
- script: gem install bundler ffi:1.10.0
17-
displayName: 'Gem install bundler and ffi for Windows environment'
18-
- script: bundle install --retry=3 --jobs=4
19-
displayName: 'Call bundle install'
20-
- script: gem uninstall --force eventmachine && gem install eventmachine --platform ruby
21-
displayName: 'bundle re-install eventmachine for Windows because of Windows environment issue'
22-
- script: parallel_test test/unit/ -n 4
23-
displayName: 'Run parallel_test test/unit/ -n 4'
24-
- template: ./ci-jobs/functional/publish_test_result.yml
25-
parameters:
26-
xcodeVersion: 'Run_unit_tests_on_Windows_environment'
277

288
# Runs tests nightly to make sure they works against appium@beta
299
schedules:

lib/appium_lib_core/android/device.rb

+3
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,9 @@ def end_coverage(path, intent)
412412
end
413413

414414
::Appium::Core::Device.add_endpoint_method(:execute_cdp) do
415+
# SeleniumWebdriver could already define this method
416+
return if method_defined? :execute_cdp
417+
415418
def execute_cdp(cmd, **params)
416419
execute :chrome_send_command, {}, { cmd: cmd, params: params }
417420
end

0 commit comments

Comments
 (0)