@@ -2,80 +2,26 @@ name: Python Tests
22run-name : Rest API Python Tests
33
44on :
5- workflow_dispatch :
6- inputs :
7- python_version :
8- description : " Python version"
9- required : true
10- default : ' 3.13.2'
115 push :
12-
6+
137jobs :
148 Run-Tests :
159 runs-on : ubuntu-latest
16-
10+
1711 steps :
18-
12+
1913 - name : Checkout Repository
2014 uses : actions/checkout@v4
21-
22- - name : Set Up Python
15+
16+ - name : Set up Python 3.12
2317 uses : actions/setup-python@v3
2418 with :
25- python-version : ' ${{ github.event.inputs.python_version }} '
26-
19+ python-version : 3.12
20+
2721 - name : Run Tests
2822 run : |
2923 chmod +x -R ${{ github.workspace }}
3024 pip install --upgrade pip
3125 pip install -r requirements.txt
3226 export PYTHONPATH=${PYTHONPATH}:${{ github.workspace }}
33- pytest -s tests/part_01/test_users.py --junitxml=results.xml --html=report.html
34-
35- - name : Create Test Summary
36- uses : test-summary/action@dist
37- if : success() || failure()
38- with :
39- paths : results.xml
40-
41- - name : Upload Pytest Test Results
42- uses : actions/upload-artifact@v4
43- if : success() || failure()
44- with :
45- name : test-results
46- path : |
47- results.xml
48- report.html
49- assets
50-
51- - name : Notify Slack - Build Status
52- if : always()
53- uses : rtCamp/action-slack-notify@v2
54- env :
55- SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
56- SLACK_COLOR : ${{ job.status == 'success' && 'good' || 'danger' }}
57- SLACK_MESSAGE : |
58- ${{ job.status == 'success' && ':white_check_mark: Python Tests completed successfully' || ':x: Python Tests failed' }}
59- on branch *${{ github.ref_name }}* by *${{ github.actor }}*.
60- Details: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View on GitHub>
61- SLACK_TITLE : " Build Status: ${{ job.status }}"
62-
63- - name : Send Build Status Email
64- uses : dawidd6/action-send-mail@v3
65- if : always()
66- with :
67- server_address : ${{ secrets.SMTP_SERVER }}
68- server_port : ${{ secrets.SMTP_PORT }}
69- username : ${{ secrets.SMTP_USERNAME }}
70- password : ${{ secrets.SMTP_PASSWORD }}
71- subject : " ${{ job.status == 'success' && ':white_check_mark: Build Succeeded' || ':x: Build Failed' }} - ${{ github.repository }}"
72- html_body : >
73- <!DOCTYPE html><html><body>
74- <h2>${{ job.status == 'success' && ':white_check_mark: Build Succeeded' || ':x: Build Failed' }}</h2>
75- <p>Repository: <b>${{ github.repository }}</b></p>
76- <p>Commit: <b>${{ github.sha }}</b></p>
77- <p>Branch: <b>${{ github.ref_name }}</b></p>
78- <p>Check the details on <a href="${{ github.server_url }}/actions">GitHub Actions</a>.</p>
79- </body></html>
80- to : ${{ secrets.RECIPIENT_EMAIL }}
81- from : ${{ secrets.SMTP_USERNAME }}
27+ pytest -s tests/part_01/test_users.py
0 commit comments