Skip to content

Commit

Permalink
Use the pre-installed Chrome driver when running on GitHub
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 committed Feb 11, 2022
1 parent 7ae7a4e commit 04b6f46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 2 additions & 5 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 All @@ -30,15 +27,15 @@ jobs:
id: tests
uses: gradle/gradle-build-action@v2
with:
arguments: check -Dgeb.env=chromeHeadless
arguments: check -Dgeb.env=chromeHeadless -Dwebdriver.chrome.driver='${{ env.CHROMEWEBDRIVER }}'
- name: Run Build
if: github.event_name == 'push'
id: build
uses: gradle/gradle-build-action@v2
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
with:
arguments: build -Dgeb.env=chromeHeadless
arguments: build -Dgeb.env=chromeHeadless -Dwebdriver.chrome.driver='${{ env.CHROMEWEBDRIVER }}'
- name: Publish Test Report
if: steps.build.outcome == 'failure' || steps.tests.outcome == 'failure'
uses: scacap/action-surefire-report@v1
Expand Down
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ 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) {
Expand Down

0 comments on commit 04b6f46

Please sign in to comment.