From 8dd81708e4778fa2554d06f9f2f356e43d6325dc Mon Sep 17 00:00:00 2001 From: light7734 Date: Fri, 19 Jul 2024 04:18:01 +0000 Subject: [PATCH] cicd: setup drone (#1) Co-authored-by: light7734 Reviewed-on: https://git.light7734.com/light7734/light/pulls/1 --- .drone.yml | 111 +++++++++++++++++++++++++ tools/conan/profiles/linux_clang_amd64 | 9 ++ tools/conan/profiles/linux_clang_arm64 | 9 ++ tools/conan/profiles/linux_gcc_amd64 | 8 ++ tools/conan/profiles/linux_gcc_arm64 | 8 ++ 5 files changed, 145 insertions(+) create mode 100644 .drone.yml create mode 100644 tools/conan/profiles/linux_clang_amd64 create mode 100644 tools/conan/profiles/linux_clang_arm64 create mode 100644 tools/conan/profiles/linux_gcc_amd64 create mode 100644 tools/conan/profiles/linux_gcc_arm64 diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..e588e71 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,111 @@ +kind: pipeline +type: docker +name: build_linux_clang_amd64 + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: ubuntu:latest + commands: + - sed -i 's#http://archive.ubuntu.com/ubuntu/#http://ir.archive.ubuntu.com/ubuntu/#g' /etc/apt/sources.list.d/ubuntu.sources + - head -n -8 /etc/apt/sources.list.d/ubuntu.sources > tmp && mv tmp /etc/apt/sources.list.d/ubuntu.sources + + - apt update + - apt-get install -y build-essential cmake clang gcc g++ python3 python3-pip python3.12-venv + + - python3 -m venv /opt/venv + - . /opt/venv/bin/activate + - pip --version + - python --version + + - pip install conan==2.5.0 + - conan --version + + - export CONAN_REVISIONS_ENABLED=1 + - export CC=$(which clang) + - 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 . --output-folder=build -r light --build=missing + + - cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=./build/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release + - cmake --build ./build/ + - ./build/modules/light/light + +--- +kind: pipeline +type: docker +name: build_linux_gcc_amd64 + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: ubuntu:latest + commands: + - sed -i 's#http://archive.ubuntu.com/ubuntu/#http://ir.archive.ubuntu.com/ubuntu/#g' /etc/apt/sources.list.d/ubuntu.sources + - head -n -8 /etc/apt/sources.list.d/ubuntu.sources > tmp && mv tmp /etc/apt/sources.list.d/ubuntu.sources + + - apt update + - apt-get install -y build-essential cmake clang gcc g++ python3 python3-pip python3.12-venv + + - python3 -m venv /opt/venv + - . /opt/venv/bin/activate + - pip --version + - python --version + + - pip install conan==2.5.0 + - conan --version + + - export CONAN_REVISIONS_ENABLED=1 + - export CC=$(which gcc) + - export CXX=$(which g++) + + - conan profile detect + - 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 . --output-folder=build -r light --build=missing + + - cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=./build/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release + - cmake --build ./build/ + - ./build/modules/light/light + +--- +kind: pipeline +type: docker +name: static_analysis + +platform: + os: linux + arch: amd64 + +steps: +- name: analysis + image: ubuntu:latest + commands: + - echo "[TODO] Implement static analysis" + +--- +kind: pipeline +type: docker +name: code_coverage + +platform: + os: linux + arch: amd64 + +steps: +- name: analysis + image: ubuntu:latest + commands: + - echo "[TODO] Implement code coverage" + diff --git a/tools/conan/profiles/linux_clang_amd64 b/tools/conan/profiles/linux_clang_amd64 new file mode 100644 index 0000000..63e93d9 --- /dev/null +++ b/tools/conan/profiles/linux_clang_amd64 @@ -0,0 +1,9 @@ +[settings] +arch=x86_64 +os=Linux +compiler=clang +compiler.version=17 +compiler.cppstd=gnu17 +compiler.libcxx=libstdc++11 +build_type=Release + diff --git a/tools/conan/profiles/linux_clang_arm64 b/tools/conan/profiles/linux_clang_arm64 new file mode 100644 index 0000000..c814f75 --- /dev/null +++ b/tools/conan/profiles/linux_clang_arm64 @@ -0,0 +1,9 @@ +[settings] +arch=armv8 +os=Linux +compiler=clang +compiler.version=17 +compiler.cppstd=gnu17 +compiler.libcxx=libstdc++11 +build_type=Release + diff --git a/tools/conan/profiles/linux_gcc_amd64 b/tools/conan/profiles/linux_gcc_amd64 new file mode 100644 index 0000000..34d4a2f --- /dev/null +++ b/tools/conan/profiles/linux_gcc_amd64 @@ -0,0 +1,8 @@ +[settings] +arch=x86_64 +os=Linux +compiler=gcc +compiler.version=14 +compiler.cppstd=gnu17 +compiler.libcxx=libstdc++11 +build_type=Release diff --git a/tools/conan/profiles/linux_gcc_arm64 b/tools/conan/profiles/linux_gcc_arm64 new file mode 100644 index 0000000..4f5b6c9 --- /dev/null +++ b/tools/conan/profiles/linux_gcc_arm64 @@ -0,0 +1,8 @@ +[settings] +arch=armv8 +os=Linux +compiler=gcc +compiler.version=14 +compiler.cppstd=gnu17 +compiler.libcxx=libstdc++11 +build_type=Release