cmake rework to avoid crash on firmware startup #325
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: CI Pipeline | |
on: | |
push: | |
branches: | |
- main | |
- 'feature/*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
# Step 1: Build Docker image and push to registry | |
build: | |
name: Build Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push Docker Image | |
run: | | |
docker build -t ghcr.io/robertgawron/hardwaredatalogger:${{ github.sha }} -f DevOps/Dockerfile . | |
docker push ghcr.io/robertgawron/hardwaredatalogger:${{ github.sha }} | |
# Parallel Jobs: Unit Tests, Code Coverage, etc. | |
unit-tests: | |
name: Run Unit Tests | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- 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.sha }} | |
docker tag ghcr.io/robertgawron/hardwaredatalogger:${{ github.sha }} hardwaredatalogger:latest | |
- name: Run Docker Compose | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d | |
- name: Run Unit Tests | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml exec -T dev bash -c "cd /workspace && mkdir -p build && cd build && cmake .. && make -j24 && cd /workspace/build/Test/Unit/ && ctest --output-on-failure" | |
- name: Clean up Docker containers | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml down | |
system-tests: | |
name: Run System Tests | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- 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.sha }} | |
docker tag ghcr.io/robertgawron/hardwaredatalogger:${{ github.sha }} hardwaredatalogger:latest | |
- name: Run Docker Compose | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d | |
- name: Run System Tests | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml exec -T dev bash -c "cd /workspace/build/ && cmake .. && make -j24 && cd /workspace/Test/System && pytest test_*.py -s --html=/workspace/build/BuildArtifacts/SystemTests.html" | |
- name: Upload System Tests Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: system-tests-results | |
path: DevOps/BuildArtifacts/SystemTests.html | |
- name: Clean up Docker containers | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml down | |
code-coverage: | |
name: Run Code Coverage | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- 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.sha }} | |
docker tag ghcr.io/robertgawron/hardwaredatalogger:${{ github.sha }} hardwaredatalogger:latest | |
- name: Run Docker Compose | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d | |
- name: Run Code Coverage | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml exec -T dev bash -c "cd /workspace/build && cmake -DCMAKE_BUILD_TYPE=Debug .. && make -j$(nproc) && make coverage" | |
- name: Upload Code Coverage Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-results | |
path: DevOps/BuildArtifacts/CodeCoverage | |
- name: Clean up Docker containers | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml down | |
docs-coverage: | |
name: Run Docs Coverage | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- 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.sha }} | |
docker tag ghcr.io/robertgawron/hardwaredatalogger:${{ github.sha }} hardwaredatalogger:latest | |
- name: Run Docker Compose | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d | |
- name: Run Docs Coverage | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml exec -T dev bash -c "cd /workspace/build && cmake -DCMAKE_BUILD_TYPE=Debug .. && make -j$(nproc) && make docs" | |
- name: Upload Docs Coverage Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs-coverage-results | |
path: DevOps/BuildArtifacts/DocsCoverage | |
- name: Clean up Docker containers | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml down | |
static-analysis-python: | |
name: Run Static Analysis (python) | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- 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.sha }} | |
docker tag ghcr.io/robertgawron/hardwaredatalogger:${{ github.sha }} hardwaredatalogger:latest | |
- name: Run Docker Compose | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d | |
- name: Run Static Analysis | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml exec -T dev bash -c "\ | |
set -e; \ | |
cd /workspace/build && cmake .. && make pystatic" | |
- name: Upload Static Analysis (Python) Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: static-analysis-results-python | |
path: DevOps/BuildArtifacts/PythonStaticAnalysis | |
- name: Clean up Docker containers | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml down | |
static-analysis-c: | |
name: Run Static Analysis (cpp) | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- 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.sha }} | |
docker tag ghcr.io/robertgawron/hardwaredatalogger:${{ github.sha }} hardwaredatalogger:latest | |
- name: Run Docker Compose | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d | |
- name: Run Static Analysis | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml exec -T dev bash -c "\ | |
set -e; \ | |
cd /workspace/build && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_STANDARD=17 .. && make static" | |
- name: Upload Static Analysis Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: static-analysis-results-cpp | |
path: DevOps/BuildArtifacts/StaticAnalysis | |
- name: Clean up Docker containers | |
run: | | |
docker-compose -f docker-compose.yml -f docker-compose.ci.yml down |