From d2bd9bae0400b83404e22e1d5fe7ecb6982bfaa8 Mon Sep 17 00:00:00 2001 From: Christophe Bedard Date: Wed, 26 Jun 2024 15:23:43 -0400 Subject: [PATCH] Remove old GitLab CI files (#31) Signed-off-by: Christophe Bedard --- .gitlab-ci.yml | 82 ---------------------------------- get_branch.py | 119 ------------------------------------------------- 2 files changed, 201 deletions(-) delete mode 100644 .gitlab-ci.yml delete mode 100644 get_branch.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 225c4fc..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,82 +0,0 @@ -variables: - DOCKER_DRIVER: overlay2 - PACKAGES_LIST: tracetools_analysis ros2trace_analysis - BASE_IMAGE_ID: registry.gitlab.com/ros-tracing/ci_base - DISTRO: rolling - ROS2TRACING_BRANCH: rolling - -stages: - - build - - test - - report - -.before_script_build: &before_script_build - before_script: - - . /root/ws/install/local_setup.sh - - python3 get_branch.py --check - - git clone https://gitlab.com/ros-tracing/ros2_tracing.git --branch $(python3 get_branch.py) -.build_artifacts: &build_artifacts - artifacts: - paths: - - install/ - - build/ -.test_artifacts: &test_artifacts - artifacts: - paths: - - build/*/test_results/*/*.xunit.xml - - build/*/pytest.xml - reports: - junit: - - build/*/test_results/*/*.xunit.xml - - build/*/pytest.xml - -build: - stage: build - image: $BASE_IMAGE_ID:$DISTRO - <<: *before_script_build - script: - - lttng --version && apt list lttng-tools liblttng-ust-dev python3-lttng python3-babeltrace - - colcon build --symlink-install --event-handlers console_cohesion+ --packages-up-to $PACKAGES_LIST - <<: *build_artifacts - -test: - stage: test - image: $BASE_IMAGE_ID:$DISTRO - needs: - - build - dependencies: - - build - <<: *before_script_build - script: - - colcon test --event-handlers console_cohesion+ --packages-select $PACKAGES_LIST - - colcon test-result --all --verbose - <<: *test_artifacts - -coverage: - stage: report - image: $BASE_IMAGE_ID:$DISTRO - needs: - - test - <<: *before_script_build - script: - - colcon build --symlink-install --event-handlers console_cohesion+ --packages-up-to $PACKAGES_LIST --mixin coverage-pytest --cmake-args -DBUILD_TESTING=ON --no-warn-unused-cli - - colcon test --event-handlers console_cohesion+ --packages-select $PACKAGES_LIST --mixin coverage-pytest - - colcon test-result --all --verbose - - colcon coveragepy-result --packages-select $PACKAGES_LIST --verbose --coverage-report-args -m - - pip3 install -U codecov - - codecov --file coveragepy/.coverage - allow_failure: true - -dco: - stage: report - image: $BASE_IMAGE_ID:$DISTRO-base - script: - - pip3 install -U dco-check - - dco-check --verbose - -trigger_gen_docs: - stage: report - only: - refs: - - rolling - trigger: ros-tracing/tracetools_analysis-api diff --git a/get_branch.py b/get_branch.py deleted file mode 100644 index 23fa181..0000000 --- a/get_branch.py +++ /dev/null @@ -1,119 +0,0 @@ -# Copyright 2020 Christophe Bedard -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Get ros2_tracing branch name from the last commit or a default value.""" - -import argparse -import os -import sys -from typing import List -from typing import Optional - - -ENV_DEFAULT_BRANCH = 'ROS2TRACING_BRANCH' -ENV_COMMIT_DESCRIPTION = 'CI_COMMIT_DESCRIPTION' -ROS2_TRACING_BRANCH_TRAILER_TOKEN = 'Ros2-tracing-branch' - - -def add_args(parser: argparse.ArgumentParser) -> None: - parser.add_argument( - '-c', '--check', - action='store_true', - default=False, - help='only process and print resulting branch in a verbose way', - ) - - -def parse_args() -> argparse.Namespace: - parser = argparse.ArgumentParser( - description='Extract name of the (optional) ros2_tracing branch to be used for CI', - ) - add_args(parser) - return parser.parse_args() - - -def get_trailer_value( - trailer_name: str, - commit_description: str, - check: bool = False, -) -> Optional[str]: - # Get trailer line - trailer_lines = [ - line for line in commit_description.split('\n') if trailer_name in line - ] - if len(trailer_lines) == 0: - if check: - print(f'could not find any trailer lines for: \'{trailer_name}\'') - return None - elif len(trailer_lines) > 1: - if check: - print( - f'found more than one trailer lines for: \'{trailer_name}\' ' - '(will use the first one)' - ) - - # Extract value - line = trailer_lines[0] - if not (trailer_name + ':') in line: - if check: - print(f'could not find: \'{trailer_name}:\'') - return None - key_value = line.split(':') - if len(key_value) != 2: - if check: - print(f'misformed trailer line: \'{key_value}\'') - return None - value = key_value[1].strip() - if len(value) == 0: - if check: - print(f'misformed trailer value: \'{value}\'') - return None - - return value - - -def main() -> int: - args = parse_args() - check = args.check - - # Get default value - default_branch = os.environ.get(ENV_DEFAULT_BRANCH, None) - if default_branch is None: - if check: - print(f'could not get environment variable: \'{ENV_DEFAULT_BRANCH}\'') - return 1 - - # Get commit description - commit_description = os.environ.get(ENV_COMMIT_DESCRIPTION, None) - if commit_description is None: - if check: - print(f'could not get environment variable: \'{ENV_COMMIT_DESCRIPTION}\'') - return None - - # Get value - branch = get_trailer_value( - ROS2_TRACING_BRANCH_TRAILER_TOKEN, - commit_description, - check, - ) - - # Print value - prefix = 'ros2_tracing branch: ' if check else '' - print(prefix + (branch or default_branch)) - - return 0 - - -if __name__ == '__main__': - sys.exit(main())