Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 27 additions & 37 deletions .github/workflows/ci-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,35 @@ name: CI - Ruby

on:
workflow_call:
inputs:
targets:
required: false
type: string
default: '//rb/...'
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build
uses: ./.github/workflows/bazel.yml
with:
name: Build
run: bazel build //rb:selenium-devtools //rb:selenium-webdriver

lint:
name: Lint
needs: build
uses: ./.github/workflows/bazel.yml
with:
name: Lint
run: ./go rb:lint

# jruby is exercised on RBE; minimum MRI is exercised by os-tests. This matrix
# covers the alternate interpreter (truffleruby) and the most recent MRI release.
unit-tests:
name: Unit Tests
needs: build
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
include:
- ruby-version: 3.3.11
os: ubuntu
- ruby-version: 3.3.11
os: windows
- ruby-version: 3.3.11
os: macos
- ruby-version: 4.0.4
os: ubuntu
- ruby-version: jruby-10.1.0.0
os: ubuntu
- ruby-version: truffleruby-34.0.1
os: ubuntu
with:
Expand All @@ -51,38 +41,38 @@ jobs:
run: >
bazel test
--keep_going
--build_tests_only
--test_size_filters small
//rb/spec/...

integration-tests-local:
name: Local Tests
needs: build
os-tests:
name: ${{ matrix.os }}-tests
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
browser:
- chrome
- edge
- firefox
os:
- windows
- macos
exclude:
- browser: edge
os: macos
include:
- os: ubuntu
browser: yes
tag-filters: unit,os-sensitive
- os: windows
browser: yes
tag-filters: edge,edge-bidi,unit,os-sensitive
- os: macos
browser: safari
tag-filters: safari,unit,os-sensitive
with:
name: Local Tests (${{ matrix.browser }}, ${{ matrix.os }})
name: ${{ matrix.os }}-tests
browser: ${{ matrix.browser }}
os: ${{ matrix.os }}
rerun-with-debug: true
run: >
bazel test
./scripts/github-actions/bazel-test-if-targets.sh
--keep_going
--build_tests_only
--flaky_test_attempts 2
--local_test_jobs 1
--test_size_filters large
--test_tag_filters ${{ matrix.browser }}
//rb/spec/...
--pin_browsers=false
--skip_incompatible_explicit_targets
--test_env=SE_FORCE_BROWSER_DOWNLOAD=true
--test_env=SE_SKIP_DRIVER_IN_PATH=true
--test_tag_filters=${{ matrix.tag-filters }}
${{ inputs.targets || '//rb/...' }}
16 changes: 13 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
java: ${{ steps.read.outputs.java }}
grid: ${{ steps.read.outputs.grid }}
py: ${{ steps.read.outputs.py }}
rb: ${{ steps.read.outputs.rb }}
rb_targets: ${{ steps.read.outputs.rb_targets }}
dotnet: ${{ steps.read.outputs.dotnet }}
rust: ${{ steps.read.outputs.rust }}
steps:
Expand All @@ -86,12 +86,20 @@ jobs:
echo "$tag=true" >> "$GITHUB_OUTPUT"
fi
}
process_binding() {
local pattern=$1 tag=$2
local lang_targets
lang_targets=$(echo "$targets" | tr ' ' '\n' | awk -v p="^${pattern}[:/]" '$0 ~ p' | tr '\n' ' ' | sed 's/ *$//')
if [ -n "$lang_targets" ]; then
echo "${tag}_targets=$lang_targets" >> "$GITHUB_OUTPUT"
fi
}
check_binding "//java" "java"
check_binding "openqa/selenium/grid" "grid"
check_binding "//py" "py"
check_binding "//rb" "rb"
check_binding "//dotnet" "dotnet"
check_binding "//rust" "rust"
process_binding "//rb" "rb"
dotnet:
name: .NET
needs: read-targets
Expand Down Expand Up @@ -120,7 +128,9 @@ jobs:
name: Ruby
needs: read-targets
uses: ./.github/workflows/ci-ruby.yml
if: needs.read-targets.outputs.rb != ''
if: needs.read-targets.outputs.rb_targets != ''
with:
targets: ${{ needs.read-targets.outputs.rb_targets }}

