Skip to content

E2E

E2E #2

Workflow file for this run

name: E2E
on:
workflow_dispatch:
schedule:
- cron: "0 6 * * *"
permissions: {}
jobs:
stripe:
name: Stripe E2E
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-stripe
cancel-in-progress: false
timeout-minutes: 60
permissions:
contents: read
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
CF_TUNNEL_HOST: ${{ vars.CF_TUNNEL_HOST_STRIPE || 't1.paykit.sh' }}
E2E_STRIPE_SK: ${{ secrets.E2E_STRIPE_SK }}
E2E_STRIPE_WHSEC: ${{ secrets.E2E_STRIPE_WHSEC }}
TEST_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/postgres
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.13
- name: Install workspace dependencies
run: bun install --frozen-lockfile
- name: Validate Stripe E2E configuration
env:
CF_TUNNEL_TOKEN: ${{ secrets.CF_TUNNEL_TOKEN_STRIPE }}
run: |
set -euo pipefail
for name in CF_TUNNEL_TOKEN E2E_STRIPE_SK E2E_STRIPE_WHSEC TEST_DATABASE_URL; do
if [ -z "${!name:-}" ]; then
echo "::error::Missing required configuration: $name"
exit 1
fi
done
- name: Setup cloudflared
uses: AnimMouse/setup-cloudflared@v2
- name: Check cloudflared version
run: cloudflared --version
- name: Install Playwright Chromium
run: bunx playwright install --with-deps chromium
- name: Run Stripe E2E suite
env:
CF_TUNNEL_TOKEN: ${{ secrets.CF_TUNNEL_TOKEN_STRIPE }}
run: |
set -euo pipefail
cloudflared tunnel --url http://127.0.0.1:4567 run --token "$CF_TUNNEL_TOKEN" > cloudflared.log 2>&1 &
cloudflared_pid=$!
cleanup() {
if kill -0 "$cloudflared_pid" 2>/dev/null; then
kill "$cloudflared_pid" || true
wait "$cloudflared_pid" || true
fi
}
trap cleanup EXIT
sleep 5
if ! kill -0 "$cloudflared_pid" 2>/dev/null; then
echo "::error::cloudflared exited before tests started"
if [ -f cloudflared.log ]; then
cat cloudflared.log
fi
exit 1
fi
bun --filter e2e test:stripe
- name: Upload cloudflared log
if: failure()
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: stripe-e2e-cloudflared-log
path: cloudflared.log