Skip to content

feat: Social Media Asset Punch List #1027 #5368

feat: Social Media Asset Punch List #1027

feat: Social Media Asset Punch List #1027 #5368

Workflow file for this run

name: Main
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
versions:
name: Get Versions 📜
uses: CrisisCleanup/crisiscleanup-4-web/.github/workflows/get-versions.yml@master
lint:
name: Lint 💅
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [versions]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: ${{ needs.versions.outputs.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ needs.versions.outputs.NODE_VERSION }}
cache: pnpm
- name: Install
run: pnpm install
- name: Lint
run: pnpm run lint
type-check:
name: Type Check 📝
runs-on: ubuntu-latest
timeout-minutes: 30
# disabled till we fix the type errors
if: false
needs: [versions]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: ${{ needs.versions.outputs.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ needs.versions.outputs.NODE_VERSION }}
cache: pnpm
- name: Install
run: pnpm install
- name: Type check
run: pnpm run typecheck
build:
name: Build 🏗️
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [versions]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: ${{ needs.versions.outputs.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ needs.versions.outputs.NODE_VERSION }}
cache: pnpm
- name: Install
run: pnpm install
- name: Build app
run: pnpm run build:app
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
test:
name: Test 🧪
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [versions]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: ${{ needs.versions.outputs.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ needs.versions.outputs.NODE_VERSION }}
cache: pnpm
- run: pnpm install
- run: pnpm run test
- name: 📊 Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
flags: unitTests
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-e2e:
name: 🧪 E2E Tests (${{ matrix.shardIndex }}/${{ matrix.shardTotal }}) | ${{ matrix.project }}
timeout-minutes: 60
runs-on: ${{ matrix.os }}
needs: [versions]
# TODO: testing on PRs doesnt make sense like this.
# Could setup feature branch deployments though.
if: ((github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'pull_request')
continue-on-error: true
strategy:
fail-fast: false
matrix:
project: [chromium, firefox]
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
include:
- project: chromium
os: ubuntu-latest
cache_dir: ~/.cache/ms-playwright
- project: firefox
os: ubuntu-latest
cache_dir: ~/.cache/ms-playwright
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: ${{ needs.versions.outputs.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ needs.versions.outputs.NODE_VERSION }}
cache: pnpm
- name: 🔧 Setup Env Vars
run: |
echo 'NODE_ENV=development' >> $GITHUB_ENV
echo 'VITE_APP_STAGE=staging' >> $GITHUB_ENV
echo 'VITE_APP_BASE_URL=http://localhost:8080' >> $GITHUB_ENV
echo 'VITE_APP_API_BASE_URL=https://api.staging.crisiscleanup.io' >> $GITHUB_ENV
echo 'VITE_APP_WS_URL=wss://socket.staging.crisiscleanup.io' >> $GITHUB_ENV
echo 'VITE_APP_AWS_CCP_URL=https://ccustaging.awsapps.com/connect/ccp-v2/' >> $GITHUB_ENV
echo 'VITE_APP_CCP_INSTANCE=414df788-cd99-4580-ad07-f8af22246ce5' >> $GITHUB_ENV
echo 'VITE_APP_PORTAL_KEY=crisiscleanup_staging' >> $GITHUB_ENV
echo 'VITE_APP_PHONE_DEFAULT_USERNAME=english' >> $GITHUB_ENV
echo 'VITE_APP_PHONE_DEFAULT_PASSWORD=volunteer' >> $GITHUB_ENV
echo 'VITE_APP_ENGLISH_PHONE_GATEWAY=124906' >> $GITHUB_ENV
echo 'VITE_APP_SPANISH_PHONE_GATEWAY=124906' >> $GITHUB_ENV
echo 'VITE_APP_DEFAULT_CALLER_ID=2722003211' >> $GITHUB_ENV
echo 'VITE_APP_CRISISCLEANUP_WEB_CLIENT_ID=QOHomvSiigXtzUwl0P91LaAgnjo7zFJ72Brchddn' >> $GITHUB_ENV
echo 'TEST_APP_EMAIL=${{ secrets.TEST_APP_EMAIL_PROD }}' >> $GITHUB_ENV
echo 'TEST_APP_PASSWORD=${{ secrets.TEST_APP_PASSWORD_PROD }}' >> $GITHUB_ENV
echo 'TEST_APP_ADMIN_EMAIL=${{ secrets.TEST_APP_ADMIN_EMAIL_PROD }}' >> $GITHUB_ENV
echo 'TEST_APP_ADMIN_PASSWORD=${{ secrets.TEST_APP_ADMIN_PASSWORD_PROD }}' >> $GITHUB_ENV
- name: 📥 Install dependencies
run: pnpm install
- name: 🔧 Set Playwright Version
run: pnpm exec playwright --version > .github/.playwright-version
- name: ⚡️ Cache playwright binaries
uses: actions/cache@v4
id: playwright-cache
with:
path: ${{ matrix.cache_dir }}
key: ${{ runner.os }}-${{ matrix.project }}-pw-${{ hashFiles('**/.playwright-version') }}
- name: 📥 Install ${{ matrix.project }} with Playwright
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: pnpm exec playwright install --with-deps ${{ matrix.project }}
- name: 🏗️ Build App
run: pnpm run build:app
- name: 🎭 Playwright tests
run: pnpm run test:e2e:primary --project=${{ matrix.project }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
# env:
# DEBUG: pw:api,pw:browser*
- name: 📤 Upload blob report to GitHub Actions Artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: all-blob-reports
path: blob-report
retention-days: 1
merge-e2e-reports:
# Merge reports after playwright-tests, even if some shards have failed
name: 🔄 Merge Playwright Reports
needs: [versions, test-e2e]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: ${{ needs.versions.outputs.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ needs.versions.outputs.NODE_VERSION }}
cache: pnpm
- name: 📥 Install dependencies
run: pnpm install
- name: 📥 Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v3
with:
name: all-blob-reports
path: all-blob-reports
- name: 🔄 Merge all blob reports
env:
PLAYWRIGHT_JSON_OUTPUT_NAME: e2e-results.json
run: pnpm exec playwright merge-reports --reporter html,json,github,markdown ./all-blob-reports
- name: 🛠️ Generate PR Comment
uses: daun/playwright-report-summary@v3
with:
report-file: 'e2e-results.json'
- name: 🛠️ Generate Job Summary
run: |
echo "# 🧪 E2E Summary 🧪" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
cat report.md >> $GITHUB_STEP_SUMMARY # report.md is generated from markdown reporter
- name: 📤 Upload HTML report
uses: actions/upload-artifact@v3
with:
name: e2e-report-${{ github.run_id }}-attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 7