rust:
name: Rust
Expand Down
1 change: 0 additions & 1 deletion .skipped-tests
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@
-//java/test/org/openqa/selenium/bidi/browsingcontext:BrowsingContextTest-firefox-beta-remote
-//java/test/org/openqa/selenium/bidi/emulation:SetNetworkConditionsTest-firefox-beta
-//java/test/org/openqa/selenium/bidi/emulation:SetNetworkConditionsTest-firefox-beta-remote
-//rb/spec/integration/selenium/webdriver/bidi:browsing_context-firefox-beta-bidi
13 changes: 0 additions & 13 deletions rb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ load(
"rb_binary",
"rb_gem_build",
"rb_gem_push",
"rb_test",
)
load("//common:defs.bzl", "copy_file")

Expand Down Expand Up @@ -212,18 +211,6 @@ _LINT_DEPS = [
"@bundle",
]

rb_test(
name = "lint",
args = ["--autocorrect"] + _LINT_ARGS,
data = _LINT_DATA,
main = "@bundle//bin:rubocop",
tags = [
"no-sandbox",
"skip-rbe",
],
deps = _LINT_DEPS,
)

rb_binary(
name = "rubocop",
testonly = True,
Expand Down
3 changes: 1 addition & 2 deletions rb/spec/integration/selenium/webdriver/network_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

module Selenium
module WebDriver
describe Network, exclude: {version: 'beta'},
exclusive: {bidi: true, reason: 'only executed when bidi is enabled'},
describe Network, exclusive: {bidi: true, reason: 'only executed when bidi is enabled'},
only: {browser: %i[chrome edge firefox]} do
let(:username) { SpecSupport::RackServer::TestApp::BASIC_AUTH_CREDENTIALS.first }
let(:password) { SpecSupport::RackServer::TestApp::BASIC_AUTH_CREDENTIALS.last }
Expand Down
2 changes: 1 addition & 1 deletion rb/spec/integration/selenium/webdriver/window_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ module WebDriver

it 'can minimize the window', except: [{browser: %i[chrome edge], headless: true},
{browser: %i[safari safari_preview]}],
flaky: {browser: :chrome, platform: %i[macosx linux], ci: :github} do
flaky: {browser: %i[chrome edge], platform: %i[macosx linux], ci: :github} do
window.minimize
expect {
wait.until { driver.execute_script('return document.hidden;') }
Expand Down
2 changes: 1 addition & 1 deletion rb/spec/tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def rb_integration_test(
data = BROWSERS[browser]["data"] + data + ["//common/src/web"],
env = BROWSERS[browser]["env"] | {"WEBDRIVER_BIDI": "true"},
main = "@bundle//bin:rspec",
tags = COMMON_TAGS + BROWSERS[browser]["tags"] + universal_tags + ["{}-bidi".format(browser)],
tags = COMMON_TAGS + BROWSERS[browser]["tags"] + universal_tags + ["bidi", "{}-bidi".format(browser)],
deps = {d: True for d in (
["//rb/spec/integration/selenium/webdriver:spec_helper", "//rb/lib/selenium/webdriver:bidi"] +
BROWSERS[browser]["deps"] +
Expand Down
5 changes: 1 addition & 4 deletions rust/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ rustfmt_config(
# Start with the variants for each platform
alias(
name = "selenium-manager-windows",
actual = select({
"//common:windows": ":selenium-manager",
"//conditions:default": "@download_sm_windows//file",
}),
actual = "@download_sm_windows//file",
tags = [
"manual",
],
Expand Down
20 changes: 20 additions & 0 deletions scripts/github-actions/bazel-test-if-targets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Wrap `bazel test` so that exit code 4 (no test targets matched the
# configured filters) is reported as a notice and treated as success.
# Keeps `inputs.run` a single command word so rerun-failures.sh can
# strip ` //...` targets and re-append failed ones without mangling
# shell control characters.

set -uo pipefail

code=0
bazel test "$@" || code=$?

case "$code" in
0) exit 0 ;;
4)
echo "::notice::No test targets matched the configured filters"
exit 0
;;
*) exit "$code" ;;
esac
Loading