Fix safari test #1138
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Ruby examples | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '55 22 * * *' | |
pull_request: | |
branches: | |
- trunk | |
paths: | |
- 'examples/ruby/**' | |
push: | |
branches: | |
- trunk | |
paths: | |
- 'examples/ruby/**' | |
env: | |
DISPLAY: :99 | |
GITHUB_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }} | |
GH_TOKEN: ${{ secrets.SELENIUM_CI_TOKEN }} | |
jobs: | |
test_examples: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
release: [ stable, nightly ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout GitHub repo | |
uses: actions/checkout@v4 | |
- name: Install Safari Technology Preview | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install --cask safari-technology-preview | |
sudo safaridriver --enable | |
- name: Remove driver directories Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
rm "$env:ChromeWebDriver" -r -v | |
rm "$env:EdgeWebDriver" -r -v | |
rm "$env:GeckoWebDriver" -r -v | |
- name: Remove driver directories Non-Windows | |
if: matrix.os != 'windows-latest' | |
run: | | |
sudo rm -rf $CHROMEWEBDRIVER $EDGEWEBDRIVER $GECKOWEBDRIVER | |
- name: Start Xvfb | |
if: matrix.os == 'ubuntu-latest' | |
run: Xvfb :99 & | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.0 | |
bundler-cache: true | |
- name: Install Gems Nightly non-Windows | |
if: matrix.release == 'nightly' && matrix.os != 'windows-latest' | |
run: | |
| | |
latest_nightly_webdriver=$(./scripts/latest-nightly-version.sh rubygems selenium-webdriver) | |
cd examples/ruby | |
bundle install | |
bundle remove selenium-webdriver | |
bundle add selenium-webdriver --version $latest_nightly_webdriver --source "https://token:${{secrets.GITHUB_TOKEN}}@rubygems.pkg.github.com/seleniumhq" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Gems Nightly Windows | |
if: matrix.release == 'nightly' && matrix.os == 'windows-latest' | |
run: | |
| | |
$latest_nightly_webdriver = ./scripts/latest-nightly-version.ps1 rubygems selenium-webdriver | |
cd examples/ruby | |
bundle install | |
bundle remove selenium-webdriver | |
bundle add selenium-webdriver --version $latest_nightly_webdriver --source "https://token:${{secrets.GITHUB_TOKEN}}@rubygems.pkg.github.com/seleniumhq" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Gems Stable | |
if: matrix.release == 'stable' | |
working-directory: ./examples/ruby | |
run: bundle install | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 11 | |
- name: Install and Configure Safari and WebDriver | |
if: matrix.os == 'macos-latest' | |
run: | | |
# Check if safaridriver exists | |
if [[ ! -x "/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver" ]]; then | |
echo "safaridriver not found. Exiting." | |
exit 1 | |
fi | |
- name: Run tests | |
uses: nick-invision/[email protected] | |
with: | |
timeout_minutes: 20 | |
max_attempts: 3 | |
command: | | |
cd examples/ruby | |
bundle exec rspec |