forked from open-telemetry/opentelemetry-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup minimal CI (open-telemetry#17)
* Setup basic ci * Add empty README * Fix script path * Fill out README. * Typo. * Add missing script name. * Remove unnecessary packages * Use fastbuild. * Fix typo. Co-authored-by: easy <[email protected]>
- Loading branch information
Showing
10 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: 2.1 | ||
|
||
jobs: | ||
cmake_test: | ||
resource_class: xlarge | ||
docker: | ||
- image: ubuntu:18.04 | ||
steps: | ||
- checkout | ||
- run: ./ci/setup_ci_environment.sh | ||
- run: ./ci/setup_cmake.sh | ||
- run: ./ci/do_ci.sh cmake.test | ||
- store_artifacts: | ||
path: /build/Testing/Temporary/LastTest.log | ||
destination: Test.log | ||
|
||
bazel_test: | ||
resource_class: xlarge | ||
docker: | ||
- image: ubuntu:18.04 | ||
steps: | ||
- checkout | ||
- run: ./ci/setup_ci_environment.sh | ||
- run: ./ci/install_bazelisk.sh | ||
- run: ./ci/do_ci.sh bazel.test | ||
|
||
|
||
workflows: | ||
version: 2 | ||
build_and_test: | ||
jobs: | ||
- cmake_test | ||
- bazel_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM ubuntu:18.04 | ||
|
||
WORKDIR /setup-ci | ||
|
||
ADD setup_ci_environment.sh /setup-ci | ||
ADD setup_cmake.sh /setup-ci | ||
ADD install_bazelisk.sh /setup-ci | ||
|
||
RUN /setup-ci/setup_ci_environment.sh \ | ||
&& /setup-ci/setup_cmake.sh \ | ||
&& /setup-ci/install_bazelisk.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Building and running tests as a developer | ||
CI tests can be run on docker by invoking the script `./ci/run_docker.sh ./ci/do_ci.sh <TARGET>` where the targets are | ||
* `cmake.test` build cmake targets and run tests | ||
* `bazel.test` build bazel targets and run tests | ||
Additionally, `./ci/run_docker.sh` can be invoked with no arguments to get a docker shell where tests | ||
can be run manually. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
[ -z "${SRC_DIR}" ] && export SRC_DIR="`pwd`" | ||
[ -z "${BUILD_DIR}" ] && export BUILD_DIR=/build | ||
mkdir -p "${BUILD_DIR}" | ||
|
||
BAZEL_OPTIONS="" | ||
BAZEL_TEST_OPTIONS="$BAZEL_OPTIONS --test_output=errors" | ||
|
||
if [[ "$1" == "cmake.test" ]]; then | ||
cd "${BUILD_DIR}" | ||
cmake -DCMAKE_BUILD_TYPE=Debug \ | ||
-DCMAKE_CXX_FLAGS="-Werror" \ | ||
"${SRC_DIR}" | ||
make | ||
make test | ||
exit 0 | ||
elif [[ "$1" == "bazel.test" ]]; then | ||
bazel build $BAZEL_OPTIONS -- //... | ||
bazel test $BAZEL_TEST_OPTIONS //... | ||
exit 0 | ||
else | ||
echo "Invalid do_ci.sh target, see ci/README.md for valid targets." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
BAZELISK_VERSION=v1.1.0 | ||
|
||
wget -O /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/$BAZELISK_VERSION/bazelisk-linux-amd64 | ||
chmod +x /usr/local/bin/bazel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
BUILD_IMAGE=opentelemetry-cpp-build | ||
docker image inspect "$BUILD_IMAGE" &> /dev/null || { | ||
docker build -t "$BUILD_IMAGE" ci | ||
} | ||
|
||
if [[ $# -ge 1 ]]; then | ||
docker run -v "$PWD":/src -w /src -it "$BUILD_IMAGE" "$@" | ||
else | ||
docker run -v "$PWD":/src -w /src --privileged -it "$BUILD_IMAGE" /bin/bash -l | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
apt-get update | ||
apt-get install --no-install-recommends --no-install-suggests -y \ | ||
build-essential \ | ||
ca-certificates \ | ||
wget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
apt-get install --no-install-recommends --no-install-suggests -y \ | ||
cmake \ | ||
libgtest-dev | ||
|
||
# Follows these instructions for setting up gtest | ||
# https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/ | ||
pushd /usr/src/gtest | ||
cmake CMakeLists.txt | ||
make | ||
cp *.a /usr/lib | ||
popd |