diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..0ddda0f986 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,172 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + cmake_test: + name: CMake test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup + run: | + sudo ./ci/setup_cmake.sh + sudo ./ci/setup_ci_environment.sh + - name: run tests + run: ./ci/do_ci.sh cmake.test + + plugin_test: + name: Plugin -> CMake + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup + run: | + sudo ./ci/setup_cmake.sh + sudo ./ci/setup_ci_environment.sh + - name: run tests + run: ./ci/do_ci.sh cmake.test_example_plugin + + gcc_48_test: + name: Legacy Bazel + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: setup + run: | + sudo ./ci/setup_ci_environment.sh + sudo ./ci/install_bazelisk.sh + sudo ./ci/install_gcc48.sh + - name: run tests + run: ./ci/do_ci.sh bazel.legacy.test + + bazel_test: + name: Bazel + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup + run: | + sudo ./ci/setup_cmake.sh + sudo ./ci/setup_ci_environment.sh + sudo ./ci/install_bazelisk.sh + - name: run tests + run: ./ci/do_ci.sh bazel.test + + bazel_noexcept: + name: Bazel noexcept + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup + run: | + sudo ./ci/setup_cmake.sh + sudo ./ci/setup_ci_environment.sh + sudo ./ci/install_bazelisk.sh + - name: run tests + run: ./ci/do_ci.sh bazel.noexcept + + bazel_asan: + name: Bazel asan config + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup + run: | + sudo ./ci/setup_cmake.sh + sudo ./ci/setup_ci_environment.sh + sudo ./ci/install_bazelisk.sh + - name: run tests + run: ./ci/do_ci.sh bazel.asan + + bazel_tsan: + name: Bazel tsan config + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup + run: | + sudo ./ci/setup_cmake.sh + sudo ./ci/setup_ci_environment.sh + sudo ./ci/install_bazelisk.sh + - name: run tests + run: ./ci/do_ci.sh bazel.tsan + + benchmark: + name: Benchmark + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup + run: | + sudo ./ci/setup_cmake.sh + sudo ./ci/setup_ci_environment.sh + sudo ./ci/install_bazelisk.sh + - name: run tests + run: | + env BENCHMARK_DIR=/benchmark + ./ci/do_ci.sh benchmark + - name: Upload benchmark results + uses: actions/upload-artifact@v2 + with: + name: benchmark_reports + path: /home/runner/benchmark + + format: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup + run: sudo ./ci/install_format_tools.sh + - name: run tests + run: ./ci/do_ci.sh format + + osx_test: + name: Bazel on MacOS + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: run tests + run: ./ci/do_ci.sh bazel.test + + windows: + name: CMake -> exporter proto + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + - name: setup + run: | + ./ci/setup_windows_cmake.ps1 + ./ci/setup_windows_ci_environment.ps1 + ./ci/install_windows_protobuf.ps1 + - name: run cmake test + run: ./ci/do_ci.ps1 cmake.test + - name: run otprotocol test + run: ./ci/do_ci.ps1 cmake.exporter.otprotocol.test + + windows_bazel: + name: Bazel Windows + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + - name: setup + run: ./ci/install_windows_bazelisk.ps1 + - name: run tests + run: ./ci/do_ci.ps1 bazel.build + + windows_plugin_test: + name: Plugin -> CMake Windows + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + - name: setup + run: | + ./ci/setup_windows_cmake.ps1 + ./ci/setup_windows_ci_environment.ps1 + - name: run tests + run: ./ci/do_ci.ps1 cmake.test_example_plugin diff --git a/ci/do_ci.ps1 b/ci/do_ci.ps1 index 1056225ea2..367d76e080 100644 --- a/ci/do_ci.ps1 +++ b/ci/do_ci.ps1 @@ -22,7 +22,7 @@ $VCPKG_DIR="$SRC_DIR\vcpkg" switch ($action) { "bazel.build" { - bazel build $BAZEL_OPTIONS -- //... -//api/test/... -//sdk/test/... + bazel build $BAZEL_OPTIONS -- //... //api/test/... //sdk/test/... $exit = $LASTEXITCODE if ($exit -ne 0) { exit $exit diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 6b3205843b..f80ca7d749 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -97,6 +97,8 @@ elif [[ "$1" == "benchmark" ]]; then exit 0 elif [[ "$1" == "format" ]]; then tools/format.sh + # normalize file endings according to .gitattributes + git add --renormalize . CHANGED="$(git ls-files --modified)" if [[ ! -z "$CHANGED" ]]; then echo "The following files have changes:" diff --git a/ci/setup_windows_ci_environment.ps1 b/ci/setup_windows_ci_environment.ps1 index a1b1b89d9c..a2134646ea 100755 --- a/ci/setup_windows_ci_environment.ps1 +++ b/ci/setup_windows_ci_environment.ps1 @@ -2,9 +2,10 @@ $ErrorActionPreference = "Stop" trap { $host.SetShouldExit(1) } git clone https://github.com/Microsoft/vcpkg.git -cd vcpkg +Push-Location -Path vcpkg $VCPKG_DIR=(Get-Item -Path ".\").FullName ./bootstrap-vcpkg.bat ./vcpkg integrate install ./vcpkg install benchmark:x64-windows ./vcpkg install gtest:x64-windows +Pop-Location