Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"enabledManagers": ["custom.regex"],
"timezone": "America/Sao_Paulo",
"customManagers": [
{
"customType": "regex",
"managerFilePatterns": ["/^docker-compose\\.saas\\.yml$/"],
"matchStrings": [
"version=(?<currentValue>v\\d+\\.\\d+\\.\\d+) pin=(?<currentDigest>[0-9a-f]{40});.*? fetch -q (?<packageName>https:\\/\\/\\S+?\\.git) "
],
"datasourceTemplate": "git-tags",
"depNameTemplate": "{{{replace '^.*/(.+)\\.git$' '$1' packageName}}}",
"versioningTemplate": "semver-coerced"
}
],
"packageRules": [
{
"matchManagers": ["custom.regex"],
"schedule": ["* * * * 1"]
}
]
}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ stack. During `make up site`, the `site/` clone is also synced from
`https://github.com/LibreSign/site.git` (`main`) automatically, so no manual
site update step is required.

The site, the Nextcloud apps and the LibreSign WordPress plugins and theme follow
the `main` branch of their repositories. Polylang Pro and WooCommerce
Subscriptions come from third-party mirrors, so `docker-compose.saas.yml` pins
them to the commit of a release tag (`version=` and `pin=`). Renovate
(`.github/renovate.json5`) checks the mirrors on Mondays and opens a pull request
when a new release is tagged.

On a fresh WordPress database, `make up` also performs the initial WordPress
installation via WP-CLI and restarts the WordPress container once so the
`wordpress-docker` entrypoint can install the configured plugins and themes.
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.saas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ services:
- slug: polylang-pro
source: https://gitlab.com/wordpress-premium/polylang-pro
post_install_commands:
- version=v3.7.6 pin=851df56e647a4c19450d69ddff9c77aa67963a0d; [ "$$(git -C "$$PLUGIN_DIR" rev-parse HEAD)" = "$$pin" ] || { git -C "$$PLUGIN_DIR" fetch -q https://gitlab.com/wordpress-premium/polylang-pro.git "$$pin" && git -C "$$PLUGIN_DIR" checkout -q FETCH_HEAD; } || echo "Could not check out $$PLUGIN_DIR at $$version ($$pin), keeping the current commit" >&2
- if [ ! -L "$$PLUGIN_DIR/integrations/ACF" ]; then rm -rf "$$PLUGIN_DIR/integrations/ACF" && ln -s acf "$$PLUGIN_DIR/integrations/ACF"; fi || true
- slug: libresign-wp-customizations
source: https://github.com/LibreSign/libresign-wp-customizations.git
Expand All @@ -54,6 +55,9 @@ services:
source: https://github.com/LibreSign/woocommerce-restrict-switch.git
- slug: woocommerce-subscriptions
source: https://github.com/pronamic/woocommerce-subscriptions.git
post_install_commands:
- version=v9.4.1 pin=2459d9c8662884d62b9a92221eb21c7c6c051a62; [ "$$(git -C "$$PLUGIN_DIR" rev-parse HEAD)" = "$$pin" ] || { git -C "$$PLUGIN_DIR" fetch -q https://github.com/pronamic/woocommerce-subscriptions.git "$$pin" && git -C "$$PLUGIN_DIR" checkout -q FETCH_HEAD; } || echo "Could not check out $$PLUGIN_DIR at $$version ($$pin), keeping the current commit" >&2
- wp option update woocommerce_subscriptions_apportion_recurring_price yes-upgrade
wordpress_custom_themes:
- slug: libresign
source: https://github.com/LibreSign/wordpress-theme.git
Expand Down
6 changes: 4 additions & 2 deletions tests/E2E/PlanChange.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test';

import { nextcloud } from './support/nextcloud';
import { agreeToTheTerms, aSubscriber, logInToTheStore, placeTheOrder, plansInTheStore, STORE_URL } from './support/store';
import { subscriptionStatus } from './support/wordpress';
import { orderTotal, subscriptionStatus } from './support/wordpress';

const GIGABYTE = 1024 ** 3;

Expand All @@ -23,7 +23,7 @@ test.describe( 'Changing plan', () => {
await expect( page.getByRole( 'link', { name: 'Professional', exact: true } ) ).toHaveCount( 0 );
} );

test( 'upgrading from Basic to Enterprise raises the workspace storage to 800 GB', async ( { browser, page } ) => {
test( 'upgrading from Basic to Enterprise charges the prorated difference and raises the workspace storage to 800 GB', async ( { browser, page } ) => {
const { customer, subscriptionId } = await aSubscriber( page, 'Nilo' );
await logInToTheStore( page, customer.email, customer.password );

Expand All @@ -37,6 +37,8 @@ test.describe( 'Changing plan', () => {
await page.getByRole( 'button', { name: 'Switch subscription' } ).click();
await expect( page ).toHaveURL( /\/checkout\/order-received\/\d+\//, { timeout: 90_000 } );

const switchOrderId = Number( page.url().match( /order-received\/(\d+)\// )![ 1 ] );
expect( orderTotal( switchOrderId ) ).toBeGreaterThan( 0 );
expect( subscriptionStatus( subscriptionId ) ).toBe( 'active' );
expect( await nextcloud.account( customer.email ) ).toMatchObject( { enabled: true, quota: { quota: 800 * GIGABYTE } } );
await nextcloud.expectToLogIn( browser, customer.email, customer.password );
Expand Down
1 change: 0 additions & 1 deletion tests/E2E/support/seed.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
'woocommerce_email_from_name' => 'LibreSign',
'woocommerce_email_from_address' => 'noreply@example.com',
'woocommerce_subscriptions_allow_switching' => 'grouped',
'woocommerce_subscriptions_apportion_recurring_price' => 'no',
'woocommerce_subscriptions_enable_early_renewal' => 'yes',
'woocommerce_subscriptions_enable_retry' => 'no',
'woocommerce_subscriptions_multiple_purchase' => 'yes',
Expand Down
4 changes: 4 additions & 0 deletions tests/E2E/support/wordpress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export function orderStatus( orderId: number ): string {
return wpEval( `echo wc_get_order( ${ orderId } )->get_status();` );
}

export function orderTotal( orderId: number ): number {
return Number( wpEval( `echo wc_get_order( ${ orderId } )->get_total();` ) );
}

export function runTheScheduledNextcloudSyncRetry( orderId: number ): void {
wpEval( `
if ( ! as_next_scheduled_action( 'agm_retry_nextcloud_sync', array( 'order_id' => ${ orderId } ), 'nextcloud-admin-group-manager' ) ) {
Expand Down
Loading