Skip to content

Workflow file for this run

name: prometheus instrumentation CI
on:
push:
branches: "*"
paths:
- "exporters/prometheus/**"
- ".github/workflows/prometheus.yml"
pull_request:
branches: [main]
paths:
- "exporters/prometheus/**"
- ".github/workflows/prometheus.yml"
jobs:
prometheus_bazel_linux:
name: Bazel on Linux
runs-on: ubuntu-latest
steps:
- name: checkout otel contrib prometheus
uses: actions/checkout@v3
with:
path: "otel_cpp_contrib"
- name: Mount Bazel Cache
uses: actions/cache@v3
env:
cache-name: bazel_cache
with:
path: /home/runner/.cache/bazel
key: bazel_test
- name: run tests
run: |
cd otel_cpp_contrib/exporters/prometheus
bazel --output_user_root=$HOME/.cache/bazel build --copt=-DENABLE_TEST --@io_opentelemetry_cpp//api:with_abseil //...
bazel --output_user_root=$HOME/.cache/bazel test --copt=-DENABLE_TEST --@io_opentelemetry_cpp//api:with_abseil //...
prometheus_bazel_osx:
name: Bazel on MacOS
runs-on: macos-latest
steps:
- name: checkout otel contrib prometheus
uses: actions/checkout@v3
with:
path: "otel_cpp_contrib"
- name: Mount Bazel Cache
uses: actions/cache@v3
env:
cache-name: bazel_cache
with:
path: /Users/runner/.cache/bazel
key: bazel_osx
- name: run tests
run: |
cd otel_cpp_contrib/exporters/prometheus
bazel --output_user_root=$HOME/.cache/bazel build --copt=-DENABLE_TEST --@io_opentelemetry_cpp//api:with_abseil //...
bazel --output_user_root=$HOME/.cache/bazel test --copt=-DENABLE_TEST --@io_opentelemetry_cpp//api:with_abseil //...
prometheus_cmake_window:
name: CMake on Windows
runs-on: windows-latest
steps:
- name: checkout otel contrib prometheus
uses: actions/checkout@v3
with:
path: "otel_cpp_contrib"
- name: checkout otel cpp
uses: actions/checkout@v3
with:
repository: "open-telemetry/opentelemetry-cpp"
ref: "v1.15.0"
path: "otel_cpp"
submodules: "recursive"
- name: run tests
shell: pwsh
run: |
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
vcpkg install "prometheus-cpp[pull,push]" nlohmann-json gtest benchmark --triplet=x64-windows-static-md
New-Item -Path "$ENV:GITHUB_WORKSPACE/otel_cpp/build_jobs_ci" -ItemType "directory" -Force
Set-Location "$ENV:GITHUB_WORKSPACE/otel_cpp/build_jobs_ci"
cmake .. -DWITH_PROMETHEUS=ON -DWITH_METRICS_PREVIEW=OFF -DCMAKE_BUILD_TYPE=Debug `
-DVCPKG_TARGET_TRIPLET=x64-windows-static-md `
"-DCMAKE_TOOLCHAIN_FILE=$ENV:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" `
"-DCMAKE_INSTALL_PREFIX=$HOME/prebuilt-otel" `
"-DBUILD_SHARED_LIBS=OFF" "-DBUILD_TESTING=OFF" "-DWITH_EXAMPLES=OFF" "-DWITH_FUNC_TESTS=OFF"
cmake --build . -j --config Debug || cmake --build . -j2 --config Debug || cmake --build . --config Debug
cmake --install . --prefix "$HOME/prebuilt-otel" --config Debug
New-Item -Path "$ENV:GITHUB_WORKSPACE/otel_cpp_contrib/exporters/prometheus/build_jobs_ci" -ItemType "directory" -Force
Set-Location "$ENV:GITHUB_WORKSPACE/otel_cpp_contrib/exporters/prometheus/build_jobs_ci"
cmake .. "-DCMAKE_PREFIX_PATH=$HOME/prebuilt-otel" -DCMAKE_BUILD_TYPE=Debug `
-DVCPKG_TARGET_TRIPLET=x64-windows-static-md `
"-DCMAKE_TOOLCHAIN_FILE=$ENV:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" `
"-DBUILD_SHARED_LIBS=OFF"
cmake --build . -j --config Debug || cmake --build . -j2 --config Debug || cmake --build . --config Debug
ctest -VV -C Debug -R "opentelemetry_cpp_ecosystem_test.*" .
prometheus_cmake_linux:
name: CMake on Linux
runs-on: ubuntu-latest
steps:
- name: checkout otel contrib prometheus
uses: actions/checkout@v3
with:
path: "otel_cpp_contrib"
- name: checkout otel cpp
uses: actions/checkout@v3
with:
repository: "open-telemetry/opentelemetry-cpp"
ref: "v1.15.0"
path: "otel_cpp"
submodules: "recursive"
- name: setup
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends --no-install-suggests build-essential\
ca-certificates wget git valgrind lcov
- name: run tests
run: |
vcpkg install 'prometheus-cpp[pull,push]' nlohmann-json gtest benchmark --triplet=x64-linux
mkdir -p "$GITHUB_WORKSPACE/otel_cpp/build_jobs_ci"
cd "$GITHUB_WORKSPACE/otel_cpp/build_jobs_ci"
cmake .. -DWITH_PROMETHEUS=ON -DWITH_METRICS_PREVIEW=OFF -DCMAKE_BUILD_TYPE=Debug \
-DVCPKG_TARGET_TRIPLET=x64-linux \
"-DCMAKE_INSTALL_PREFIX=$HOME/prebuilt-otel" \
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" \
"-DBUILD_TESTING=OFF" "-DWITH_EXAMPLES=OFF" "-DWITH_FUNC_TESTS=OFF"
cmake --build . -j --config Debug || cmake --build . -j2 --config Debug || cmake --build . --config Debug
cmake --install . --prefix "$HOME/prebuilt-otel" --config Debug
mkdir -p "$GITHUB_WORKSPACE/otel_cpp_contrib/exporters/prometheus/build_jobs_ci"
cd "$GITHUB_WORKSPACE/otel_cpp_contrib/exporters/prometheus/build_jobs_ci"
cmake .. "-DCMAKE_PREFIX_PATH=$HOME/prebuilt-otel" -DCMAKE_BUILD_TYPE=Debug \
-DVCPKG_TARGET_TRIPLET=x64-linux \
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
cmake --build . -j --config Debug || cmake --build . -j2 --config Debug || cmake --build . --config Debug
ctest -VV -R "opentelemetry_cpp_ecosystem_test.*" .