Improve Templates #1167
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: E2E | |
on: [pull_request] | |
jobs: | |
test: | |
name: E2E | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get preview url | |
id: get_url | |
run: | | |
STATE="not ready" | |
CURRENT_HASH=${{ github.event.pull_request.head.sha }} | |
echo $CURRENT_HASH | |
until [ "$STATE" = '"READY"' ] | |
do | |
RESULTS=$(curl -s -H 'Accept: application/json' -H "Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}" "https://api.vercel.com/v6/now/deployments?teamId=tone-row&name=flowchart-fun") | |
CLEAN=$(echo $RESULTS | tr -d '[:cntrl:]'); | |
STATE=$(echo $CLEAN | jq --arg h "$CURRENT_HASH" '.deployments[] | select(.meta.githubCommitSha==$h) | .state'); | |
echo $STATE | |
sleep 5 | |
done | |
echo "Deployment is ready!" | |
URL=https://$(echo $CLEAN | jq --arg h "$CURRENT_HASH" '.deployments[] | select(.meta.githubCommitSha==$h) | .url') | |
echo ::set-output name=preview_url::$(echo $URL) | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Add env | |
run: | | |
touch app/.env | |
echo RAPID_API_KEY=${{ secrets.RAPID_API_KEY }} >> app/.env | |
echo STRIPE_KEY_TEST_ENV=${{ secrets.STRIPE_KEY_TEST_ENV }} >> app/.env | |
echo TESTING_EMAIL=${{ secrets.TESTING_EMAIL }} >> app/.env | |
echo TESTING_PASS=${{ secrets.TESTING_PASS }} >> app/.env | |
echo TESTING_EMAIL_PRO=${{ secrets.TESTING_EMAIL_PRO }} >> app/.env | |
echo TESTING_PASS_PRO=${{ secrets.TESTING_PASS_PRO }} >> app/.env | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Install Playwright | |
run: | | |
pnpm add -g [email protected] | |
playwright install | |
- name: Install Deps | |
run: pnpm install | |
- name: Run E2E Tests on Vercel Preview URL | |
run: E2E_START_URL="${{ steps.get_url.outputs.preview_url }}" pnpm -F app e2e | |
- uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: test-results | |
path: app/test-results |