From 4395dce7ee01d54c4ccbdb88f5a857c1d3f647bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scheibe?= Date: Fri, 11 Feb 2022 20:25:04 +0100 Subject: [PATCH] Use the pre-installed Chrome driver when running on GitHub 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 --- .github/workflows/gradle.yml | 3 --- build.gradle | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 25cb0390..77b644e7 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -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: diff --git a/build.gradle b/build.gradle index 244b267a..ec117019 100644 --- a/build.gradle +++ b/build.gradle @@ -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 {