Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
80 changes: 80 additions & 0 deletions .github/workflows/README-CPP-TEST-BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# C++ Test Package Build Workflows

## Overview
Two workflows are provided for building C++ test Docker packages:

### 1. **Build Test Package** (`build-cpp-test-package.yml`)
- Builds on every commit to cpp branches
- Creates versioned test packages with cpp-test prefix
- Publishes to GitHub Container Registry

### 2. **Auto Build with PR Support** (`cpp-test-auto-build.yml`)
- Builds on every commit to cpp branches
- Builds for PRs (creates artifacts without publishing)
- Includes comprehensive testing and validation

## Docker Image Naming Convention

All C++ test packages are published with distinguished names:
- **Registry**: `ghcr.io`
- **Repository**: `<your-org>/sdv-runtime-cpp-test`
- **Tags**:
- `cpp-compiler-latest` - Latest from cpp-compiler branch
- `cpp-compiler-20240118-abc1234` - Specific version
- `pr-123-abc1234` - Pull request builds

## Usage

### Trigger Build
```bash
# Any commit will trigger a build
git commit -m "Add new feature"
git push
```

### Pull Test Package
```bash
# Latest C++ test package
docker pull ghcr.io/eclipse-autowrx/sdv-runtime-cpp-test:cpp-compiler-latest

# Specific version
docker pull ghcr.io/eclipse-autowrx/sdv-runtime-cpp-test:cpp-compiler-20240118-abc1234
```

### Run Test Package
```bash
docker run -d \
--name sdv-cpp-test \
-p 55555:55555 \
-p 3090:3090 \
ghcr.io/eclipse-autowrx/sdv-runtime-cpp-test:cpp-compiler-latest
```

## Configuration

### Change Target Branch
Edit the workflow file:
```yaml
on:
push:
branches:
- cpp-compiler # Add your branch here
- another-branch
```

### Change Image Name Pattern
Edit the `IMAGE_NAME` environment variable:
```yaml
env:
IMAGE_NAME: ${{ github.repository }}-cpp-experimental # Change suffix
```

## Build Status

The workflows generate detailed summaries including:
- Docker image tags
- Pull commands
- Build metadata
- Version information

Check the Actions tab in GitHub for build status and summaries.
90 changes: 90 additions & 0 deletions .github/workflows/build-cpp-test-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build C++ Test Package on Every Commit

on:
push:
branches:
- cpp-compilation-feature
- cpp-compiler
paths-ignore:
- '**.md'
- 'docs/**'
- '.gitignore'

jobs:
check-and-build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}

- name: Verify submodules
run: |
echo "Checking submodules..."
git submodule status
if [ ! -d "vehicle_signal_specification" ] || [ ! -d "vehicle-model-generator" ]; then
echo "Submodules not found, initializing..."
git submodule update --init --recursive
fi
ls -la vehicle_signal_specification/ || echo "VSS submodule missing"
ls -la vehicle-model-generator/ || echo "Vehicle model generator submodule missing"

