Skip to content

added code

added code #23

Workflow file for this run

# name: Coverage report
# on:
# pull_request:
# jobs:
# coverage:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Set up Python
# uses: actions/setup-python@v3
# with:
# python-version: '3.10'
# - name: Set up AWS credentials
# env:
# AWS_ACCESS_KEY_ID: "FOOBARKEY"
# AWS_SECRET_ACCESS_KEY: "FOOBARSECRET"
# run: |
# aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
# aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
# - name: Install dependencies
# run: |
# 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
# - name: Run unit tests and generate coverage report for immunisation-fhir-api
# run: |
# mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
# coverage run -m unittest discover
# coverage report
# coverage xml -o /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report/test_coverage.xml
# working-directory: "/home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend"
# continue-on-error: true
# - name: List coverage report file
# run: |
# ls -R /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/backend/coverage_html_report
# - name: Aggregate coverage report
# run: |
# mkdir -p /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report
# rm -rf /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/coverage_html_report/*
# 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
# - name: Commit and push coverage reports
# if: success()
# run: |
# git config --global user.name "github-actions[bot]"
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git fetch origin ${{ github.head_ref }}
# git checkout ${{ github.head_ref }}
# git pull origin ${{ github.head_ref }}
# git add /home/runner/work/immunisation-fhir-api/immunisation-fhir-api/test_coverage.xml
# git commit -m "Add coverage index as XML format."
# git push origin ${{ github.head_ref }}
# - name: Upload coverage to SonarCloud
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# uses: SonarSource/sonarcloud-github-action@v2
# with:
# args: >
# -Dsonar.projectKey=NHSDigital_immunisation-fhir-api
# -Dsonar.organization=nhsdigital
# -Dsonar.python.coverage.reportPaths=test_coverage.xml