Add pnpm installation step to CI workflow #10
This file contains hidden or 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: CI/CD Workflow--> Deploy and run E2E tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| release: | |
| types: [created] | |
| jobs: | |
| deploy: | |
| name: Deploy to Vercel | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| - name: Install Vercel CLI | |
| run: npm install -g vercel | |
| - name: Deploy to Vercel | |
| id: deploy | |
| run: | | |
| vercel pull --yes --environment=preview --token ${{ secrets.VERCEL_TOKEN_MY_PROJECT }} | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| DEPLOY_URL=$(vercel deploy --prod --token ${{ secrets.VERCEL_TOKEN_MY_PROJECT }} | tail -1) | |
| else | |
| DEPLOY_URL=$(vercel deploy --staging --token ${{ secrets.VERCEL_TOKEN_MY_PROJECT }} | tail -1) | |
| fi | |
| echo "DEPLOYMENT_URL=${DEPLOY_URL}" >> $GITHUB_ENV | |
| echo "Deployed to: $DEPLOY_URL" | |
| env: | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN_MY_PROJECT }} | |
| e2e: | |
| name: Run E2E Tests | |
| runs-on: ubuntu-latest | |
| needs: deploy | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Install Dependencies | |
| run: pnpm install | |
| - name: Install Playwright | |
| run: pnpm playwright install | |
| - name: Run Playwright Tests | |
| run: pnpm playwright test | |
| env: | |
| BASE_URL: ${{ env.DEPLOYMENT_URL }} | |
| # notify: | |
| # name: Send Slack Notification | |
| # runs-on: ubuntu-latest | |
| # needs: [deploy, e2e] | |
| # if: failure() | |
| # steps: | |
| # - name: Notify Slack | |
| # uses: slackapi/[email protected] | |
| # with: | |
| # payload: | | |
| # { | |
| # "text": "Workflow failed for branch: ${{ github.ref_name }}. Please check the logs for details." | |
| # } | |
| # env: | |
| # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} |