Merge pull request #86 from NHSDigital/AMB-2232---sonarcloud #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SonarCloud | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [labeled, opened, synchronize, reopened, unlabeled] | |
jobs: | |
sonarcloud: | |
name: SonarCloud | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependency') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- 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: Run unittest with filenameprocessor-coverage | |
run: | | |
pip install poetry moto==4.2.11 coverage redis botocore==1.35.49 simplejson | |
poetry run coverage run --source=filenameprocessor -m unittest discover -s filenameprocessor | |
poetry run coverage xml -o filenameprocessor-coverage.xml | |
- name: Run unittest with recordprocessor-coverage | |
run: | | |
poetry run coverage run --source=recordprocessor -m unittest discover -s recordprocessor | |
poetry run coverage xml -o recordprocessor-coverage.xml | |
- name: Run unittest with recordforwarder-coverage | |
run: | | |
poetry run coverage run --source=recordforwarder -m unittest discover -s recordforwarder | |
poetry run coverage xml -o recordforwarder-coverage.xml | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |