Skip to content

Commit

Permalink
Merge pull request #33 from rootcodelabs/classifier-39
Browse files Browse the repository at this point in the history
Python unit testing
  • Loading branch information
pamodaDilranga committed Jul 8, 2024
2 parents 0edf916 + c4aa941 commit b6a0bc8
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/est-workflow-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,26 @@ jobs:
run: |
docker compose up --build -d
- name: Send Slack notification
- name: Run pyTesting.py
id: pytesting
run: |
output=$(python src/pyTesting.py)
if [ "$output" != "True" ]; then
echo "PyTesting failed with output: $output"
exit 1
fi
- name: Send failure Slack notification
if: failure()
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' --data "{
\"text\": \"The deployment failed during the pyTesting step. Please check the output for details.\"
}" $SLACK_WEBHOOK_URL
- name: Send success Slack notification
if: success()
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
Expand Down
25 changes: 22 additions & 3 deletions .github/workflows/est-workflow-staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy EST Frontend and Backend to Staging
name: Deploy EST Frontend and Backend to staging

on:
push:
Expand Down Expand Up @@ -37,10 +37,29 @@ jobs:
run: |
docker compose up --build -d
- name: Send Slack notification
- name: Run pyTesting.py
id: pytesting
run: |
output=$(python src/pyTesting.py)
if [ "$output" != "True" ]; then
echo "PyTesting failed with output: $output"
exit 1
fi
- name: Send failure Slack notification
if: failure()
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' --data "{
\"text\": \"The deployment failed during the pyTesting step. Please check the output for details.\"
}" $SLACK_WEBHOOK_URL
- name: Send success Slack notification
if: success()
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' --data "{
\"text\": \"The build is complete and the staging environment is now available. Please click the following link to access it: <https://esclassifier-test.rootcode.software/classifier>\"
}" $SLACK_WEBHOOK_URL
}" $SLACK_WEBHOOK_URL
2 changes: 2 additions & 0 deletions src/pyTesting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
if __name__ == "__main__":
print(True)

0 comments on commit b6a0bc8

Please sign in to comment.