Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
name: Code Coverage
on:
workflow_run:
workflows: ["Build Docker"]
types:
- completed
branches:
- main
- 'feature/*'
jobs:
code-coverage:
name: Run Code Coverage (STM32)
runs-on: ubuntu-latest
# Only run if the CI Pipeline succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0
- name: Set up Docker Compose
uses: docker/setup-compose-action@v1
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Docker Image
run: |
docker pull ghcr.io/robertgawron/hardwaredatalogger:${{ github.event.workflow_run.head_sha }}
docker tag ghcr.io/robertgawron/hardwaredatalogger:${{ github.event.workflow_run.head_sha }} hardwaredatalogger:latest
- name: Run Docker Compose
env:
DOCKER_IMAGE: ghcr.io/robertgawron/hardwaredatalogger:${{ github.event.workflow_run.head_sha }}
run: |
docker compose -f docker-compose.yml up -d
- name: Run Code Coverage
run: |
docker compose -f docker-compose.yml exec -T dev bash -c "
cd /workspace &&
rm -rf /tmp/cmake-coverage &&
cmake --preset coverage &&
cmake --build --preset coverage &&
cmake --build --preset coverage --target cov
"
- name: Upload Code Coverage Results
if: always()
uses: actions/upload-artifact@v4
with:
name: code-coverage-results
path: DevOps/BuildArtifacts/CppCodeCoverage
- name: Clean up Docker containers
if: always()
run: |
docker compose -f docker-compose.yml downd4cbf8c64This file is pinned to the selected release. Download the original to open it in your design tool.