Skip to content

Derivatives SDK Tests #5489

Derivatives SDK Tests

Derivatives SDK Tests #5489

Workflow file for this run

name: Derivatives SDK Tests
on:
schedule:
- cron: "*/30 * * * *"
jobs:
test:
runs-on: ubuntu-latest
env:
API_KEY: ${{ secrets.API_KEY }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install deprecation python-dotenv requests jsonschema jsonpath_ng
- name: Run unit tests
run: python3 -m unittest -v tests/*.py
- name: Notify Slack on failure
if: failure()
run: |
curl -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"Unit tests failed for ${GITHUB_REPOSITORY}. Please check the details.\", \"username\": \"CI Bot\", \"icon_emoji\": \":robot_face:\"}" \
${{ secrets.SDK_SLACK_WEBHOOK }}
# - name: Install msmtp
# if: failure()
# run: sudo apt-get install -y msmtp
# - name: Configure msmtp
# if: failure()
# run: |
# echo "defaults" > ~/.msmtprc
# echo "auth on" >> ~/.msmtprc
# echo "tls on" >> ~/.msmtprc
# echo "tls_trust_file /etc/ssl/certs/ca-certificates.crt" >> ~/.msmtprc
# echo "account default" >> ~/.msmtprc
# echo "host smtp.gmail.com" >> ~/.msmtprc
# echo "port 587" >> ~/.msmtprc
# echo "from ${{ secrets.EMAIL_USERNAME }}" >> ~/.msmtprc
# echo "user ${{ secrets.EMAIL_USERNAME }}" >> ~/.msmtprc
# echo "password ${{ secrets.EMAIL_PASSWORD }}" >> ~/.msmtprc
# echo "logfile ~/.msmtp.log" >> ~/.msmtprc
# chmod 600 ~/.msmtprc
# - name: Send email to Opsgenie on failure
# if: failure()
# run: |
# echo "Subject: Unit Test Failure Alert" > email.txt
# echo "To: [email protected]" >> email.txt
# echo "Unit tests failed for ${{ github.repository }}. Please check the details in the CI workflow." >> email.txt
# msmtp --debug -a default [email protected] < email.txt