-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add logic to install woocommerce subscription for e2e tests
- Loading branch information
Showing
5 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
branches: | ||
- smoke-testing | ||
pull_request: | ||
types: [opened, synchronize, reopened, labeled] | ||
types: [ opened, synchronize, reopened, labeled ] | ||
branches: | ||
- trunk | ||
|
||
|
@@ -32,14 +32,22 @@ jobs: | |
key: node-${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Node install | ||
run: | | ||
npm install | ||
run: npm install | ||
|
||
- name: Build | ||
run: | | ||
npm run build | ||
run: npm run build | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install chromium | ||
|
||
- name: Install required WP plugins | ||
run: | | ||
URL_CONFIG="url.https://${{ secrets.BOT_GH_TOKEN }}:[email protected]/.insteadOf [email protected]:" | ||
git config --global $URL_CONFIG | ||
npm run env:install-plugins | ||
git config --global --unset $URL_CONFIG | ||
- name: Setup WP environment | ||
run: npm run env:start | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,4 @@ build | |
|
||
woocommerce-gateway-payfast.zip | ||
tests/e2e/test-results | ||
./tests/e2e/test-plugins/woocommerce-subscriptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# Clone latest version of a plugin (fallback to default branch if latest version is not found) | ||
install_plugin_from_repo() { | ||
local PLUGIN_SLUG=$1 | ||
local DIR=$2 | ||
|
||
rm -rf "${DIR}" | ||
git clone --quiet --depth=1 "[email protected]:woocommerce/${PLUGIN_SLUG}.git" "${DIR}" | ||
|
||
# Parse latest version from main plugin file | ||
local LATEST_VERSION=$(grep -o '\* Version:.*' ${DIR}/${PLUGIN_SLUG}.php | sed 's/* Version://' | tr -d ' ') | ||
echo Latest version ${LATEST_VERSION} for ${PLUGIN_SLUG} | ||
|
||
# Fetch a specific tag | ||
cd "${DIR}" | ||
git fetch --depth 1 "[email protected]:woocommerce/${PLUGIN_SLUG}.git" tag "${LATEST_VERSION}" | ||
|
||
# If the latest version tag is available then switch | ||
if [ $(git tag -l "${LATEST_VERSION}") ]; then | ||
git checkout "${LATEST_VERSION}" --quiet | ||
fi | ||
|
||
cd - | ||
} | ||
|
||
# Install Subscriptions. | ||
install_plugin_from_repo "woocommerce-subscriptions" "./tests/e2e/test-plugins/woocommerce-subscriptions" | ||
cd ./tests/e2e/test-plugins/woocommerce-subscriptions | ||
npm install && npm run build | ||
cd - |