Skip to content

Commit

Permalink
Merge pull request #270 from moderntribe/2.0/chore/combine-bugfixes
Browse files Browse the repository at this point in the history
[2.0]: Chore - combine bugfixes
  • Loading branch information
defunctl authored Sep 15, 2023
2 parents 56c8bfa + 5223213 commit 9e2932f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 123 deletions.
104 changes: 1 addition & 103 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,113 +167,11 @@ jobs:

- name: Lint
run: pnpm lint

e2e-tests:
name: End-to-End Testing (via Playwright)
runs-on: ubuntu-latest
strategy:
fail-fast: false
needs: build
env:
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/wme-sitebuilder/tests/results/allure-report
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/wme-sitebuilder/tests/results/allure-results
DEFAULT_TIMEOUT_OVERRIDE: 30000
steps:
- name: Check Out Code
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 7
run_install: false

- name: Setup Node.js Environment
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Setup PHP, with Composer and Extensions
uses: shivammathur/setup-php@v2
with:
tools: composer:v2
php-version: '8.0'

- name: Setup Problem Matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: Prepare Node Modules Cache
id: cache-node-modules
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Prepare Composer Dependencies Cache
uses: actions/cache@v3
with:
path: |
${{needs.build.outputs.composer-files-dir}}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
# Install playwright's binary under custom directory to cache
- name: Set Playwright path (non-windows)
if: runner.os != 'Windows'
run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
- name: Set Playwright path (windows)
if: runner.os == 'Windows'
run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV

- name: Cache Playwright's binary
uses: actions/cache@v3
with:
# Playwright removes unused browsers automatically
# So does not need to add playwright version to key
key: ${{ runner.os }}-playwright-bin-v1
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Install Playwright Dependencies
run: |
npx playwright install chromium --with-deps
- name: Launch wp-env End-to-End Environment
working-directory: plugins/wme-sitebuilder
run: pnpm env:dev

- name: Run Sitebuilder End-to-End tests
timeout-minutes: 15
working-directory: plugins/wme-sitebuilder
run: pnpm test

- name: Generate Playwright E2E Test Report
if: success() || failure()
working-directory: plugins/wme-sitebuilder
run: pnpm exec allure generate --clean ${{ env.ALLURE_RESULTS_DIR }} --output ${{ env.ALLURE_REPORT_DIR }}

- name: Archive E2E Test Report
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: ${{ env.E2E_ARTIFACT }}
path: |
${{ env.ALLURE_RESULTS_DIR }}
${{ env.ALLURE_REPORT_DIR }}
if-no-files-found: ignore
retention-days: 5

deploy:
if: ${{ github.ref_name == 'main' || github.ref_name == '1.0-branch' || github.ref_name == '2.0-branch' }}
name: Deploy to Test Sites
needs: [build, lint, e2e-tests]
needs: [build, lint]
uses: ./.github/workflows/deploy.yml
secrets:
ssh-key: ${{ secrets.SITEBUILDER_SSH_PRIVATE_KEY }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/split.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- '*'

env:
GITHUB_TOKEN: ${{ secrets.SPLIT_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}

jobs:
packages_split:
Expand Down Expand Up @@ -41,8 +41,8 @@ jobs:
repository_name: '${{ matrix.package.split_repository }}'

# ↓ the user signed under the split commit
user_name: "bswatson"
user_email: "bwatson@liquidweb.com"
user_name: "Tr1b0t"
user_email: "[email protected].com"

# with tag
-
Expand All @@ -59,5 +59,5 @@ jobs:
repository_name: '${{ matrix.package.split_repository }}'

# ↓ the user signed under the split commit
user_name: "bswatson"
user_email: "bwatson@liquidweb.com"
user_name: "Tr1b0t"
user_email: "[email protected].com"
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tribe\WME\Sitebuilder\Plugins\PaymentGateways;

use Exception;
use Tribe\WME\Sitebuilder\Plugins\Plugin;

/**
Expand Down Expand Up @@ -134,20 +135,31 @@ public function action__woocommerce_paypal_payments_built_container( $container
return;
}

$onboarding = $container->get( 'onboarding.render' );
$settings = $container->get( 'wcgateway.settings' );

$this->connected = ( $settings->has( 'client_id' ) && ! empty( $settings->get( 'client_id' ) ) );

$this->oauth_urls = [
'advanced' => $onboarding->get_signup_link( true, [ 'PPCP' ] ),
'standard' => $onboarding->get_signup_link( true, [ 'EXPRESS_CHECKOUT' ] ),
];

$this->keys = [
'email_address' => $settings->has( 'merchant_email_production' ) ? $settings->get( 'merchant_email_production' ) : '',
'merchant_id' => $settings->has( 'merchant_id_production' ) ? $settings->get( 'merchant_id_production' ) : '',
'client_id' => $settings->has( 'client_id_production' ) ? $settings->get( 'client_id_production' ) : '',
];
try {
/** @var \WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingRenderer $onboarding */
$onboarding = $container->get( 'onboarding.render' );
/** @var \WooCommerce\PayPalCommerce\WcGateway\Settings\Settings $settings */
$settings = $container->get( 'wcgateway.settings' );

$this->connected = ( $settings->has( 'client_id' ) && ! empty( $settings->get( 'client_id' ) ) );

$this->oauth_urls = [
'advanced' => $onboarding->get_signup_link( true, [ 'PPCP' ] ),
'standard' => $onboarding->get_signup_link( true, [ 'EXPRESS_CHECKOUT' ] ),
];

$this->keys = [
'email_address' => $settings->has( 'merchant_email_production' ) ? $settings->get( 'merchant_email_production' ) : '',
'merchant_id' => $settings->has( 'merchant_id_production' ) ? $settings->get( 'merchant_id_production' ) : '',
'client_id' => $settings->has( 'client_id_production' ) ? $settings->get( 'client_id_production' ) : '',
];
} catch ( Exception $e ) {
// Log to the same place WC PayPal Payments would.
$container->get( 'woocommerce.logger.woocommerce' )->error( $e->getMessage() );

if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( "[WME] WC PayPal Payments Plugin threw an exception: {$e->getMessage()} {$e->getFile()}:{$e->getLine()}" );
}
}
}
}

0 comments on commit 9e2932f

Please sign in to comment.