Skip to content

ci: temp hack: update windows chrome/chromedriver #247

ci: temp hack: update windows chrome/chromedriver

ci: temp hack: update windows chrome/chromedriver #247

Workflow file for this run

name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
setup:
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.set-tests.outputs.tests }}
steps:
- uses: actions/checkout@v4
- name: Clojure deps cache
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.deps.clj
~/.gitlibs
key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }}
restore-keys: cljdeps-
- name: "Setup Java"
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Install Clojure Tools
uses: DeLaGuardo/[email protected]
with:
bb: 'latest'
# This assumes downloaded deps are same for all OSes
- name: Bring down deps
run: bb download-deps
- id: set-tests
name: Set test var for matrix
# run test.clj directly instead of via bb task to avoid generic task output
run: echo "tests=$(bb script/test_matrix.clj --format json)" >> $GITHUB_OUTPUT
build:
needs: setup
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
include: ${{fromJSON(needs.setup.outputs.tests)}}
name: ${{ matrix.desc }}
steps:
- name: Tune Windows network
if: ${{ matrix.os == 'windows' }}
run: Disable-NetAdapterChecksumOffload -Name * -TcpIPv4 -UdpIPv4 -TcpIPv6 -UdpIPv6
- name: Tune macOS network
if: ${{ matrix.os == 'macos' }}
run: |
sudo sysctl -w net.link.generic.system.hwcksum_tx=0
sudo sysctl -w net.link.generic.system.hwcksum_rx=0
- name: Install Ubuntu X11 Utils
if: ${{ matrix.os == 'ubuntu' }}
run: sudo apt-get -y install x11-utils
- name: Install Linux Windows Manager
if: ${{ matrix.os == 'ubuntu' }}
run: sudo apt-get -y install fluxbox
# No longer pre-installed on macOS github action runners
- name: Install Image Magick on macOS
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'imagemagick') }}
run: brew install imagemagick
# No longer pre-installed on macOS github action runners
- name: Install Microsoft Edge on macOS
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'edge') }}
run: |
brew install --cask microsoft-edge
EDGE_VERSION=$(defaults read /Applications/Microsoft\ Edge.app/Contents/Info CFBundleShortVersionString)
DRIVER_URL="https://msedgedriver.azureedge.net/${EDGE_VERSION}/edgedriver_mac64_m1.zip"
curl -o msedgedriver.zip $DRIVER_URL
mkdir $RUNNER_TEMP/edgedriver
unzip msedgedriver.zip -d $RUNNER_TEMP/edgedriver
echo "$RUNNER_TEMP/edgedriver" >> $GITHUB_PATH
# No longer pre-installed on macOS github action runners
- name: Install Firefox on macOS
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'firefox') }}
run: |
brew install --cask firefox
brew install geckodriver
# Temporary hack for Windows chrome/chromedriver which seems broken for current Windows image-runner 20240421.1.0
# Try do download and install current Chrome browser and appropriate chromedriver just like Windows runner-image does:
# https://github.com/actions/runner-images/blob/main/images/windows/scripts/build/Install-Chrome.ps1
- name: Install Chrome Current
if: ${{ matrix.os == 'windows' && contains(matrix.needs, 'chrome') }}
run: |
Write-Host "Install Chrome Browser..."
Install-Binary `
-Url 'https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise64.msi' `
-ExpectedSignature '2673EA6CC23BEFFDA49AC715B121544098A1284C'
Write-Host "Install Chrome WebDriver..."
$chromeDriverPath = "$($env:SystemDrive)\SeleniumWebDrivers\ChromeDriver"
if (-not (Test-Path -Path $chromeDriverPath)) {
New-Item -Path $chromeDriverPath -ItemType Directory -Force
}
Write-Host "Get the Chrome WebDriver download URL..."
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"
$chromePath = (Get-ItemProperty "$registryPath\chrome.exe").'(default)'
[version] $chromeVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($chromePath).ProductVersion
$chromeBuild = "$($chromeVersion.Major).$($chromeVersion.Minor).$($chromeVersion.Build)"
$chromeDriverVersionsUrl = "https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build-with-downloads.json"
Write-Host "Chrome version is $chromeVersion"
$chromeDriverVersions = Invoke-RestMethod -Uri $chromeDriverVersionsUrl
$chromeDriverVersion = $chromeDriverVersions.builds.$chromeBuild
if (-not ($chromeDriverVersion)) {
$availableVersions = $chromeDriverVersions.builds | Get-Member | Select-Object -ExpandProperty Name
Write-Host "Available chromedriver builds are $availableVersions"
throw "Can't determine chromedriver version that matches chrome build $chromeBuild"
}
$chromeDriverVersion.version | Out-File -FilePath "$chromeDriverPath\versioninfo.txt" -Force;
Write-Host "Chrome WebDriver version to install is $($chromeDriverVersion.version)"
$chromeDriverZipDownloadUrl = ($chromeDriverVersion.downloads.chromedriver | Where-Object platform -eq "win64").url
Write-Host "Download Chrome WebDriver from $chromeDriverZipDownloadUrl..."
$chromeDriverArchPath = Invoke-DownloadWithRetry $chromeDriverZipDownloadUrl
Write-Host "Expand Chrome WebDriver archive (without using directory names)..."
Expand-7ZipArchive -Path $chromeDriverArchPath -DestinationPath $chromeDriverPath -ExtractMethod "e"
shell: pwsh
- uses: actions/checkout@v4
- name: Clojure deps cache
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.deps.clj
~/.gitlibs
key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }}
restore-keys: cljdeps-
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.jdk-version }}
- name: Install Clojure Tools
uses: DeLaGuardo/[email protected]
with:
bb: 'latest'
- name: Tools versions
run: bb tools-versions
- name: Run Tests
run: ${{ matrix.cmd }}