-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
129 lines (125 loc) · 4.13 KB
/
ruby-examples.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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:
tests:
strategy:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
release: [ stable, nightly ]
runs-on: ${{ format('{0}-latest', matrix.os) }}
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v4
- name: Remove driver directories Windows
if: matrix.os == 'windows'
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'
run: |
sudo rm -rf $CHROMEWEBDRIVER $EDGEWEBDRIVER $GECKOWEBDRIVER
- name: Setup Fluxbox and Xvfb
if: matrix.os == 'ubuntu'
run: |
sudo apt-get -y install fluxbox libxss1 libappindicator3-1 libindicator7
Xvfb :99 &
fluxbox -display :99 &
echo "DISPLAY=:99" >> "$GITHUB_ENV"
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- name: Install Gems Nightly non-Windows
if: matrix.release == 'nightly' && matrix.os != 'windows'
run:
|
pip install -r ./scripts/requirements.txt
latest_nightly_webdriver=$(python ./scripts/latest-nightly-version.py rubygems selenium-webdriver)
echo $latest_nightly_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'
run:
|
pip install -r ./scripts/requirements.txt
$latest_nightly_webdriver = python ./scripts/latest-nightly-version.py 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: Run tests on Windows
if: matrix.os == 'windows'
uses: nick-invision/[email protected]
with:
timeout_minutes: 20
max_attempts: 2
command: |
cd examples/ruby
bundle exec rspec
new_command_on_retry: |
cd examples/ruby; $env:DEBUG="true"; bundle exec rspec --only-failures --backtrace
- name: Run tests on ${{ matrix.os }}
if: matrix.os != 'windows'
uses: nick-invision/[email protected]
with:
timeout_minutes: 20
max_attempts: 2
command: |
cd examples/ruby
bundle exec rspec
new_command_on_retry: |
cd examples/ruby
DEBUG=true bundle exec rspec --only-failures --backtrace
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub repo
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- name: Install dependencies
working-directory: ./examples/ruby
run: bundle install
- name: Run RuboCop
working-directory: ./examples/ruby
run: bundle exec rubocop