Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
215 changes: 215 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
# TODO:
# - Keep Container available to GitHub Actions through CONTAINER_REPO_TOKEN,
# or move it to a vendored, submodule, GitHub Packages, or self-hosted runner
# setup before making build-linux mandatory.
# - Keep KDReports pinned to a release tag and make build-linux required only
# after dependency bootstrap is stable in CI.
# - Make clang-format blocking after the existing source tree has been
# formatted once.

name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

permissions:
contents: read

env:
BUILD_TYPE: Release
CONTAINER_REF: v0.2.0
KDREPORTS_REF: kdreports-2.3.0

jobs:
lint:
name: Lint
runs-on: ubuntu-24.04

steps:
- name: Check out CargoNetSim
uses: actions/checkout@v4

- name: Install lint dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: cmake clang-format
version: 1.0

- name: Check root CMake file
run: cmake -E cat CMakeLists.txt > /dev/null

- name: Write markdownlint configuration
run: |
cat > .markdownlint-cli2.jsonc <<'JSON'
{
"config": {
"MD012": false,
"MD013": false,
"MD022": false,
"MD032": false,
"MD033": false,
"MD034": false,
"MD041": false
}
}
JSON

- name: Lint Markdown
uses: DavidAnson/markdownlint-cli2-action@v23.1.0
with:
config: .markdownlint-cli2.jsonc
globs: "*.md"

