Keycloak
38 строк · 1.4 Кб
1name: Install Chrome browser and driver for Testing
2description: Download and install the latest available Chrome for Testing and Chromedriver
3
4runs:
5using: composite
6steps:
7- id: cache-chrome-browser
8name: Chrome browser cache
9uses: actions/cache@v3
10with:
11path: ./chrome
12key: chrome
13
14- id: cache-chromedriver
15name: Chrome driver cache
16uses: actions/cache@v3
17with:
18path: ./chromedriver
19key: chromedriver
20
21- id: install-chrome
22name: Install Chrome
23shell: bash
24run: |
25sudo apt-get remove google-chrome-stable
26npx @puppeteer/browsers install chrome
27npx @puppeteer/browsers install chromedriver
28# In case there's more than one version of each package, let's use only the latest
29LATEST_CHROME=$(ls -td $PWD/chrome/*/ | head -1)
30LATEST_CHROMEDRIVER=$(ls -td $PWD/chromedriver/*/ | head -1)
31sudo ln -s -f "${LATEST_CHROME}chrome-linux64/chrome" /usr/bin/google-chrome-stable
32sudo cp -u "${LATEST_CHROMEDRIVER}chromedriver-linux64/chromedriver" $CHROMEWEBDRIVER/
33# Remove any older version of browser or driver so we don't keep it in the cache
34cd chrome
35rm -R $(ls -lt | grep '^d' | tail -1 | tr " " "\n" | tail -1)
36cd ../chromedriver
37rm -R $(ls -lt | grep '^d' | tail -1 | tr " " "\n" | tail -1)
38cd ..
39