Skip to content
Snippets Groups Projects
Commit 465135a8 authored by Martin Heistermann's avatar Martin Heistermann
Browse files

init

parents
Branches
Tags v0.0.3
No related merge requests found
Pipeline #9099 failed
/build*/
stages:
- component
- test
- release
include:
# include the component located in the current project from the current SHA
- component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/bookworm@$CI_COMMIT_SHA
inputs:
stage: component
src_folder: 'demo'
tags:
- cgg
- linux
- docker-docker
job_name_prefix: "pref-"
ensure-job-added:
tags:
- cgg
- docker-docker
- linux
stage: test
image: badouralix/curl-jq
script:
- |
route="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs"
echo "$route"
count=`curl --silent "$route" | jq 'map(select(.name | contains("pref-debian-trixie-x64"))) | length'`
if [ "$count" != "1" ]; then
curl --silent "$route" | jq '.'
exit 1; else
echo "Component Job present"
fi
# yeah yeah, this is stupid: please make it better :)
count=`curl --silent "$route" | jq 'map(select(.name | contains("pref-debian-bookworm-x64"))) | length'`
if [ "$count" != "1" ]; then
curl --silent "$route" | jq '.'
exit 1; else
echo "Component Job present"
fi
# If the pipeline is for a new tag with a semantic version, and all previous jobs succeed,
# create the release.
create-release:
tags:
- cgg
- docker-docker
- linux
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
script: echo "Creating release $CI_COMMIT_TAG"
rules:
- if: $CI_COMMIT_TAG
release:
tag_name: $CI_COMMIT_TAG
description: "Release $CI_COMMIT_TAG of components repository $CI_PROJECT_PATH"
project(Test)
add_executable(test test.cc)
#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "Hello." << std::endl;
return 0;
}
spec:
inputs:
stage:
default: test
BUILD_TYPE:
default: Release
C_COMPILER:
default: "gcc"
CXX_COMPILER:
default: "g++"
tags:
description: "Tags to apply to the jobs (to select proper runner)"
default: []
type: array
cmake_options:
description: "Additional commandline options for cmake"
default: ""
src_folder:
description: "a repo subfolder that contains a CMakeLists.txt to build"
default: "."
job_name_prefix:
description: "The job's prefix (if any)"
default: ""
---
".$[[ inputs.job_name_prefix ]]debian":
stage: $[[ inputs.stage ]]
variables:
CMAKE_TOOLCHAIN_FILE: "C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake"
CMAKE_GENERATOR: "ninja"
CMAKE_C_COMPILER: "$[[ inputs.C_COMPILER ]]"
CMAKE_CXX_COMPILER: "$[[ inputs.CXX_COMPILER ]]"
BUILD_TYPE: "$[[ inputs.BUILD_TYPE ]]"
BUILD_DIR: "build-${CI_JOB_NAME}"
tags: $[[ inputs.tags ]]
before_script:
# -Force prevents an error if the directory already exists.
script:
artifacts:
when: always
reports:
junit: "${BUILD_DIR}/test-report-${BUILD_TYPE}.xml"
script:
- ccache -z
- >
cmake
-B "${Env:BUILD_DIR}"
-S "$[[ inputs.src_folder ]]"
-DCMAKE_BUILD_TYPE="${Env:BUILD_TYPE}"
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
$[[ inputs.cmake_options ]]
- ccache -s -v
- ctest --test-dir "${Env:BUILD_DIR}" --output-junit "${Env:BUILD_DIR}/test-report-${Env:BUILD_TYPE}.xml"
artifacts:
when: always
reports:
junit: "${BUILD_DIR}/test-report-${BUILD_TYPE}.xml"
"$[[ inputs.job_name_prefix ]]debian-bookworm-x64":
extends:
- ".$[[ inputs.job_name_prefix ]]debian"
image: gitlab.inf.unibe.ch:5001/cgg-public/containers/buildbox-debian-linux:x64-bookworm-latest
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment