name: CI - E2E - 3rd party donation tests on: workflow_dispatch: push: branches: - 'prod-**' concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.workflow_run.head_branch || github.ref }} cancel-in-progress: ${{ !contains(github.ref, 'main') && !contains(github.ref, 'prod-') }} jobs: build-client: name: Build Client runs-on: ubuntu-22.04 strategy: matrix: node-version: [22] steps: - name: Checkout Source Files uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: submodules: 'recursive' - name: Checkout client-config uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: repository: freeCodeCamp/client-config path: client-config - name: Setup pnpm uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ matrix.node-version }} - 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 build - name: Move serve.json to Public Folder run: cp client-config/serve.json client/public/serve.json - name: Tar Files run: tar -cf client-artifact.tar client/public - name: Upload Client Artifact uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: client-artifact path: client-artifact.tar build-api: name: Build API (Container) runs-on: ubuntu-22.04 steps: - name: Checkout Source Files uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: submodules: 'recursive' - name: Create Image run: | docker build \ -t fcc-api \ -f docker/api/Dockerfile . - name: Save Image run: docker save fcc-api > api-artifact.tar - name: Upload API Artifact uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: api-artifact path: api-artifact.tar playwright-run-api: name: Run Playwright 3rd Party Donation Tests runs-on: ubuntu-22.04 needs: [build-client, build-api] strategy: fail-fast: false matrix: browsers: [chromium] node-version: [22] steps: - name: Set Action Environment Variables run: | echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV - name: Checkout Source Files uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - name: Unpack Client Artifact run: | tar -xf client-artifact/client-artifact.tar rm client-artifact/client-artifact.tar - name: Load API Image run: | docker load < api-artifact/api-artifact.tar rm api-artifact/api-artifact.tar - name: Setup pnpm uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ matrix.node-version }} - name: Install Dependencies run: pnpm install - name: Set freeCodeCamp Environment Variables (needed by api) 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 playwright dependencies run: npx playwright install --with-deps - name: Install and Build run: | pnpm install pnpm compile:ts pnpm run build:curriculum - name: Start apps run: | docker compose -f docker/docker-compose.yml -f docker/docker-compose.e2e.yml up -d pnpm run serve:client-ci & sleep 10 - name: Seed Database with Certified User run: pnpm run seed:certified-user - name: Run playwright tests run: npx playwright test third-party-donation.spec.ts --project=${{ matrix.browsers }} - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 if: ${{ !cancelled() }} with: name: playwright-report-${{ matrix.browsers }} path: playwright/reporter retention-days: 7