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
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

TEST_PATH="${TEST_PATH:-integration_test/payment/desktop_stripe_checkout_smoke_test.dart}"
ARTIFACT_DIR="${ARTIFACT_DIR:-smoke-artifacts/macos-payment-checkout}"
TEST_PATH="${TEST_PATH:-integration_test/payment/desktop_payment_smoke_test.dart}"
ARTIFACT_DIR="${ARTIFACT_DIR:-smoke-artifacts/macos-payment-smoke}"
LANTERN_DATA_DIR="/Users/Shared/Lantern"
LANTERN_LOG_DIR="$LANTERN_DATA_DIR/Logs"
SCREENSHOT_PATH="$ARTIFACT_DIR/stripe-checkout.png"
Expand All @@ -17,20 +17,29 @@ cleanup() {
exit "$status"
}

# This script deletes the shared Lantern data directory.
if [[ -z "${CI:-}" ]]; then
echo "Refusing to run outside CI: this wipes $LANTERN_DATA_DIR" >&2
exit 1
fi

trap cleanup EXIT

pkill -x Lantern 2>/dev/null || true
rm -rf "$LANTERN_DATA_DIR"
mkdir -p "$LANTERN_DATA_DIR"
mkdir -p "$LANTERN_LOG_DIR"
mkdir -p "$ARTIFACT_DIR"

# The debug test build reads this marker before initializing Radiance.
touch "$LANTERN_DATA_DIR/.radiance_env"

flutter test \
"$TEST_PATH" \
-d macos \
--reporter=expanded \
--dart-define=DISABLE_SYSTEM_TRAY=true \
--dart-define=PAYMENT_SMOKE_SCREENSHOT_PATH="$SCREENSHOT_PATH" \
--dart-define=RADIANCE_ENV=staging
--dart-define=PAYMENT_SMOKE_ARTIFACT_DIR="$ARTIFACT_DIR"

