Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added shell: bash to telegram alert section #179

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions .github/workflows/duplicate-openlogin.google.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Duplicate - OpenLogin - Facebook Login

on:
push
# schedule:
# - cron: "*/30 * * * *"
# workflow_dispatch:

env:
NODE_VERSION: 16

jobs:
run-tests:
name: Duplicate - Run OpenLogin - Facebook Login tests
strategy:
matrix:
env: [prod]
browser: [chromium]
os: [macos-latest]
# include:
# - os: macos-latest
# browser: webkit
# env: prod

runs-on: ${{ matrix.os }}
env:
PLATFORM: ${{ matrix.env }}
outputs:
conclusion: ${{ steps.run-tests.conclusion }}
steps:
- name: Checkout
uses: actions/checkout@v3

- id: setup-node
name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
continue-on-error: true

- id: yarn-install
name: Install Node.js dependencies
if: steps.setup-node.outcome == 'success'
# run: exit 1
run: yarn install --frozen-lockfile
continue-on-error: true


- id: yarn-install-deps
name: Install Ubuntu dependencies
if: steps.yarn-install.outcome == 'success' && startsWith(matrix.os, 'ubuntu')
run: yarn run playwright install-deps ${{ matrix.browser }}
continue-on-error: true

- id: configure-aws
name: Configure AWS credentials
if: steps.yarn-install.outcome == 'success' && steps.yarn-install-deps.outcome != 'failure'
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
continue-on-error: true

- id: download-state
name: Download remote browser snapshots
if: steps.configure-aws.outcome == 'success'
run: aws s3 cp s3://torus-e2e-tests/openlogin/login-with-facebook/ openlogin/login-with-facebook/ --recursive
continue-on-error: true

- id: run-tests
name: Run tests
if: steps.download-state.outcome == 'success'
# run: yarn run playwright test --config openlogin/login-with-facebook/index.config.ts --project ${{ matrix.browser }}
run: exit 1

- id: telegram-alert
name: Alert to telegram channel
# needs: run-tests
if: always()
run: |
echo ${{ steps.run-tests.outcome }}
echo ${{ steps.run-tests.result }}
if [[ ${{ steps.run-tests.outcome }} == 'failure' ]]
then
echo "attempt: ${{github.run_attempt}}"
if [[ ${{github.run_attempt}} < 2 ]]
then
echo "attempt < 2, re-running job"
curl -X POST --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/torusresearch/torus-e2e-tests/actions/jobs/${{github.job_id}}/rerun"
else:
echo "attempt >= 2, and failed sending telegram alert"
fi
else
echo "Test Passed, no alert!"
fi
shell: bash
continue-on-error: true

- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results-on-${{ matrix.browser }}-${{ matrix.os }}
path: test-results/
if-no-files-found: ignore

# curl -X POST --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/torusresearch/torus-e2e-tests/actions/runs/${{github.run_id}}/cencel"
# response=curl "https://api.github.com/repos/torusresearch/torus-e2e-tests/actions/runs/${{github.run_id}}"
# curl "https://api.telegram.org/bot${{secrets.BOT_API_TOKEN}}/sendMessage?chat_id=${{secrets.CHAT_ID}}&text=LoginWithFacebook%0ATestresult=Failed%0AOS=${{matrix.os}}%0Abrowser=${{matrix.browser}}%0AEnvironment=${{matrix.env}}%0AJob=${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"

# update-status:
# name: Update OpenLogin - Facebook Login status
# needs: run-tests
# if: (success() || failure()) && (needs.run-tests.outputs.conclusion != 'skipped')
# runs-on: ubuntu-latest
# steps:
# - name: Update status
# uses: fjogeleit/http-request-action@master
# with:
# url: https://api.statuspage.io/v1/pages/${{ secrets.PAGE_ID }}/components/${{ secrets.FACEBOOK_COMPONENT_ID }}
# customHeaders: '{ "Authorization": "OAuth ${{ secrets.STATUS_PAGE_API_KEY }}" }'
# method: PATCH
# contentType: "application/json"
# timeout: 10000
# data: >-
# { "component": { "status": "${{ needs.run-tests.result == 'success' && 'operational' || 'major_outage' }}" } }
1 change: 1 addition & 0 deletions .github/workflows/openlogin.existing-v2-user-login.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
else
echo "Test Passed, no alert!"
fi
shell: bash
continue-on-error: true

- id: upload-state
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/openlogin.homepage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
else
echo "Test Passed, no alert!"
fi
shell: bash
continue-on-error: true

- name: Upload test results
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/openlogin.login-with-discord.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
else
echo "Test Passed, no alert!"
fi
shell: bash
continue-on-error: true

- name: Upload test results
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/openlogin.login-with-facebook-2fa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ jobs:
else
echo "Test Passed, no alert!"
fi
shell: bash
continue-on-error: true

- name: Upload test results
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/openlogin.login-with-facebook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
else
echo "Test Passed, no alert!"
fi
shell: bash
continue-on-error: true

- name: Upload test results
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/openlogin.login-with-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
else
echo "Test Passed, no alert!"
fi
shell: bash
continue-on-error: true

- id: upload-state
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/openlogin.login-with-google.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
else
echo "Test Passed, no alert!"
fi
shell: bash
continue-on-error: true

- id: upload-state
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/openlogin.login-with-passwordless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
else
echo "Test Passed, no alert!"
fi
shell: bash
continue-on-error: true

- id: upload-state
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/openlogin.new-v2-user-login.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:
else
echo "Test Passed, no alert!"
fi
shell: bash
continue-on-error: true

- id: upload-state
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/openlogin.setup-2fa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
else
echo "Test Passed, no alert!"
fi
shell: bash
continue-on-error: true

- id: upload-state
Expand Down