- 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: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch,prefix=cpp-test-
type=raw,value=cpp-test-latest,enable=${{ github.ref == 'refs/heads/cpp-compiler' || github.ref == 'refs/heads/cpp-compilation-feature' }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BUILD_DATE=${{ github.event.head_commit.timestamp }}
VCS_REF=${{ github.sha }}
VERSION=cpp-test-${{ github.sha }}

- name: Generate build summary
run: |
echo "## 🐳 C++ Test Package Built Successfully" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Docker Images:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "${{ steps.meta.outputs.tags }}" | tr ',' '\n' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Build Info:" >> $GITHUB_STEP_SUMMARY
echo "- **Branch**: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
echo "- **Commit**: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
echo "- **Author**: ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY
echo "- **Message**: ${{ github.event.head_commit.message }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Pull Image:" >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
echo "docker pull ghcr.io/${{ github.repository }}:cpp-test-${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
109 changes: 109 additions & 0 deletions .github/workflows/cpp-compilation-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# DISABLED: C++ Compilation Service Tests
# To enable: remove the comment above and uncomment the 'on:' section below

name: C++ Compilation Service Tests

# on:
# push:
# branches: [ main, cpp-compilation-feature ]
# pull_request:
# branches: [ main ]

jobs:
test-cpp-compilation:
runs-on: ubuntu-latest

services:
docker:
image: docker:dind
options: --privileged

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install dependencies
run: |
npm install
npm install socket.io-client

- name: Build SDV Runtime container
run: |
docker build \
--tag sdv-runtime-production:latest \
--progress=plain .

- name: Start SDV Runtime container
run: |
mkdir -p docker-output
docker run -d \
--name sdv-runtime-container \
--publish 3090:3090 \
--volume "$(pwd)/docker-output:/home/dev/data/output" \
sdv-runtime-production:latest

- name: Wait for container to be ready
run: |
echo "Waiting for SDV Runtime to start..."
for i in {1..30}; do
if curl -f http://localhost:3090 >/dev/null 2>&1; then
echo "SDV Runtime is ready!"
break
fi
echo "Attempt $i/30: Still waiting..."
sleep 2
done

# Verify container is running
docker ps | grep sdv-runtime-container
docker logs sdv-runtime-container

- name: Run automated test suite
run: |
chmod +x test/ci/automated-test-suite.js
node test/ci/automated-test-suite.js
env:
SDV_SERVER_URL: http://localhost:3090
TEST_TIMEOUT: 60000

- name: Run individual tests
run: |
echo "Running connection test..."
timeout 15 node test/scripts/connection-test.js

echo "Running basic compilation test..."
timeout 30 node test/scripts/basic-test.js

echo "Running multi-file test..."
timeout 45 node test/02-multi-file/test-multifile.js

- name: Check generated executables
run: |
echo "Checking generated executables..."
ls -la docker-output/
if [ -n "$(ls -A docker-output/)" ]; then
echo "✅ Executables generated successfully"
file docker-output/app_* | head -3
else
echo "❌ No executables found"
exit 1
fi

- name: Container logs (on failure)
if: failure()
run: |
echo "=== Container Logs ==="
docker logs sdv-runtime-container
echo "=== Container Status ==="
docker ps -a | grep sdv-runtime

- name: Cleanup
if: always()
run: |
docker stop sdv-runtime-container || true
docker rm sdv-runtime-container || true
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ mock/mock_service.log
mock_service.log
.vssclient_history
data/python-packages/
data/custom-models/
data/custom-models/

# C++ Compilation Output
docker-output/
node_modules/
18 changes: 15 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ RUN groupadd -r sdvr && useradd -r -g sdvr dev \
FROM ubuntu:22.04 AS python-builder
ARG TARGETARCH

# Install Python and pip
# Install Python and pip + C++ compilation tools
RUN apt-get update && apt-get install -y \
python3 python3-pip git build-essential \
python3 python3-pip git build-essential cmake make gcc g++ \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand Down Expand Up @@ -98,6 +98,18 @@ COPY --chown=dev:sdvr --chmod=0755 mock /home/dev/ws/mock/
COPY mosquitto-no-auth.conf /etc/mosquitto/mosquitto-no-auth.conf
COPY --chown=dev:sdvr --chmod=0755 start_services.sh /start_services.sh

# Install Node.js and C++ compilation dependencies
RUN apt-get update && apt-get install -y \
nodejs npm cmake make gcc g++ \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy Kit-Manager for C++ compilation
COPY --chown=dev:sdvr Kit-Manager /home/dev/Kit-Manager

# Install Kit-Manager dependencies
WORKDIR /home/dev/Kit-Manager
RUN npm install

ENV PYTHONPATH="/home/dev/python-packages/:${PYTHONPATH}"

# Re-install grpcio to ensure it's built for the target platform
Expand All @@ -122,7 +134,7 @@ ENV KIT_MANAGER_PORT=3090
ENV KUKSA_DATABROKER_METADATA_FILE=/home/dev/ws/vss.json
EXPOSE $KUKSA_DATABROKER_PORT $KIT_MANAGER_PORT

RUN mkdir /home/dev/data
RUN mkdir -p /home/dev/data/ws /home/dev/data/output
RUN chown -R dev /home/dev/data
RUN chmod -R 777 /home/dev/data

Expand Down
Loading