if [[ ! -s "$SCREENSHOT_PATH" ]]; then
echo "Stripe Checkout screenshot was not created" >&2
Expand Down
52 changes: 39 additions & 13 deletions .github/scripts/windows_smoke_suite.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ param(
[string]$ServiceExe = "build/windows/x64/runner/Release/lanternd.exe",
[string]$InstallerPath = "",
[string]$TestPath = "integration_test/vpn/windows_connect_smoke_test.dart",
[string]$PaymentCheckoutTestPath = "integration_test/payment/desktop_stripe_checkout_smoke_test.dart",
[string]$PaymentSmokeTestPath = "integration_test/payment/desktop_payment_smoke_test.dart",
[string]$SplitTunnelWebsiteTestPath = "integration_test/vpn/split_tunneling_website_smoke_test.dart",
[string]$ConfigUrlApiTestPath = "integration_test/vpn/windows_config_url_api_smoke_test.dart",
[string]$ConfigUrlUiTestPath = "integration_test/vpn/windows_config_url_smoke_test.dart",
Expand All @@ -19,7 +19,8 @@ param(
[switch]$ForceFullTunnel,
[switch]$RunSplitTunnelWebsiteSmoke,
[switch]$RunConfigUrlSmoke,
[switch]$RunPaymentCheckoutSmoke,
[switch]$RunPaymentSmoke,
[string]$PaymentSmokeArtifactDirectory = "build/windows-payment-smoke",
[switch]$UseInstaller
)

Expand Down Expand Up @@ -136,11 +137,12 @@ function Invoke-FlutterSmokeTest {
[string]$Description,
[ValidateSet("prod", "staging")]
[string]$RadianceEnvironment = "prod",
[string[]]$DartDefines = @(),
[switch]$EnableIpCheck,
[switch]$ForceFullTunnel
)

$args = @(
$flutterArgs = @(
"test",
$Path,
"-d",
Expand All @@ -149,18 +151,22 @@ function Invoke-FlutterSmokeTest {
"--dart-define=DISABLE_SYSTEM_TRAY=true"
)

$args += "--dart-define=RADIANCE_ENV=$RadianceEnvironment"
$flutterArgs += "--dart-define=RADIANCE_ENV=$RadianceEnvironment"

foreach ($define in $DartDefines) {
$flutterArgs += "--dart-define=$define"
}

if ($EnableIpCheck) {
$args += "--dart-define=ENABLE_IP_CHECK=true"
$flutterArgs += "--dart-define=ENABLE_IP_CHECK=true"
}

if ($ForceFullTunnel) {
$args += "--dart-define=SMOKE_FORCE_FULL_TUNNEL=true"
$flutterArgs += "--dart-define=SMOKE_FORCE_FULL_TUNNEL=true"
}

Write-Step ("Running {0}: flutter {1}" -f $Description, ($args -join " "))
& flutter @args
Write-Step ("Running {0}: flutter {1}" -f $Description, ($flutterArgs -join " "))
& flutter @flutterArgs
if ($LASTEXITCODE -ne 0) {
throw "$Description failed with exit code $LASTEXITCODE"
}
Expand Down Expand Up @@ -330,13 +336,21 @@ try {
Write-Step "Skipping Windows connect smoke test."
}

if ($RunPaymentCheckoutSmoke) {
if ($RunPaymentSmoke) {
if ($ServiceEnvironment -ne "staging") {
throw "Payment smoke requires -ServiceEnvironment staging (got '$ServiceEnvironment')"
}
$paymentDefines = @(
"PAYMENT_E2E_ENABLED=true",
"PAYMENT_SMOKE_ARTIFACT_DIR=$PaymentSmokeArtifactDirectory"
)
Invoke-FlutterSmokeTest `
-Path $PaymentCheckoutTestPath `
-Description "Windows Stripe checkout smoke test" `
-RadianceEnvironment $ServiceEnvironment
-Path $PaymentSmokeTestPath `
-Description "Windows payment smoke test" `
-RadianceEnvironment $ServiceEnvironment `
-DartDefines $paymentDefines
} else {
Write-Step "Skipping Windows Stripe checkout smoke test."
Write-Step "Skipping Windows payment smoke test."
}

if ($RunSplitTunnelWebsiteSmoke) {
Expand Down Expand Up @@ -384,6 +398,18 @@ try {
}
}
finally {
if ($RunPaymentSmoke) {
try {
$paymentLogDirectory = Join-Path $PaymentSmokeArtifactDirectory "logs"
New-Item -ItemType Directory -Force -Path $paymentLogDirectory | Out-Null
$lanternLogDirectory = "C:\Users\Public\Lantern\logs"
if (Test-Path $lanternLogDirectory) {
Copy-Item "$lanternLogDirectory\*" $paymentLogDirectory -Recurse -Force -ErrorAction SilentlyContinue
}
} catch {
Write-Warning ("Failed to collect payment smoke logs: {0}" -f $_)
}
}
try {
Write-Step "Starting cleanup"
if ($UseInstaller) {
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/app-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ on:
type: choice
options:
- vpn-smoke # connect/disconnect smoke only (validates the public IP changes) — the fast confidence check
- payment-smoke # Stripe Checkout rendering and payment-to-Pro conversion
- all # every suite the platform supports
default: vpn-smoke
linux_arch:
Expand Down Expand Up @@ -53,7 +54,7 @@ jobs:
# retries; `all` builds the full aggregator on the script's two-device
# matrix (physical Pixel 8 + Arm virtual) with retries for flaky tests.
android:
if: ${{ contains(fromJSON('["all", "android", ""]'), inputs.platforms) }}
if: ${{ contains(fromJSON('["all", "android", ""]'), inputs.platforms) && (inputs.tests || 'all') != 'payment-smoke' }}
uses: ./.github/workflows/firebase-test-lab.yml
secrets: inherit
with:
Expand Down Expand Up @@ -107,7 +108,7 @@ jobs:
# to the optional suites: vpn-smoke leaves them off, `all` turns them on.
linux:
needs: prepare
if: ${{ contains(fromJSON('["all", "linux", ""]'), inputs.platforms) }}
if: ${{ contains(fromJSON('["all", "linux", ""]'), inputs.platforms) && (inputs.tests || 'all') != 'payment-smoke' }}
uses: ./.github/workflows/build-linux.yml
secrets: inherit
with:
Expand All @@ -131,8 +132,8 @@ jobs:
build_type: nightly
installer_base_name: ${{ needs.prepare.outputs.installer_base_name }}
runner_label: lantern-macos-smoke
run_connect_smoke: true
run_payment_checkout_smoke: ${{ (inputs.tests || 'all') == 'all' }}
run_connect_smoke: ${{ (inputs.tests || 'all') != 'payment-smoke' }}
run_payment_smoke: ${{ contains(fromJSON('["all", "payment-smoke"]'), inputs.tests || 'all') }}

windows:
needs: prepare
Expand All @@ -145,6 +146,7 @@ jobs:
installer_base_name: ${{ needs.prepare.outputs.installer_base_name }}
skip_signing: true
force_full_tunnel_smoke: true
run_connect_smoke: ${{ (inputs.tests || 'all') != 'payment-smoke' }}
run_auth_smoke: ${{ (inputs.tests || 'all') == 'all' }}
run_split_tunnel_website_smoke: ${{ (inputs.tests || 'all') == 'all' }}
run_payment_checkout_smoke: ${{ (inputs.tests || 'all') == 'all' }}
run_payment_smoke: ${{ contains(fromJSON('["all", "payment-smoke"]'), inputs.tests || 'all') }}
16 changes: 8 additions & 8 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ on:
required: false
type: boolean
default: false
run_payment_checkout_smoke:
run_payment_smoke:
description: "Verify staging Stripe Checkout in a Flutter integration test"
required: false
type: boolean
Expand Down Expand Up @@ -201,21 +201,21 @@ jobs:
- name: Run macOS unit tests
run: make macos-unit-tests

- name: macOS Stripe checkout smoke
if: ${{ inputs.run_payment_checkout_smoke }}
- name: macOS payment smoke
if: ${{ inputs.run_payment_smoke }}
timeout-minutes: 15
shell: bash
env:
ARTIFACT_DIR: ${{ runner.temp }}/macos-payment-checkout-smoke
run: bash ./.github/scripts/macos_payment_checkout_smoke.sh
ARTIFACT_DIR: ${{ runner.temp }}/macos-payment-smoke
run: bash ./.github/scripts/macos_payment_smoke.sh

- name: Upload macOS payment smoke diagnostics
if: ${{ always() && inputs.run_payment_checkout_smoke }}
if: ${{ always() && inputs.run_payment_smoke }}
id: payment_smoke_diagnostics
uses: actions/upload-artifact@v4
with:
name: macos-payment-checkout-smoke
path: ${{ runner.temp }}/macos-payment-checkout-smoke
name: macos-payment-smoke
path: ${{ runner.temp }}/macos-payment-smoke
if-no-files-found: ignore
retention-days: 2

Expand Down
25 changes: 17 additions & 8 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ on:
required: false
type: boolean
default: true
run_payment_smoke:
description: "Verify staging checkout rendering and payment-to-Pro conversion"
required: false
type: boolean
default: false
run_split_tunnel_website_smoke:
description: "Run website split tunneling smoke test"
required: false
Expand All @@ -54,11 +59,6 @@ on:
required: false
type: boolean
default: false
run_payment_checkout_smoke:
description: "Verify staging Stripe Checkout in a Flutter integration test"
required: false
type: boolean
default: false

jobs:
build-windows:
Expand Down Expand Up @@ -206,16 +206,25 @@ jobs:
Write-Warning "Release directory does not exist"
}

- name: Windows Stripe checkout smoke
if: ${{ inputs.run_payment_checkout_smoke }}
- name: Windows payment smoke
if: ${{ inputs.run_payment_smoke }}
shell: pwsh
timeout-minutes: 15
run: |
./.github/scripts/windows_smoke_suite.ps1 `
-ServiceExe "build/windows/x64/runner/Release/lanternd.exe" `
-ServiceEnvironment staging `
-RunConnectSmoke:$false `
-RunPaymentCheckoutSmoke
-RunPaymentSmoke

- name: Upload Windows payment smoke diagnostics
if: ${{ always() && inputs.run_payment_smoke }}
uses: actions/upload-artifact@v4
with:
name: windows-payment-smoke
path: build/windows-payment-smoke
if-no-files-found: ignore
retention-days: 7

- name: Sign embedded binaries
if: ${{ !inputs.skip_signing }}
Expand Down
Loading
Loading