- name: Check clang-format
if: ${{ hashFiles('.clang-format') != '' }}
continue-on-error: true
shell: bash
run: |
shopt -s globstar nullglob
files=(src/**/*.cpp src/**/*.h)
if (( ${#files[@]} == 0 )); then
echo "No C++ source files found."
exit 0
fi
clang-format --dry-run --Werror "${files[@]}"

build-linux:
name: Build Linux
runs-on: ubuntu-24.04
continue-on-error: true

env:
DEPS_PREFIX: ${{ github.workspace }}/deps/install
CMAKE_BUILD_PARALLEL_LEVEL: 2
CMAKE_CXX_COMPILER_LAUNCHER: ccache

steps:
- name: Check out CargoNetSim
uses: actions/checkout@v4

- name: Check Container token
env:
CONTAINER_REPO_TOKEN: ${{ secrets.CONTAINER_REPO_TOKEN }}
run: |
if [ -z "${CONTAINER_REPO_TOKEN}" ]; then
echo "::error::CONTAINER_REPO_TOKEN is required to check out the private Container dependency."
exit 1
fi

- name: Check out Container
uses: actions/checkout@v4
with:
repository: AhmedAredah/container
token: ${{ secrets.CONTAINER_REPO_TOKEN }}
ref: ${{ env.CONTAINER_REF }}
path: deps/container

- name: Check out KDReports
uses: actions/checkout@v4
with:
repository: KDAB/KDReports
ref: ${{ env.KDREPORTS_REF }}
path: deps/kdreports

- name: Install build dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: cmake qt6-base-dev qt6-tools-dev libyaml-cpp-dev librabbitmq-dev build-essential ninja-build ccache
version: 1.0

- name: Prepare RabbitMQ-C include compatibility
run: |
mkdir -p "${DEPS_PREFIX}/include/rabbitmq-c"
for header in /usr/include/amqp*.h; do
ln -sf "${header}" "${DEPS_PREFIX}/include/rabbitmq-c/$(basename "${header}")"
done
ln -sf /usr/include/amqp_tcp_socket.h "${DEPS_PREFIX}/include/rabbitmq-c/tcp_socket.h"

- name: Cache CMake build and compiler output
uses: actions/cache@v4
with:
path: |
~/.ccache
build
key: ${{ runner.os }}-cmake-${{ hashFiles('CMakeLists.txt', 'cmake/**') }}
restore-keys: |
${{ runner.os }}-cmake-

- name: Configure Container
run: |
cmake -S deps/container -B deps/build/container -G Ninja \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DCMAKE_INSTALL_PREFIX="${DEPS_PREFIX}" \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_PYTHON_BINDINGS=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_DOCS=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER="${CMAKE_CXX_COMPILER_LAUNCHER}"

- name: Install Container
run: cmake --build deps/build/container --target install

- name: Configure KDReports
run: |
cmake -S deps/kdreports -B deps/build/kdreports -G Ninja \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DCMAKE_INSTALL_PREFIX="${DEPS_PREFIX}" \
-DKDReports_QT6=ON \
-DKDReports_TESTS=OFF \
-DKDReports_EXAMPLES=OFF \
-DKDReports_DOCS=OFF \
-DKDReports_PYTHON_BINDINGS=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER="${CMAKE_CXX_COMPILER_LAUNCHER}"

- name: Install KDReports
run: cmake --build deps/build/kdreports --target install

- name: Patch KDReports Qt6 package config
run: |
config_file="${DEPS_PREFIX}/lib/cmake/KDReports-qt6/KDReports-qt6Config.cmake"
sed -i \
-e 's/find_dependency(QtCore /find_dependency(Qt6Core /' \
-e 's/find_dependency(QtWidgets /find_dependency(Qt6Widgets /' \
-e 's/find_dependency(QtPrintSupport /find_dependency(Qt6PrintSupport /' \
-e 's/find_dependency(QtXml /find_dependency(Qt6Xml /' \
"${config_file}"

- name: Configure CargoNetSim
id: configure-cargonet
continue-on-error: true
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DCMAKE_PREFIX_PATH="${DEPS_PREFIX};/usr" \
-DCONTAINER_CMAKE_DIR="${DEPS_PREFIX}/lib/cmake/Container" \
-DKDREPORTS_DIR="${DEPS_PREFIX}/lib/cmake/KDReports-qt6" \
-DRABBITMQ_CMAKE_DIR="/usr/lib/x86_64-linux-gnu/cmake/rabbitmq-c" \
-DYAMLCPP_CMAKE_DIR="/usr/lib/x86_64-linux-gnu/cmake/yaml-cpp" \
-DCARGONET_BUILD_TESTS=OFF \
-DCARGONET_BUILD_INSTALLER=OFF \
-DCARGONET_BUILD_RABBITMQ_CONFIG=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER="${CMAKE_CXX_COMPILER_LAUNCHER}"

- name: Build CargoNetSim
id: build-cargonet
if: ${{ steps.configure-cargonet.outcome == 'success' }}
continue-on-error: true
run: cmake --build build

- name: Report advisory build result
if: ${{ always() }}
run: |
if [ "${{ steps.configure-cargonet.outcome }}" != "success" ]; then
echo "::warning::CargoNetSim configure failed. build-linux is advisory until dependency bootstrap is stable in CI."
exit 0
fi
if [ "${{ steps.build-cargonet.outcome }}" != "success" ]; then
echo "::warning::CargoNetSim build failed. build-linux is advisory until dependency bootstrap and source build compatibility are stable in CI."
exit 0
fi
echo "CargoNetSim configure and build completed successfully."
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

All notable changes to CargoNetSim will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

See the Git log for full history prior to this changelog.

## [Unreleased]

## [0.0.1] - 2026-05-05

### Added

- Initial public release - multimodal cargo network simulator with Qt6 GUI and CLI.

[Unreleased]: https://github.com/AhmedAredah/CargoNetSim/compare/master...HEAD
[0.0.1]: https://github.com/AhmedAredah/CargoNetSim/compare/96a0a6bc7c743c362e993a68f3e6ec3c72c6deee...master
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<a href="https://www.gnu.org/licenses/gpl-3.0">
<img src="https://img.shields.io/badge/License-GPLv3-blue.svg" alt="License: GNU GPL v3">
</a>
<a href="https://github.com/AhmedAredah/CargoNetSim/actions/workflows/ci.yml">
<img src="https://github.com/AhmedAredah/CargoNetSim/actions/workflows/ci.yml/badge.svg" alt="CI">
</a>
<a href="https://github.com/VTTI-CSM/CargoNetSim/releases">
<img alt="GitHub tag (latest by date)" src="https://img.shields.io/github/v/tag/VTTI-CSM/CargoNetSim.svg?label=latest">
</a>
Expand Down
Loading