Skip to content

Commit 090d09d

Browse files
marssterlzbd
andauthored
Don't use junk paths arg when unzipping (#7)
* dont use -j (junk paths) option when unzipping chrome/chromedriver * fix paths * CI tests should find the installed executables * Installs more than just executables, so remove nesting in bin/ --------- Co-authored-by: Sterling Brim-DeForest <[email protected]>
1 parent 3eba985 commit 090d09d

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

.github/workflows/build-and-test.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ jobs:
1010
- uses: actions/checkout@v3
1111

1212
- name: Run Buildpack Compile
13-
run: ./bin/compile . . .
13+
run: |
14+
./bin/compile . . .
1415
env:
1516
STACK: heroku-22
1617

1718
- name: Check Installation
1819
run: |
19-
.chrome-for-testing/bin/chrome --version
20-
.chrome-for-testing/bin/chromedriver --version
20+
# Trick the profile script into using working dir as HOME
21+
HOME="$(pwd)"
22+
# Verify profile script puts Chrome & Chromedriver on the PATH
23+
source .profile.d/chrome-for-testing.sh
24+
chrome --version
25+
chromedriver --version

bin/compile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ function indent() {
3434
topic "Installing Chrome for Testing"
3535

3636
INSTALL_DIR="$BUILD_DIR/.chrome-for-testing"
37-
BIN_DIR="$INSTALL_DIR/bin"
38-
mkdir -p "$BIN_DIR"
37+
mkdir -p "$INSTALL_DIR"
3938

4039
# Detect if the old config var is still used
4140
if [ -f "$ENV_DIR/CHROMEDRIVER_VERSION" ]; then
@@ -63,24 +62,24 @@ echo "Downloading Chrome" | indent
6362
ZIP_URL="https://storage.googleapis.com/chrome-for-testing-public/$VERSION/linux64/chrome-linux64.zip"
6463
ZIP_LOCATION="$INSTALL_DIR/chrome.zip"
6564
curl --silent --show-error --fail --retry 3 --retry-connrefused --connect-timeout 10 -o "${ZIP_LOCATION}" "${ZIP_URL}" | indent
66-
unzip -q -j -o "$ZIP_LOCATION" -d "$BIN_DIR" | indent
65+
unzip -q -o "$ZIP_LOCATION" -d "$INSTALL_DIR" | indent
6766
rm -f "$ZIP_LOCATION"
6867

6968
echo "Downloading Chromedriver" | indent
7069
ZIP_URL="https://storage.googleapis.com/chrome-for-testing-public/$VERSION/linux64/chromedriver-linux64.zip"
7170
ZIP_LOCATION="$INSTALL_DIR/chromedriver.zip"
7271
curl --silent --show-error --fail --retry 3 --retry-connrefused --connect-timeout 10 -o "${ZIP_LOCATION}" "${ZIP_URL}" | indent
73-
unzip -q -j -o "$ZIP_LOCATION" -d "$BIN_DIR" | indent
72+
unzip -q -o "$ZIP_LOCATION" -d "$INSTALL_DIR" | indent
7473
rm -f "$ZIP_LOCATION"
7574

7675
source "$BUILDPACK_DIR/bin/install-chrome-dependencies"
7776

7877
echo "Adding executables to PATH" | indent
7978
mkdir -p "$BUILD_DIR/.profile.d"
80-
echo "export PATH=\$HOME/.chrome-for-testing/bin:\$PATH" >> "$BUILD_DIR/.profile.d/chrome-for-testing.sh"
79+
echo "export PATH=\$HOME/.chrome-for-testing/chrome-linux64:\$HOME/.chrome-for-testing/chromedriver-linux64:\$PATH" >> "$BUILD_DIR/.profile.d/chrome-for-testing.sh"
8180

8281
# Verify the executables are actually present
83-
export PATH="$BUILD_DIR/.chrome-for-testing/bin:$PATH"
82+
export PATH="$BUILD_DIR/.chrome-for-testing/chrome-linux64:$BUILD_DIR/.chrome-for-testing/chromedriver-linux64:$PATH"
8483
which chrome | indent
8584
which chromedriver | indent
8685

0 commit comments

Comments
 (0)