navid/veins / master / .circleci/config.yml
config.yml
← .circleci · 7620 bytes · raw · download
version: 2.1
parameters:
veinsforge_repository:
type: string
default: ""
veinsforge_bookmark:
type: string
default: ""
veinsforge_tag:
type: string
default: ""
veinsforge_ref:
type: string
default: ""
veinsforge_commit:
type: string
default: ""
executors:
linux-x86_64:
docker:
- image: cimg/base:stable
resource_class: medium
linux-aarch64:
machine:
image: ubuntu-2204:current
resource_class: arm.medium
windows-x86_64:
machine:
image: windows-server-2022-gui:current
resource_class: windows.medium
commands:
install-linux-deps:
steps:
- run:
name: Install build dependencies
command: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build g++ libssl-dev zip jq curl
build-and-package-linux:
parameters:
arch:
type: string
steps:
- install-linux-deps
- checkout
- run:
name: Configure
command: |
VERSION="${CIRCLE_TAG#v}"
if [ -z "$VERSION" ]; then VERSION="0.0.0-dev"; fi
echo "export VERSION=$VERSION" >> "$BASH_ENV"
cmake -S xveins -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DVN_VERSION="$VERSION"
- run:
name: Build
command: cmake --build build -j "$(nproc)"
- run:
name: Test
command: ctest --test-dir build --output-on-failure
- run:
name: Package
command: |
cmake --install build --prefix stage
mkdir -p workspace/release workspace/artifacts
(cd stage && zip -r "../workspace/release/vn-${VERSION}-linux-<< parameters.arch >>.zip" .)
- store_artifacts:
path: workspace/release
- run:
name: Record artifact links
command: |
if [ -n "$CIRCLECI_API_TOKEN" ]; then
curl -fsS -H "Circle-Token: $CIRCLECI_API_TOKEN" \
"https://circleci.com/api/v2/job/$CIRCLE_WORKFLOW_JOB_ID/artifacts" \
> "workspace/artifacts/${CIRCLE_JOB}.json"
else
printf '{"items":[]}\n' > "workspace/artifacts/${CIRCLE_JOB}.json"
fi
- persist_to_workspace:
root: .
paths:
- workspace/artifacts
- workspace/release
jobs:
build-linux-x86_64:
executor: linux-x86_64
steps:
- build-and-package-linux:
arch: x86_64
build-linux-aarch64:
executor: linux-aarch64
steps:
- build-and-package-linux:
arch: aarch64
build-linux-x86_64-asan:
executor: linux-x86_64
steps:
- install-linux-deps
- checkout
- run:
name: Configure with AddressSanitizer and UndefinedBehaviorSanitizer
command: |
cmake -S xveins -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \
-DCMAKE_C_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" \
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"
- run:
name: Build
command: cmake --build build -j "$(nproc)"
- run:
name: Test
command: |
ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=halt_on_error=1 \
ctest --test-dir build --output-on-failure
build-windows-x86_64:
executor: windows-x86_64
steps:
- checkout
- run:
name: Install build dependencies
shell: powershell
command: |
choco install cmake ninja -y --no-progress
$vcpkgDir = "C:\vcpkg-2026.10.16"
if (-not (Test-Path "$vcpkgDir\vcpkg.exe")) {
git clone --depth 1 --branch 2026.10.16 https://github.com/microsoft/vcpkg.git $vcpkgDir
& "$vcpkgDir\bootstrap-vcpkg.bat"
}
& "$vcpkgDir\vcpkg.exe" install openssl:x64-windows-static
- run:
name: Configure
shell: powershell
command: |
$version = if ($env:CIRCLE_TAG) { $env:CIRCLE_TAG -replace '^v', '' } else { '0.0.0-dev' }
"VERSION=$version" | Out-File -FilePath $env:BASH_ENV -Append -Encoding ascii
cmake -S xveins -B build -G Ninja `
-DCMAKE_BUILD_TYPE=Release `
-DVN_VERSION="$version" `
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg-2026.10.16/scripts/buildsystems/vcpkg.cmake `
-DVCPKG_TARGET_TRIPLET=x64-windows-static
- run:
name: Build
shell: powershell
command: cmake --build build -j 4
- run:
name: Test
shell: powershell
command: ctest --test-dir build -C Release --output-on-failure
- run:
name: Package
shell: powershell
command: |
$version = if ($env:CIRCLE_TAG) { $env:CIRCLE_TAG -replace '^v', '' } else { '0.0.0-dev' }
cmake --install build --prefix stage
New-Item -ItemType Directory -Force -Path workspace\release | Out-Null
Compress-Archive -Path stage\* -DestinationPath "workspace\release\vn-$version-windows-x86_64.zip"
- store_artifacts:
path: workspace/release
- run:
name: Record artifact links
shell: powershell
command: |
New-Item -ItemType Directory -Force -Path workspace\artifacts | Out-Null
if ($env:CIRCLECI_API_TOKEN) {
Invoke-RestMethod -Headers @{ "Circle-Token" = $env:CIRCLECI_API_TOKEN } `
-Uri "https://circleci.com/api/v2/job/$env:CIRCLE_WORKFLOW_JOB_ID/artifacts" `
-OutFile "workspace\artifacts\$env:CIRCLE_JOB.json"
} else {
'{"items":[]}' | Out-File -FilePath "workspace\artifacts\$env:CIRCLE_JOB.json" -Encoding ascii
}
- persist_to_workspace:
root: .
paths:
- workspace/artifacts
- workspace/release
release-report:
executor: linux-x86_64
steps:
- install-linux-deps
- attach_workspace:
at: /tmp/workspace
- run:
name: Report release to Veinsforge
command: |
if [ -z "$VEINSFORGE_URL" ] || [ -z "$VEINSFORGE_CI_TOKEN" ]; then
echo "VEINSFORGE_URL and VEINSFORGE_CI_TOKEN are required to publish a release."
exit 1
fi
artifacts=$(jq -s '[.[] .items[] | {name: .path, url: .url}]' /tmp/workspace/workspace/artifacts/*.json)
body=$(jq -n \
--arg tag "$CIRCLE_TAG" \
--arg commit "$CIRCLE_SHA1" \
--arg build "$CIRCLE_BUILD_URL" \
--argjson artifacts "$artifacts" \
'{tag:$tag, commit:$commit, provider:"circleci", build_url:$build, artifacts:$artifacts}')
curl -fsS -X POST "${VEINSFORGE_URL%/}/api/v1/ci/release" \
-H "Authorization: Bearer $VEINSFORGE_CI_TOKEN" \
-H "Content-Type: application/json" \
-d "$body"
workflows:
build:
jobs:
- build-linux-x86_64
- build-linux-aarch64
- build-linux-x86_64-asan
- build-windows-x86_64
- release-report:
requires:
- build-linux-x86_64
- build-linux-aarch64
- build-linux-x86_64-asan
- build-windows-x86_64
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/