cicd: applied DRY principle

This commit is contained in:
light7734 2024-10-14 12:09:44 +03:30
parent 276dd2217c
commit b72a089458
Signed by: light7734
GPG Key ID: 37FDF7099B2AB7A7
1 changed files with 89 additions and 95 deletions

View File

@ -1,103 +1,97 @@
kind: pipeline
type: docker
name: build_linux_clang_amd64
platform:
os: linux
arch: amd64
steps: steps:
- name: build - &install_dependencies&
name: install_dependencies
image: ubuntu:latest image: ubuntu:latest
commands: commands:
- apt update - apt update
- apt-get install -y build-essential cmake clang clang-tidy gcc g++ python3 python3-pip python3.12-venv - apt-get install -y build-essential cmake clang clang-tidy gcc g++ python3 python3-pip python3.12-venv
- &setup_conan
name: setup_conan
image: ubuntu:latest
environment:
CONAN_REVISIONS_ENABLED: "1"
commands:
- python3 -m venv /opt/venv - python3 -m venv /opt/venv
- . /opt/venv/bin/activate - . /opt/venv/bin/activate
- pip --version
- python --version
- pip install conan==2.5.0 - pip install conan==2.5.0
- conan --version
- export CONAN_REVISIONS_ENABLED=1 - &echo_info
- export CC=$(which clang) name: echo_info
- export CXX=$(which clang++)
- conan profile detect
- cp ./tools/conan/profiles/linux_clang_amd64 $(conan profile path default)
# - conan remote add light https://artifactory.light7734.com/artifactory/api/conan/conan
- conan install . --build=missing
- conan build .
- ./build/Release/modules/light/light
---
kind: pipeline
type: docker
name: build_linux_gcc_amd64
platform:
os: linux
arch: amd64
steps:
- name: build
image: ubuntu:latest image: ubuntu:latest
commands: commands:
- apt update
- apt-get install -y build-essential cmake clang clang-tidy gcc g++ python3 python3-pip python3.12-venv
- python3 -m venv /opt/venv
- . /opt/venv/bin/activate
- pip --version - pip --version
- python --version - python --version
- pip install conan==2.5.0
- conan --version - conan --version
- gcc --version
- g++ --version
- clang --version
- clang++ --version
- clang-tidy --version
- clang-format --version
- export CONAN_REVISIONS_ENABLED=1 - &build_gcc
name: build_gcc
image: ubuntu:latest
commands:
- rm -rv ./build
- export CC=$(which gcc) - export CC=$(which gcc)
- export CXX=$(which g++) - export CXX=$(which g++)
- conan profile detect - conan profile detect
- cp ./tools/conan/profiles/linux_gcc_amd64 $(conan profile path default) - cp ./tools/conan/profiles/linux_gcc_amd64 $(conan profile path default)
# - conan remote add light https://artifactory.light7734.com/artifactory/api/conan/conan
- conan install . --build=missing - conan install . --build=missing
- conan build . - conan build .
- ./build/Release/modules/light/light - ./build/Release/modules/light/light
--- - &build_clang
kind: pipeline name: build_clang
type: docker image: ubuntu:latest
name: static_analysis commands:
- rm -rv ./build
- export CC=$(which clang)
- export CXX=$(which clang++)
platform: - conan profile detect
os: linux - cp ./tools/conan/profiles/linux_clang_amd64 $(conan profile path default)
arch: amd64 - conan install . --build=missing
- conan build .
steps: - ./build/Release/modules/light/light
- name: analysis
- &static_analysis
name: static_analysis
image: ubuntu:latest image: ubuntu:latest
commands: commands:
- echo "[TODO] Implement static analysis" - echo "[TODO] Implement static analysis"
--- - &run_tests
name: run_tests
image: ubuntu:latest
commands:
- echp "[TODO] Implement tests"
- &report_coverage
name: report_coverage
image: ubuntu:latest
commands:
- echp "[TODO] Implement coverage report"
kind: pipeline kind: pipeline
type: docker type: docker
name: code_coverage name: linux_amd64
platform: platform:
os: linux os: linux
arch: amd64 arch: amd64
steps: steps:
- name: analysis - *install_dependencies
image: ubuntu:latest - *setup_conan
commands: - *echo_info
- echo "[TODO] Implement code coverage" - *static_analysis
- *build_gcc
- *build_clang
- *report_coverage
- *run_tests