11name : PR Quality Check
2- on : pull_request
2+ on :
3+ pull_request :
4+ types : [opened]
35jobs :
46 link-ticket :
57 runs-on : ubuntu-latest
2426 with :
2527 msg : |
2628 This branch is work on a ticket in the NHS Digital AMB JIRA Project. Here's a handy link to the ticket:
27- # [${{ env.TICKET_NAME }}](https://nhsd-jira.digital.nhs.uk/browse/${{ env.TICKET_NAME}})
29+ # [${{ env.TICKET_NAME }}](https://nhsd-jira.digital.nhs.uk/browse/${{ env.TICKET_NAME}})
30+
31+ coverage :
32+ runs-on : ubuntu-latest
33+ steps :
34+ - name : Checkout code
35+ uses : actions/checkout@v2
36+
37+ - name : Set up Python
38+ uses : actions/setup-python@v3
39+ with :
40+ python-version : ' 3.10'
41+
42+ - name : Set up AWS credentials
43+ env :
44+ AWS_ACCESS_KEY_ID : " FOOBARKEY"
45+ AWS_SECRET_ACCESS_KEY : " FOOBARSECRET"
46+ run : |
47+ aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
48+ aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
49+
50+ - name : Install dependencies
51+ run : |
52+ pip install poetry moto==4.2.11 coverage redis botocore==1.35.49 simplejson responses structlog fhir.resources jsonpath_ng pydantic==1.10.13 requests aws-lambda-typing cffi pyjwt boto3-stubs-lite[dynamodb]~=1.26.90
53+
54+ - name : Run unit tests and generate coverage report for filenameprocessor
55+ run : |
56+ mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
57+ coverage run -m unittest discover
58+ coverage report
59+ coverage xml -o /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report/test_coverage.xml
60+ working-directory : " /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend"
61+ continue-on-error : true
62+
63+ - name : List coverage report file
64+ run : |
65+ ls -R /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
66+
67+ - name : Aggregate coverage reports
68+ run : |
69+ mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report
70+ rm -rf /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report/*
71+ mv /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report/test_coverage.xml /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report/test_coverage.xml
72+
73+ - name : Commit and push coverage reports
74+ if : success()
75+ run : |
76+ git config --global user.name "github-actions[bot]"
77+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
78+ git fetch origin ${{ github.head_ref }}
79+ git checkout ${{ github.head_ref }}
80+ git pull origin ${{ github.head_ref }}
81+ git add /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report/*.xml
82+ git commit -m "Add coverage index as XML format"
83+ git push origin ${{ github.head_ref }}
0 commit comments