diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index 168456bddeb88..d055b3e3bc822 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -2,22 +2,24 @@ 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 @@ -25,33 +27,29 @@ jobs: 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 @@ -76,56 +74,49 @@ 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 @@ -133,5 +124,8 @@ jobs: --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 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab0f535c85c66..f006662aad932 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/rb/spec/rspec_matchers.rb b/rb/spec/rspec_matchers.rb index e668368475beb..5ee75fb36a256 100644 --- a/rb/spec/rspec_matchers.rb +++ b/rb/spec/rspec_matchers.rb @@ -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