Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions .github/actions/make/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ inputs:
description: "[Optional] Cache suffix (e.g. 'base')"
required: false
default: ""
coverage-cache-suffix:
description: "[Optional] Coverage cache suffix (e.g. 'coverage')"
required: false
default: ""
restore-coverage:
description: "[Optional] Coverage restore? if true please provide coverage-cache-suffix"
required: false
default: "false"
cache-coverage:
description: "[Optional] Coverage caching? if true please provide coverage-cache-suffix and paths-to-cache as the coverage file"
required: false
default: "false"
restore-from-cache:
description: "[Optional] restore from cache?"
required: false
Expand All @@ -20,6 +32,9 @@ inputs:
description: "[Optional] save to cache?"
required: false
default: "false"
paths-to-cache:
description: "[Optional] paths to cache?"
required: false
runs:
using: "composite"
steps:
Expand All @@ -28,12 +43,19 @@ runs:
shell: bash

- name: Restore from the cache
if: ${{ inputs.restore-from-cache == 'true' }}
if: ${{ inputs.restore-from-cache == 'true' && inputs.restore-coverage != 'true'}}
uses: ./.github/actions/components/caching/
with:
save-or-restore: "restore"
cache-suffix: ${{ inputs.cache-suffix }}

- name: Restore coverage from the cache
if: ${{ inputs.restore-from-cache == 'true' && inputs.restore-coverage == 'true'}}
uses: ./.github/actions/components/caching/
with:
save-or-restore: "restore"
cache-suffix: ${{ inputs.coverage-cache-suffix }}

- name: Configure AWS Credentials
id: configure-aws-credentials
if: inputs.requires-aws
Expand Down Expand Up @@ -66,8 +88,16 @@ runs:
AWS_SECRET_ACCESS_KEY: ${{ steps.configure-aws-credentials.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.configure-aws-credentials.outputs.aws-session-token }}

- name: Save to the cache
if: ${{ inputs.save-to-cache == 'true' }}
- name: Save to the cache with path (for coverage)
if: ${{ inputs.save-to-cache == 'true' && inputs.cache-coverage == 'true'}}
uses: ./.github/actions/components/caching/
with:
save-or-restore: "save"
cache-suffix: ${{ inputs.coverage-cache-suffix }}
paths-to-cache: ${{ inputs.paths-to-cache }}

- name: Save to the cache default paths
if: ${{ inputs.save-to-cache == 'true' && inputs.cache-coverage != 'true'}}
uses: ./.github/actions/components/caching/
with:
save-or-restore: "save"
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ jobs:
branch_name=${branch_name#*refs/tags/}
echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT

test--coverage-sonar:
runs-on: [self-hosted, ci]
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Restore coverage from the cache
uses: ./.github/actions/components/caching/
with:
save-or-restore: "restore"
cache-suffix: "coverage"
paths-to-cache: "sonarcloud-coverage.xml"

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io

make-tag:
runs-on: [self-hosted, ci]
permissions: write-all
Expand Down
37 changes: 35 additions & 2 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ permissions:

env:
BASE_CACHE_SUFFIX: base
BASE_BRANCH_NAME: ${{ github.event.pull_request.base.ref }}
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
BASE_BRANCH_NAME: main
BRANCH_NAME: feature/PI-855-add_sonar_code_coverage
CI_ROLE_NAME: ${{ secrets.CI_ROLE_NAME }}
BRANCH_GITHUB_SHA_SHORT: $(echo ${{ github.event.pull_request.head.sha }} | cut -c 1-7)
TF_CLI_ARGS: -no-color
Expand Down Expand Up @@ -275,6 +275,39 @@ jobs:
command: test--smoke
requires-aws: true

test--coverage-sonar:
needs:
[
build-head,
workflow--codebase-checks,
test--unit,
test--feature--local,
terraform-head-build,
test--feature--integration,
test--integration,
apigee--deploy,
apigee--attach-product,
test--smoke,
]
runs-on: [self-hosted, ci]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}
- uses: ./.github/actions/make/
with:
command: test--coverage
requires-aws: true
save-to-cache: "true"
cache-coverage: "true"
coverage-cache-suffix: "coverage"
paths-to-cache: "sonarcloud-coverage.xml"
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io

apigee--detach-product:
needs:
[
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ cpm.cdx.json
test_failure.json
test_success_*.json
pyrightconfig.json
sonarcloud-coverage.xml
1 change: 0 additions & 1 deletion .sonarcloud.properties

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 2025-03-18
- [PI-761] Product Team name cannot be blank
- [PI-850] Readme Review
- [PI-855] Code coverage

## 2025-03-12
- [PI-841] Remove VPC cpm-sds-etl-hscn-vpc
- [PI-851] Swagger spec refinement - Part Deux
Expand Down
Loading
Loading