Skip to content

Commit aca20cb

Browse files
committed
added
1 parent f4cc80a commit aca20cb

File tree

2 files changed

+59
-54
lines changed

2 files changed

+59
-54
lines changed

.github/workflows/pr-coverage.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Generate Coverage
2+
on:
3+
pull_request:
4+
types: [opened]
5+
jobs:
6+
coverage:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v2
11+
12+
- name: Set up Python
13+
uses: actions/setup-python@v3
14+
with:
15+
python-version: '3.10'
16+
17+
- name: Set up AWS credentials
18+
env:
19+
AWS_ACCESS_KEY_ID: "FOOBARKEY"
20+
AWS_SECRET_ACCESS_KEY: "FOOBARSECRET"
21+
run: |
22+
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
23+
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
24+
25+
- name: Install dependencies
26+
run: |
27+
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
28+
29+
- name: Run unit tests and generate coverage report for filenameprocessor
30+
run: |
31+
mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
32+
coverage run -m unittest discover
33+
coverage report
34+
coverage xml -o /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report/test_coverage.xml
35+
working-directory: "/home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend"
36+
continue-on-error: true
37+
38+
- name: List coverage report file
39+
run: |
40+
ls -R /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
41+
42+
- name: Aggregate coverage reports
43+
run: |
44+
mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report
45+
rm -rf /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report/*
46+
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
47+
48+
- name: Commit and push coverage reports
49+
if: success()
50+
run: |
51+
git config --global user.name "github-actions[bot]"
52+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
53+
git fetch origin ${{ github.head_ref }}
54+
git checkout ${{ github.head_ref }}
55+
git pull origin ${{ github.head_ref }}
56+
git add /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report/*.xml
57+
git commit -m "Add coverage index as XML format"
58+
git push origin ${{ github.head_ref }}

.github/workflows/pr-lint.yaml

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -24,57 +24,4 @@ jobs:
2424
with:
2525
msg: |
2626
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}})
28-
coverage:
29-
runs-on: ubuntu-latest
30-
steps:
31-
- name: Checkout code
32-
uses: actions/checkout@v2
33-
34-
- name: Set up Python
35-
uses: actions/setup-python@v3
36-
with:
37-
python-version: '3.10'
38-
39-
- name: Set up AWS credentials
40-
env:
41-
AWS_ACCESS_KEY_ID: "FOOBARKEY"
42-
AWS_SECRET_ACCESS_KEY: "FOOBARSECRET"
43-
run: |
44-
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
45-
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
46-
47-
- name: Install dependencies
48-
run: |
49-
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
50-
51-
- name: Run unit tests and generate coverage report for filenameprocessor
52-
run: |
53-
mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
54-
coverage run -m unittest discover
55-
coverage report
56-
coverage xml -o /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report/test_coverage.xml
57-
working-directory: "/home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend"
58-
continue-on-error: true
59-
60-
- name: List coverage report file
61-
run: |
62-
ls -R /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
63-
64-
- name: Aggregate coverage reports
65-
run: |
66-
mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report
67-
rm -rf /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report/*
68-
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
69-
70-
- name: Commit and push coverage reports
71-
if: success()
72-
run: |
73-
git config --global user.name "github-actions[bot]"
74-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
75-
git fetch origin ${{ github.head_ref }}
76-
git checkout ${{ github.head_ref }}
77-
git pull origin ${{ github.head_ref }}
78-
git add /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report/*.xml
79-
git commit -m "Add coverage index as XML format"
80-
git push origin ${{ github.head_ref }}
27+
# [${{ env.TICKET_NAME }}](https://nhsd-jira.digital.nhs.uk/browse/${{ env.TICKET_NAME}})

0 commit comments

Comments
 (0)