ec5f0eefd2
refs https://github.com/TryGhost/Toolbox/issues/528 - we're moving towards making Node 18 our recommended version, so that involves ensuring all of CI is running Node 18 - we still have some Node 16 matrix runs to ensure compatibility
99 lines
3.0 KiB
YAML
99 lines
3.0 KiB
YAML
name: Browser Tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
workflow_dispatch:
|
|
inputs:
|
|
environment:
|
|
description: 'Environment to run tests against'
|
|
type: environment
|
|
required: true
|
|
site_url:
|
|
description: 'Site URL (override)'
|
|
required: false
|
|
type: string
|
|
owner_email:
|
|
description: 'Owner email (override)'
|
|
required: false
|
|
type: string
|
|
owner_password:
|
|
description: 'Owner password (override)'
|
|
required: false
|
|
type: string
|
|
concurrency:
|
|
group: ${{ github.workflow }}
|
|
jobs:
|
|
test:
|
|
timeout-minutes: 60
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && !startsWith(github.head_ref, 'renovate/'))
|
|
environment: ${{ github.event.inputs.environment || 'browser-tests-local' }}
|
|
env:
|
|
ENVIRONMENT: ${{ github.event.inputs.environment || 'browser-tests-local' }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: true
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18.x'
|
|
cache: yarn
|
|
|
|
- name: Install Stripe-CLI
|
|
run: |
|
|
export VERSION=1.13.5
|
|
wget "https://github.com/stripe/stripe-cli/releases/download/v$VERSION/stripe_${VERSION}_linux_x86_64.tar.gz"
|
|
tar -zxvf "stripe_${VERSION}_linux_x86_64.tar.gz"
|
|
mv stripe /usr/local/bin
|
|
stripe -v
|
|
|
|
- name: Install dependencies
|
|
run: yarn
|
|
|
|
- name: Run migrations
|
|
working-directory: ghost/core
|
|
run: yarn setup
|
|
|
|
- name: Install Playwright
|
|
working-directory: ghost/core
|
|
run: npx playwright install --with-deps
|
|
|
|
- name: Build Admin
|
|
if: env.ENVIRONMENT == 'browser-tests-local'
|
|
working-directory: ghost/admin
|
|
run: yarn build:dev
|
|
|
|
- name: Run Playwright tests on a remote site
|
|
if: env.ENVIRONMENT == 'browser-tests-staging'
|
|
working-directory: ghost/core
|
|
run: yarn test:browser
|
|
env:
|
|
TEST_URL: ${{ github.event.inputs.site_url || secrets.TEST_URL }}
|
|
TEST_OWNER_EMAIL: ${{ github.event.inputs.owner_email || secrets.TEST_OWNER_EMAIL }}
|
|
TEST_OWNER_PASSWORD: ${{ github.event.inputs.owner_password || secrets.TEST_OWNER_PASSWORD }}
|
|
|
|
- name: Run Playwright tests locally
|
|
if: env.ENVIRONMENT == 'browser-tests-local'
|
|
working-directory: ghost/core
|
|
run: yarn test:browser
|
|
env:
|
|
STRIPE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_PUBLISHABLE_KEY }}
|
|
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}
|
|
STRIPE_ACCOUNT_ID: ${{ secrets.STRIPE_ACCOUNT_ID }}
|
|
|
|
- uses: tryghost/actions/actions/slack-build@main
|
|
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
with:
|
|
status: ${{ job.status }}
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
if: always()
|
|
with:
|
|
name: playwright-report
|
|
path: playwright-report/
|
|
retention-days: 30
|