1- # name: Coverage report
1+ name : Coverage report
22
3- # on:
4- # pull_request:
3+ on :
4+ pull_request :
55
6- # jobs:
7- # coverage:
8- # runs-on: ubuntu-latest
9- # steps:
10- # - name: Checkout code
11- # uses: actions/checkout@v2
6+ jobs :
7+ coverage :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - name : Checkout code
11+ uses : actions/checkout@v2
1212
13- # - name: Set up Python
14- # uses: actions/setup-python@v3
15- # with:
16- # python-version: '3.10'
13+ - name : Set up Python
14+ uses : actions/setup-python@v3
15+ with :
16+ python-version : ' 3.10'
1717
18- # - name: Set up AWS credentials
19- # env:
20- # AWS_ACCESS_KEY_ID: "FOOBARKEY"
21- # AWS_SECRET_ACCESS_KEY: "FOOBARSECRET"
22- # run: |
23- # aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
24- # aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
18+ - name : Set up AWS credentials
19+ env :
20+ AWS_ACCESS_KEY_ID : " FOOBARKEY"
21+ AWS_SECRET_ACCESS_KEY : " FOOBARSECRET"
22+ run : |
23+ aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
24+ aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
2525
26- # - name: Install dependencies
27- # run: |
28- # 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
26+ - name : Install dependencies
27+ run : |
28+ 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
2929
30- # - name: Run unit tests and generate coverage report for immunisation-fhir-api
31- # run: |
32- # mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
33- # coverage run -m unittest discover
34- # coverage report
35- # coverage xml -o /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report/test_coverage.xml
36- # working-directory: "/home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend"
37- # continue-on-error: true
30+ - name : Run unit tests and generate coverage report for immunisation-fhir-api
31+ run : |
32+ pwd
33+ mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
34+ coverage run -m unittest discover
35+ coverage report
36+ coverage xml -o /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report/test_coverage.xml
37+ working-directory : " /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend"
38+ continue-on-error : true
3839
39- # - name: List coverage report file
40- # run: |
41- # ls -R /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
40+ - name : List coverage report file
41+ run : |
42+ ls -R /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
4243
43- # - name: Aggregate coverage report
44- # run: |
45- # mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report
46- # rm -rf /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report/*
47- # 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/test_coverage.xml
44+ - name : Aggregate coverage report
45+ run : |
46+ mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report
47+ rm -rf /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report/*
48+ 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/test_coverage.xml
4849
49- # - name: Commit and push coverage reports
50- # if: success()
51- # run: |
52- # git config --global user.name "github-actions[bot]"
53- # git config --global user.email "github-actions[bot]@users.noreply.github.com"
54- # git fetch origin ${{ github.head_ref }}
55- # git checkout ${{ github.head_ref }}
56- # git pull origin ${{ github.head_ref }}
57- # git add /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/test_coverage.xml
58- # git commit -m "Add coverage index as XML format."
59- # git push origin ${{ github.head_ref }}
50+ # - name: Commit and push coverage reports
51+ # if: success()
52+ # run: |
53+ # git config --global user.name "github-actions[bot]"
54+ # git config --global user.email "github-actions[bot]@users.noreply.github.com"
55+ # git fetch origin ${{ github.head_ref }}
56+ # git checkout ${{ github.head_ref }}
57+ # git pull origin ${{ github.head_ref }}
58+ # git add /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/test_coverage.xml
59+ # git commit -m "Add coverage index as XML format."
60+ # git push origin ${{ github.head_ref }}
6061
61- # - name: Upload coverage to SonarCloud
62- # env:
63- # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
64- # uses: SonarSource/sonarcloud-github-action@v2
65- # with:
66- # args: >
67- # -Dsonar.projectKey=NHSDigital_immunisation-fhir-api
68- # -Dsonar.organization=nhsdigital
69- # -Dsonar.python.coverage.reportPaths=test_coverage.xml
62+ # - name: Upload coverage to SonarCloud
63+ # env:
64+ # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
65+ # uses: SonarSource/sonarcloud-github-action@v2
66+ # with:
67+ # args: >
68+ # -Dsonar.projectKey=NHSDigital_immunisation-fhir-api
69+ # -Dsonar.organization=nhsdigital
70+ # -Dsonar.python.coverage.reportPaths=test_coverage.xml
0 commit comments