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

Python unit testing #33

Merged
merged 1 commit into from
Jul 8, 2024
Merged
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
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)