|
| 1 | +name: API Testing for Prod Endpoint |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + |
| 8 | + Timestamp: |
| 9 | + uses: storyprotocol/gha-workflows/.github/workflows/reusable-timestamp.yml@main |
| 10 | + |
| 11 | + test-and-publish: |
| 12 | + needs: [ Timestamp ] |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout Code |
| 16 | + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 |
| 17 | + |
| 18 | + - name: Use Node.js |
| 19 | + uses: actions/setup-node@v4 |
| 20 | + with: |
| 21 | + node-version: 20 |
| 22 | + |
| 23 | + - name: Install pnpm |
| 24 | + run: npm install -g pnpm |
| 25 | + |
| 26 | + - name: Install Dependencies |
| 27 | + run: pnpm install |
| 28 | + |
| 29 | + - name: Lint |
| 30 | + run: pnpm eslint . |
| 31 | + # Ensure you have a lint script in your package.json |
| 32 | + |
| 33 | + - name: Run Tests On Sepolia |
| 34 | + continue-on-error: true |
| 35 | + run: | |
| 36 | + echo "Load environment variables" |
| 37 | + rm .env && touch .env |
| 38 | + echo API_BASE_URL=${{ secrets.API_BASE_URL_PROD }} > .env |
| 39 | + echo API_KEY=${{ secrets.API_KEY_PROD }} >> .env |
| 40 | + test_env=sepolia npx playwright test |
| 41 | + |
| 42 | + - name: Push Slack Notification |
| 43 | + uses: slackapi/slack-github-action@v1.25.0 |
| 44 | + with: |
| 45 | + channel-id: ${{ secrets.SLACK_CHANNEL_ID_API_INTEGRATION_TESTS }} |
| 46 | + payload: | |
| 47 | + { |
| 48 | + "text": "${{ github.repository }}: API Testing for Prod Endpoint have been completed. Check the results at github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", |
| 49 | + "blocks": [ |
| 50 | + { "type": "divider" }, |
| 51 | + { |
| 52 | + "type": "image", |
| 53 | + "title": { |
| 54 | + "type": "plain_text", |
| 55 | + "text": "Playwright Test Results" |
| 56 | + }, |
| 57 | + "image_url": "http://www.quickmeme.com/img/b9/b9848df257b95cd39585368475a4b4e4a3a8c774f7390226daecb79b912087ad.jpg", |
| 58 | + "alt_text": "Playwright Test Results" |
| 59 | + }, |
| 60 | + { |
| 61 | + "type": "section", |
| 62 | + "text": { |
| 63 | + "type": "mrkdwn", |
| 64 | + "text":"${{ github.repository }}: API Testing for Prod Endpoint have been completed. \nCheck the results at https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" |
| 65 | + } |
| 66 | + } |
| 67 | + ] |
| 68 | + } |
| 69 | + env: |
| 70 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
| 71 | + |
| 72 | + - name: Upload Test Results |
| 73 | + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 |
| 74 | + with: |
| 75 | + name: sepolia-test-reports |
| 76 | + path: | |
| 77 | + ./playwright-report-sepolia/index.html |
0 commit comments