Skip to content

Commit

Permalink
Merge pull request #86 from asam-ev/2024-06-18
Browse files Browse the repository at this point in the history
Update result file schema and add demo pipeline
  • Loading branch information
pmai authored Jun 20, 2024
2 parents 9a9af83 + 3107a1f commit e0dd506
Show file tree
Hide file tree
Showing 56 changed files with 1,776 additions and 436 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build-and-push-demo-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and push demo pipeline image

on:
schedule:
- cron: '0 4 * * *' # 04:00 AM UTC every day

jobs:
build-and-push-demo:
runs-on: ubuntu-22.04

permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: develop # @TODO remove it later

- name: Get current date
id: date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV

- 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.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.linux
push: true
target: demo_pipeline
tags: |
ghcr.io/${{ github.repository_owner }}/qc-framework:demo-pipeline-latest
ghcr.io/${{ github.repository_owner }}/qc-framework:demo-pipeline-${{ env.DATE }}
113 changes: 113 additions & 0 deletions .github/workflows/build-on-change-linux-bare.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Build framework on Linux Bare

on:
# execute on every PR made targeting the branches bellow
pull_request:
branches:
- main
- develop # can be removed on main merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**
- test/**
- .github/workflows/**
- doc/**
- runtime/**
- docker/**

# execute on every push made targeting the branches bellow
push:
branches:
- main
- develop # can be removed on main merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**
- test/**
- .github/workflows/**
- doc/**
- runtime/**
- docker/**

jobs:
build-linux:
runs-on: ubuntu-22.04
env:
TEST_ENABLED: ${{ github.event_name == 'pull_request' && 'ON' || 'OFF' }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Create dependencies build space
run: mkdir dependencies
shell: bash

- name: Install dependencies
working-directory: dependencies
run: |
echo "Installing Dependencies..."
sudo apt update
sudo apt install \
g++ \
g++-10 \
make \
build-essential \
cmake \
libgtest-dev \
qtbase5-dev \
libqt5xmlpatterns5-dev \
libxerces-c-dev \
pkg-config
echo "Dependencies installed."
shell: bash

- name: Build framework
# Currently this is building without the XSD file. If we want to expose
# the build artifact after, we might as well need to add the XSD file.
run: |
echo Building framework...
cmake -G "Unix Makefiles" -B./build -S . \
-DCMAKE_INSTALL_PREFIX="/home/$(whoami)/qc-build" \
-DENABLE_FUNCTIONAL_TESTS=$TEST_ENABLED -DXERCES_ROOT="/usr" \
-DQt5_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5/" \
-DQt5XmlPatterns_DIR="/usr/lib/x86_64-linux-gnu/cmake/Qt5XmlPatterns/"
cmake --build ./build --target install --config Release -j4
cmake --install ./build
echo Done.
shell: bash

- name: Unit test execution
if: github.event_name == 'pull_request'
run: |
echo Starting tests...
ctest --test-dir build -C Release
echo All tests done.
shell: bash

- name: Archive test results
if: github.event_name == 'pull_request' && (success() || failure())
uses: actions/upload-artifact@v4
with:
name: unit-test-report
path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log

- name: Runtime test execution
if: github.event_name == 'pull_request'
run: |
mv build out_build
cp -r /home/$(whoami)/qc-build/bin bin
cp out_build/examples/checker_bundle_example/DemoCheckerBundle bin/
cd runtime
python3 -m pip install -r requirements.txt
python3 -m pytest -rA > runtime_test.log
- name: Archive runtime test results
if: github.event_name == 'pull_request' && (success() || failure())
uses: actions/upload-artifact@v4
with:
name: runtime-test-report
path: ${{ github.workspace }}/runtime/runtime_test.log
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Build framework on Linux
name: Build framework on Linux Docker

on:
# execute on every PR made targeting the branches bellow
pull_request:
branches:
- master
- develop # can be removed on master merge
- main
- develop # can be removed on main merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**
- tests/**
- test/**
- .github/workflows/**
- doc/**
- runtime/**
Expand All @@ -19,12 +19,13 @@ on:
# execute on every push made targeting the branches bellow
push:
branches:
- master
- develop # can be removed on master merge
- main
- develop # can be removed on main merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**
- test/**
- .github/workflows/**
- doc/**
- runtime/**
Expand All @@ -39,9 +40,9 @@ jobs:

- name: Docker Build
run: |
docker build -f docker/Dockerfile.linux --target unit_test -t unit_test .
docker build -f docker/Dockerfile.linux --target runtime_test -t runtime_test .
docker build -f docker/Dockerfile.linux --target unit_test -t unit_test .
docker build -f docker/Dockerfile.linux --target runtime_test -t runtime_test .
- name: Unit test execution
if: github.event_name == 'pull_request'
run: |
Expand All @@ -53,16 +54,15 @@ jobs:
with:
name: unit-test-report
path: ${{ github.workspace }}/LastTest.log

- name: Runtime test execution
if: github.event_name == 'pull_request'
run: |
docker run -v ${{ github.workspace }}:/out --rm --name runtime_test runtime_test
- name: Archive runtime test results
if: github.event_name == 'pull_request' && (success() || failure())
uses: actions/upload-artifact@v4
with:
name: runtime-test-report
path: ${{ github.workspace }}/runtime_test.log

20 changes: 9 additions & 11 deletions .github/workflows/build-on-change-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
# execute on every PR made targeting the branches bellow
pull_request:
branches:
- master
- develop # can be removed on master merge
- main
- develop # can be removed on main merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
Expand All @@ -19,12 +19,13 @@ on:
# execute on every push made targeting the branches bellow
push:
branches:
- master
- develop # can be removed on master merge
- main
- develop # can be removed on main merge
paths: # we only include paths critical for building to avoid unnecessary runs
- src/**
- include/**
- scripts/cmake/**
- test/**
- .github/workflows/**
- doc/**
- runtime/**
Expand Down Expand Up @@ -124,7 +125,7 @@ jobs:
Write-Output "All unit tests done."
shell: pwsh

- name: Archive test results
if: github.event_name == 'pull_request' && (success() || failure())
uses: actions/upload-artifact@v4
Expand All @@ -138,15 +139,12 @@ jobs:
Write-Output "Starting runtime tests..."
Rename-Item -path "$env:WORKING_PATH\qc-framework\qc-framework\build" -NewName "$env:WORKING_PATH\qc-framework\qc-framework\out_build"
Copy-Item -Path "$env:WORKING_PATH\QC-Framework-Out" -Destination "$env:WORKING_PATH\qc-framework\qc-framework\build" -Recurse
Copy-Item -Path "$env:WORKING_PATH\qc-framework\qc-framework\out_build\examples\checker_bundle_example\Release\DemoCheckerBundle.exe" -Destination "$env:WORKING_PATH\qc-framework\qc-framework\build\bin"
Copy-Item -Path "$env:WORKING_PATH\QC-Framework-Out\bin" -Destination "$env:WORKING_PATH\qc-framework\qc-framework\bin" -Recurse
Copy-Item -Path "$env:WORKING_PATH\qc-framework\qc-framework\out_build\examples\checker_bundle_example\Release\DemoCheckerBundle.exe" -Destination "$env:WORKING_PATH\qc-framework\qc-framework\bin"
cd "$env:WORKING_PATH\qc-framework\qc-framework\runtime"
python3 -m pip install -r requirements.txt
python3 -m pytest
Write-Output "All runtime tests done."
shell: pwsh



15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: no-commit-to-branch
args: [--branch=main]

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
hooks:
- id: clang-format
files: \.(c|cc|cxx|cpp|h|hpp|hxx)$
args: ["--style=file", "-i"]
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ An architecture overview and documentation is provided in the

# Getting Started

## Using Docker-based demo pipeline

A [Docker-based demo pipeline](demo_pipeline/README.md) is provided to help users try out the latest development
of the framework, as well as the [OpenDrive](https://github.com/asam-ev/qc-opendrive/tree/develop)
and [OpenScenario XML](https://github.com/asam-ev/qc-openscenarioxml/tree/develop) checker bundles.

## Build the framework locally

As the framework is still under development, it is not recommended to build
it locally. A complete build instruction will be available in the near future.

The software can be build for Windows and Linux. Currently there are no
pre-built binaries available for the framework. Follow the [build
instructions](INSTALL.md) to create a runnable binary on your machine.
Expand Down
82 changes: 82 additions & 0 deletions demo_pipeline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Demo pipeline

The demo pipeline allow users to process OpenDRIVE and OpenSCENARIO XML files with respecting checkers and inspect the resulting `xqar` and `txt` files.

### Download and run

The demo pipeline is provided as a public Docker image in the Github container registry.

To process a file, the `docker run` command below can be used and the following information can be specified:
- The input folder which contains the input file.
- The name the input file.
- The output folder where the output files can be saved.

```
docker run \
-e INPUT_FILENAME=YOUR_INPUT_FILENAME \
-v YOUR_INPUT_FOLDER:/input_directory \
-v YOUR_OUTPUT_FOLDER:/out \
-e USER_ID=$(id -u) \
-e GROUP_ID=$(id -g) \
--rm --name demo_pipeline ghcr.io/asam-ev/qc-framework:demo-pipeline-latest
```

E.g. To process the file at `/home/user/xodr_files/test_ramp.xosc`

```
docker run \
-e INPUT_FILENAME=test_ramp.xosc \
-v /home/user/xodr_files:/input_directory \
-v /home/user/output:/out \
-e USER_ID=$(id -u) \
-e GROUP_ID=$(id -g) \
--rm --name demo_pipeline ghcr.io/asam-ev/qc-framework:demo-pipeline-latest
```

Alternatively, you can go to the input folder and execute the following command, which requires only the input file name to be specified. The output will be saved in the same folder.

```
cd /home/user/xodr_files
docker run \
-e INPUT_FILENAME=test_ramp.xosc \
-v $(pwd):/input_directory \
-v $(pwd):/out \
-e USER_ID=$(id -u) \
-e GROUP_ID=$(id -g) \
--rm --name demo_pipeline ghcr.io/asam-ev/qc-framework:demo-pipeline-latest
```

The docker image will automatically:
- Detect the type of file passed as input.
- Create the specific config according to [config schema](../doc/schema/config_format.xsd).
- Execute the runtime with specific checker, result pooling and text result application.

Currently the demo_pipeline will clone and execute:

- [OpenDRIVE checker @ develop branch](https://github.com/asam-ev/qc-opendrive/tree/develop)
- [OpenSCENARIO XML checker @ develop branch](https://github.com/asam-ev/qc-openscenarioxml/tree/develop)

After the execution, in the specified output folder you will find:

- Specific CheckerBundle `xqar` result file.
- ResultPooling `Result.xqar` result file.
- TextReport `Report.txt` text file.

Some OpenDrive and OpenScenario XML test files are available to try out.
- [OpenDrive test files](https://github.com/asam-ev/qc-opendrive/tree/develop/tests/data)
- [OpenScenario XML test files](https://github.com/asam-ev/qc-openscenarioxml/tree/develop/tests/data)

### Local build instructions

In case of local build of demo_pipeline docker image, you can execute:

```
cd ..
DOCKER_BUILDKIT=1 \
docker build \
-f docker/Dockerfile.linux \
--target demo_pipeline \
-t demo_pipeline .
```
Loading

0 comments on commit e0dd506

Please sign in to comment.