devops: cache downloaded drivers (#122)
This commit is contained in:
@@ -26,7 +26,13 @@ jobs:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
- name: Install driver
|
||||
- name: Cache Downloaded Drivers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: driver-bundle/src/main/resources/driver
|
||||
key: ${{ runner.os }}-drivers-${{ hashFiles('scripts/*') }}
|
||||
restore-keys: ${{ runner.os }}-drivers
|
||||
- name: Download drivers
|
||||
shell: bash
|
||||
run: scripts/download_driver_for_all_platforms.sh
|
||||
- name: Build with Maven
|
||||
|
||||
+2
-2
@@ -11,10 +11,10 @@ git clone https://github.com/microsoft/playwright-java
|
||||
cd playwright-java
|
||||
```
|
||||
|
||||
2. Run the following script to download playwright-cli binary for your platform into `driver/src/main/resources/driver/` directory. It will also install Playwright and download browser binaries for Chromium, Firefox and WebKit.
|
||||
2. Run the following script to download playwright-cli binaries for all platforms into `driver-bundle/src/main/resources/driver/` directory. It will also install Playwright and download browser binaries for Chromium, Firefox and WebKit.
|
||||
|
||||
```bash
|
||||
scripts/install_local_driver.sh
|
||||
scripts/download_driver_for_all_platforms.sh
|
||||
```
|
||||
|
||||
Names of published driver archives can be found at https://github.com/microsoft/playwright-cli/actions
|
||||
|
||||
@@ -9,39 +9,49 @@ cd "$(dirname $0)"
|
||||
CLI_VERSION=$(head -1 ./CLI_VERSION)
|
||||
FILE_PREFIX=playwright-cli-$CLI_VERSION
|
||||
|
||||
cd ../driver/src/main/resources
|
||||
cd ../driver-bundle/src/main/resources
|
||||
|
||||
if [[ -d local-driver ]]; then
|
||||
echo "$(pwd)/driver already exists, delete it first"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
mkdir local-driver
|
||||
cd local-driver
|
||||
echo "Created directory: $(pwd)"
|
||||
|
||||
FILE_NAME="unknown"
|
||||
PLATFORM="unknown"
|
||||
case $(uname) in
|
||||
Darwin)
|
||||
FILE_NAME=${FILE_PREFIX}-mac.zip
|
||||
PLATFORM=mac
|
||||
echo "Downloading driver for macOS"
|
||||
;;
|
||||
Linux)
|
||||
FILE_NAME=${FILE_PREFIX}-linux.zip
|
||||
PLATFORM=linux
|
||||
echo "Downloading driver for Linux"
|
||||
;;
|
||||
MINGW32*)
|
||||
FILE_NAME=${FILE_PREFIX}-win32.zip
|
||||
echo "Downloading driver for Windows"
|
||||
PLATFORM=win32
|
||||
echo "Downloading driver for Win32"
|
||||
;;
|
||||
MINGW64*)
|
||||
FILE_NAME=${FILE_PREFIX}-win32_x64.zip
|
||||
echo "Downloading driver for Windows"
|
||||
PLATFORM=win32_x64
|
||||
echo "Downloading driver for Win64"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown platform '$(uname)'"
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
|
||||
mkdir -p driver
|
||||
cd driver
|
||||
if [[ -d $PLATFORM ]]; then
|
||||
echo "$(pwd)/$PLATFORM already exists, delete it first"
|
||||
exit 1
|
||||
fi
|
||||
mkdir $PLATFORM
|
||||
cd $PLATFORM
|
||||
|
||||
FILE_NAME=$FILE_PREFIX-$PLATFORM.zip
|
||||
echo "Downloading driver for $PLATFORM to $(pwd)"
|
||||
|
||||
curl -O https://playwright.azureedge.net/builds/cli/next/${FILE_NAME}
|
||||
unzip ${FILE_NAME} -d .
|
||||
rm $FILE_NAME
|
||||
|
||||
Reference in New Issue
Block a user