Skip to content
98 changes: 46 additions & 52 deletions .github/workflows/ci-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,54 @@ name: CI - Ruby

on:
workflow_call:
inputs:
targets:
required: false
type: string
default: ''
run-full-suite:
required: false
type: boolean
default: true
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

docs:
name: Documentation
needs: build
if: ${{ github.event_name == 'workflow_dispatch' || inputs.run-full-suite }}
uses: ./.github/workflows/bazel.yml
with:
name: Documentation
run: bazel run //rb:docs

steep-check:
name: Type Check (Steep)
needs: build
if: ${{ github.event_name == 'workflow_dispatch' || inputs.run-full-suite }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.8
bundler-cache: true
working-directory: rb

- name: Install RBS collection
working-directory: rb
run: bundle exec rbs collection install

- name: Run Steep type check
working-directory: rb
run: bundle exec rake steep 2>/dev/null || (bundle exec rake steep && exit 1)

unit-tests:
name: Unit Tests
needs: build
if: ${{ github.event_name == 'workflow_dispatch' || inputs.run-full-suite }}
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
Expand All @@ -76,62 +74,58 @@ jobs:
run: >
bazel test
--keep_going
--build_tests_only
--test_size_filters small
--test_env=DEBUG=true
//rb/spec/...

integration-tests-local:
name: Local Tests
needs: build
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
browser:
- chrome
- edge
- firefox
os:
- windows
- macos
exclude:
- browser: edge
os: macos
with:
name: Local Tests (${{ matrix.browser }}, ${{ matrix.os }})
browser: ${{ matrix.browser }}
os: ${{ matrix.os }}
run: >
bazel test
--keep_going
--build_tests_only
--flaky_test_attempts 3
--local_test_jobs 1
--test_size_filters large
--test_tag_filters ${{ matrix.browser }}
//rb/spec/...
filter-targets:
name: Filter Targets
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.filter.outputs.targets }}
steps:
- name: Filter Ruby targets
id: filter
shell: bash
run: |
targets="${{ inputs.targets }}"
filtered=()

for t in $targets; do
[[ "$t" == //rb* ]] && filtered+=("$t")
done

if [ ${#filtered[@]} -eq 0 ]; then
echo "targets=//rb/spec/..." >> "$GITHUB_OUTPUT"
else
echo "targets=${filtered[*]}" >> "$GITHUB_OUTPUT"
fi

integration-tests-remote:
name: Remote Tests
needs: build
integration-tests-local:
name: Browser Tests
needs: filter-targets
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
browser: [chrome-beta, firefox-beta]
os: [windows]
include:
- browser: edge
os: macos
with:
name: Remote Tests (${{ matrix.browser }}, ${{ matrix.os }})
name: Browser Tests (${{ matrix.browser }}, ${{ matrix.os }})
browser: ${{ matrix.browser }}
os: ${{ matrix.os }}
java-version: 17
run: >
bazel test
--keep_going
--build_tests_only
--flaky_test_attempts 3
--local_test_jobs 1
--test_size_filters large
--test_tag_filters ${{ matrix.browser }}-remote
//rb/spec/...
--test_tag_filters ${{ matrix.browser }}
--pin_browsers=false
--test_env=SE_FORCE_BROWSER_DOWNLOAD=true
--test_env=SE_SKIP_DRIVER_IN_PATH=true
${{ needs.filter-targets.outputs.targets }}
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,20 @@ jobs:
name: Ruby
needs: check
uses: ./.github/workflows/ci-ruby.yml
with:
targets: ${{ needs.check.outputs.targets }}
run-full-suite: >-
${{
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'workflow_call' ||
contains(github.event.pull_request.title, '[rb]')
}}
if: >
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'workflow_call' ||
contains(needs.check.outputs.targets, '//rb') ||
contains(join(github.event.commits.*.message), '[rb]') ||
contains(github.event.pull_request.title, '[rb]')

rust:
Expand Down
2 changes: 1 addition & 1 deletion rb/spec/rspec_matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
end

@entries_found = (io.rewind && io.read).scan(/\[:([^\]]*)\]/).flatten.map(&:to_sym)
expect(Array(entry).sort).to eq(@entries_found.sort)
expect(@entries_found).to include(*Array(entry))
end

failure_message do
Expand Down