Skip to content

Commit

Permalink
fix: resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Fasih Ali authored and Fasih Ali committed Oct 16, 2023
2 parents 265a511 + dccfe00 commit 7dc1cb4
Show file tree
Hide file tree
Showing 193 changed files with 6,635 additions and 5,310 deletions.
47 changes: 32 additions & 15 deletions .github/workflows/generate-preview-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ jobs:
directory='public'
projectName='deriv-com-preview-links'
head_branch=${{github.event.workflow_run.head_branch}}
branch=$(echo $head_branch | head -c 20)
branch=$(echo $head_branch | head -c 20 | sed 's/[\/_\.]/-/g; s/[^a-zA-Z0-9]$/1/')
preview_url=$(wrangler pages deploy $directory --project-name=$projectName --branch=$branch > log.txt 2>&1; echo $?)
echo "------"
cat log.txt
branchName=$(echo $branch | sed 's/[\/_\.]/-/g; s/[^a-zA-Z]$//')
if grep -q "Deployment complete" log.txt; then
echo "preview_url=https://$branchName.deriv-com-preview-links.pages.dev" > "$GITHUB_OUTPUT"
echo "preview_url=https://$branch.deriv-com-preview-links.pages.dev" > "$GITHUB_OUTPUT"
else
echo "Deployment to Cloudflare Pages failed."
exit 1
Expand Down Expand Up @@ -182,15 +181,33 @@ jobs:
message: ${{steps.generate_preview_url.outputs.comment || steps.generate_failure_comment.outputs.comment }}
recreate: true

- name: E2E Smoke Test
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
"https://api.github.com/repos/deriv-com/e2e-deriv-com/dispatches" \
-d '{
"event_type": "run-e2e-tests",
"client_payload": {
"baseurl": "${{steps.publish-to-pages.outputs.preview_url}}"
}
}'
- name: e2e Smoke Tests
uses: actions/checkout@v4
with:
repository: deriv-com/e2e-deriv-com # Replace with your repository name

- name: Cypress run
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action
uses: cypress-io/github-action@v6
with:
# Starts web server for E2E tests - replace with your own server invocation
# https://docs.cypress.io/guides/continuous-integration/introduction#Boot-your-server
# start: npm start
# wait-on: 'http://localhost:3000' # Waits for above
# Records to Cypress Cloud
# https://docs.cypress.io/guides/cloud/projects#Set-up-a-project-to-record
record: true
parallel: true # Runs test in parallel using settings above
spec: cypress/e2e/smoke/*.js
group: 'Smoke Tests'

env:
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY
# in GitHub repo → Settings → Secrets → Actions
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
# Set Base Url from client_payload.
CYPRESS_BASE_URL: ${{steps.publish-to-pages.outputs.preview_url}}
# Send PR and Repo details to Cypress Cloud test run
COMMIT_INFO_MESSAGE: PR "${{steps.pr_information.outputs.issue_number}}" in Repo "${{ github.repository }}"
75 changes: 75 additions & 0 deletions .github/workflows/smoketests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Run Smoke Tests

permissions:
actions: write
checks: write
contents: write
deployments: write
pull-requests: write
statuses: write

on:
issue_comment:
types: [edited]

jobs:
cypress-run:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
containers: [1,2,3,4,5]

steps:
- name: Capture Vercel preview URL
id: vercel_preview_url
uses: binary-com/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout external repository with Cypress tests
uses: actions/checkout@v4
with:
repository: deriv-experiments/Cypress-demo # Replace with your repository name

- name: Cypress run
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action
uses: cypress-io/github-action@v6
with:
# Records to Cypress Cloud
# https://docs.cypress.io/guides/cloud/projects#Set-up-a-project-to-record
record: true
parallel: true # Runs test in parallel using settings above
spec: cypress/e2e/smoke/*.js
group: 'Smoke Tests'

env:
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY
# in GitHub repo → Settings → Secrets → Actions
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
# Set Base Url from client_payload.
CYPRESS_BASE_URL: ${{ steps.vercel_preview_url.outputs.vercel_preview_url }}
# Send PR details to Cypress test run
COMMIT_INFO_MESSAGE: PR "${{ github.event.issue.number }}" in Repo "${{ github.repository }}" (v2)

- name: Set comments message
id: set_msg
if: always()
run: |
# Using shell script to conditionally set the message
if [[ "${{ job.status }}" == "success" ]]; then
echo "msg=:rocket: Smoke test run (${{ matrix.containers }}) passed successfully!" >> $GITHUB_OUTPUT
else
echo "msg=:x: Smoke test run (${{ matrix.containers }}) failed. See logs for details: [Visit Action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}})" >> $GITHUB_OUTPUT
fi
- name: Leave comment
if: always()
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Smoke tests status update
number: ${{ github.event.issue.number }}
message: "${{ steps.set_msg.outputs.msg }}"
recreate: true
Loading

0 comments on commit 7dc1cb4

Please sign in to comment.