Skip to content

Commit

Permalink
Use the pre-installed Chrome driver when running on GitHub (#123)
Browse files Browse the repository at this point in the history
The GitHub virtual environment already provides a Chrome and a matching Chrome driver.

For installed software see:
https://github.com/actions/virtual-environments/blob/ubuntu20/20220207.1/images/linux/Ubuntu2004-Readme.md#environment-variables-1

For available environment variables see:
https://docs.github.com/en/actions/learn-github-actions/environment-variables
  • Loading branch information
darxriggs authored Feb 12, 2022
1 parent 7ae7a4e commit f77a3c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ jobs:
GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8
steps:
- uses: actions/checkout@v2
- uses: nanasess/setup-chromedriver@v1.0.5
with:
chromedriver-version: '96.0.4664.45'
- name: Set up JDK
uses: actions/setup-java@v2
with:
Expand Down
16 changes: 12 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,23 @@ dependencies {
apply from: rootProject.file('gradle/testVerbose.gradle')

webdriverBinaries {
chromedriver "$chromeDriverVersion"
geckodriver "$geckodriverVersion"
if (!System.getenv().containsKey('GITHUB_ACTIONS')) {
chromedriver "$chromeDriverVersion"
geckodriver "$geckodriverVersion"
}
}

tasks.withType(Test) {
systemProperty "geb.env", "chromeHeadless"
systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
systemProperty "webdriver.chrome.driver", System.getProperty('webdriver.chrome.driver')
systemProperty "webdriver.gecko.driver", System.getProperty('webdriver.gecko.driver')

if (!System.getenv().containsKey('GITHUB_ACTIONS')) {
systemProperty 'webdriver.chrome.driver', System.getProperty('webdriver.chrome.driver')
systemProperty 'webdriver.gecko.driver', System.getProperty('webdriver.gecko.driver')
} else {
systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver"
systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver"
}
}

bootRun {
Expand Down

0 comments on commit f77a3c0

Please sign in to comment.