Files
freeCodeCamp/.github/workflows/e2e-third-party.yml
2024-10-30 14:46:41 +01:00

99 lines
2.9 KiB
YAML

name: CI - E2E - 3rd party donation tests
# These are only run on prod-* branches to test the 3rd party donation flow
on:
push:
branches:
- 'prod-**'
paths-ignore:
- 'docs/**'
# to test this ad-hoc
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
do-everything:
name: Build & Test
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20.x]
services:
mongodb:
image: mongo:4.4
ports:
- 27017:27017
# We need mailhog to catch any emails the api tries to send.
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025
steps:
- name: Checkout Source Files
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: 'recursive'
- name: Checkout client-config
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: freeCodeCamp/client-config
path: client-config
- name: Setup pnpm
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}
# cypress-io/github-action caches the store, so we should not cache it
# here.
- name: Set freeCodeCamp Environment Variables
run: |
sed '/STRIPE/d; /PAYPAL/d; /PATREON/d;' sample.env > .env
echo 'STRIPE_PUBLIC_KEY=${{ secrets.STRIPE_PUBLIC_KEY }}' >> .env
echo 'PAYPAL_CLIENT_ID=${{ secrets.PAYPAL_CLIENT_ID }}' >> .env
echo 'PATREON_CLIENT_ID=${{ secrets.PATREON_CLIENT_ID }}' >> .env
- name: Install and Build
run: |
pnpm install
pnpm run create:shared
pnpm run build:curriculum
pnpm run build:server
- name: Seed Database with Certified User
run: pnpm run seed:certified-user
- name: Move serve.json to Public Folder
run: cp client-config/serve.json client/public/serve.json
# start-ci uses pm2, so it needs to be installed globally
- name: Install pm2
run: npm i -g pm2
- name: Install playwright dependencies
run: npx playwright install --with-deps
- name: Run playwright tests
run: |
pnpm run start-ci &
sleep 10
npx playwright test third-party-donation.spec.ts --project=${{ matrix.browsers }}
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ matrix.browsers }}
path: playwright/reporter
retention-days: 30