Loading files
name: Static Analysis (C++)
on:
workflow_run:
workflows: ["Build Docker"]
types:
- completed
branches:
- main
- 'feature/*'
jobs:
static-analysis-cpp:
name: Analysis (${{ matrix.name }})
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false # If one fails, let the others finish
matrix:
include:
# Business Logic Tests
- name: Business Logic - MeasurementCoordinator
target: test_MeasurementCoordinator
artifact_suffix: biz-coordinator
# Device Tests
- name: Device - Keyboard
target: test_Keyboard
artifact_suffix: dev-keyboard
- name: Device - PulseCounterSource
target: test_PulseCounterSource
artifact_suffix: dev-pulsecounter
- name: Device - WiFiRecorder
target: test_WiFiRecorder
artifact_suffix: dev-wifirecorder
- name: Device - WiFiSerializer
target: test_WiFiSerializer
artifact_suffix: dev-wifiserializer
- name: Device - Crc32
target: test_Crc32
artifact_suffix: dev-crc32
- name: Device - CobsEncoder
target: test_CobsEncoder
artifact_suffix: dev-cobsencoder
# Driver Tests
- name: Driver - AmbientLightSensor
target: test_LightSensorDriver
artifact_suffix: drv-ambient-light
- name: Driver - DisplayPixelColor
target: test_DisplayPixelColor
artifact_suffix: drv-display-pixel
- name: Driver - DriverComponent
target: test_DriverComponent
artifact_suffix: drv-state
- name: Driver - Keyboard
target: test_KeyboardDriver
artifact_suffix: drv-keyboard
- name: Driver - AmbientLight
target: test_AmbientLight
artifact_suffix: drv-ambient
- name: Driver - Uart
target: test_UartDriver
artifact_suffix: drv-uart
- name: Driver - PulseCounter
target: test_PulseCounterDriver
artifact_suffix: drv-pulse-counter
# Simulation
- name: Simulation - Library
target: SIMULATION_LIB
artifact_suffix: sim-library
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: Enable Swap Space
run: |
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
free -h
- 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 Static Analysis
run: |
docker compose -f docker-compose.yml exec -T dev bash -c "cd /workspace/build && cmake -G Ninja -DEXPORT_SINGLE_JSON=${{ matrix.target }} -DCMAKE_BUILD_TYPE=Debug .. && ninja CMakeFiles/cstatic"
- name: Upload Static Analysis Results
if: always()
uses: actions/upload-artifact@v4
with:
name: static-analysis-results-cpp-${{ matrix.artifact_suffix }}
path: DevOps/BuildArtifacts/StaticAnalysis
- name: Clean up Docker containers
if: always()
run: |
docker compose -f docker-compose.yml down
static-analysis-firmware:
name: Analysis (Firmware)
runs-on: ubuntu-latest
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 Static Analysis (Firmware)
run: |
docker compose -f docker-compose.yml exec -T dev bash -c "mkdir /workspace/build/ && cd /workspace/build/ && cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug .. && ninja cstatic_stm"
- name: Upload Static Analysis Results
if: always()
uses: actions/upload-artifact@v4
with:
name: static-analysis-results-cpp-fw
path: DevOps/BuildArtifacts/StaticAnalysis
- name: Clean up
if: always()
run: docker compose -f docker-compose.yml downa38f6f2eaThis file is pinned to the selected release. Download the original to open it in your design tool.