Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MacOS C++ CI, add Linux C++20 CI #4120

Merged
merged 31 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cd43f89
separate C++ test workflow that only runs linux on push if no cpp fil…
Wumpf Nov 1, 2023
84d4f3c
try a json file based matrix
Wumpf Nov 1, 2023
fc83abf
fix?
Wumpf Nov 1, 2023
df27d14
...fix?
Wumpf Nov 1, 2023
8751af6
maybe this one?
Wumpf Nov 1, 2023
be0b479
paths are hard and stuff
Wumpf Nov 1, 2023
64f5d9e
fix group
Wumpf Nov 1, 2023
c4b7569
review comments and more fix attempts
Wumpf Nov 1, 2023
f2f66f6
fix old checkout task
Wumpf Nov 1, 2023
f6e0919
ref on checkout helping??
Wumpf Nov 1, 2023
a03cbff
fix loading test matrix..? Maybe..?
Wumpf Nov 1, 2023
f7d859e
I have no idea
Wumpf Nov 1, 2023
79e4acd
some debug output
Wumpf Nov 1, 2023
061dfde
moar
Wumpf Nov 1, 2023
9b03a30
going nuts
Wumpf Nov 1, 2023
3831ece
bool fix, more debug
Wumpf Nov 1, 2023
fd0fae6
fix jsons
Wumpf Nov 1, 2023
31cb7f1
dunno
Wumpf Nov 1, 2023
59d0809
looks like this worked for someone else?
Wumpf Nov 1, 2023
6da2034
more trying around with the FULL env var
Wumpf Nov 1, 2023
aa990f1
fix boolean handling?
Wumpf Nov 1, 2023
3e22eb3
stop using broken booleans
Wumpf Nov 1, 2023
96246d4
fix?
Wumpf Nov 1, 2023
3c6b236
script check fix
Wumpf Nov 1, 2023
22c1714
I don't know bash
Wumpf Nov 1, 2023
e683d2b
cpp change detection re-enabled
Wumpf Nov 1, 2023
0dce646
Make a not entirely pointless cmake change to trigger full C++ matrix
Wumpf Nov 1, 2023
e0cc1d5
make msvc build with RERUN_USE_ASAN set
Wumpf Nov 1, 2023
ae2646b
add C++20 test build
Wumpf Nov 1, 2023
4968668
cmake cleanup
Wumpf Nov 1, 2023
0f7f7eb
spelling
Wumpf Nov 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/cpp_matrix_full.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"include": [
{
"name": "Linux x64, C++17",
"runs_on": "ubuntu-latest-16-cores",
"cache_key": "build-linux",
"extra_env_vars": "RERUN_USE_ASAN=1 RERUN_SET_CXX_VERSION=17"
},
{
"name": "Linux x64, C++20",
"runs_on": "ubuntu-latest-16-cores",
"cache_key": "build-linux",
"extra_env_vars": "RERUN_USE_ASAN=1 RERUN_SET_CXX_VERSION=20"
},
{
"name": "Windows x64",
"runs_on": "windows-latest-8-cores",
"cache_key": "build-windows",
"extra_env_vars": ""
},
{
"name": "Mac aarch64",
"runs_on": "macos-latest-large",
"cache_key": "build-macos-arm",
"extra_env_vars": "RERUN_USE_ASAN=1"
}
]
}
10 changes: 10 additions & 0 deletions .github/workflows/cpp_matrix_partial.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"include": [
{
"name": "Linux x64",
"runs_on": "ubuntu-latest-16-cores",
"cache_key": "build-linux",
"extra_env_vars": ""
}
]
}
27 changes: 27 additions & 0 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,33 @@ jobs:
PR_NUMBER: ${{ github.event.pull_request.number }}
secrets: inherit

cpp-paths-filter:
runs-on: ubuntu-latest
outputs:
cpp_changes: ${{ steps.filter.outputs.cpp_changes }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
cpp_changes:
- '**/*.hpp'
- '**/.cpp'
- '**/CMakeLists.txt'

cpp-tests:
name: "C++ tests"
# Wait for the cpp-paths-filter to be completed before starting.
needs: cpp-paths-filter
uses: ./.github/workflows/reusable_checks_cpp.yml
with:
CONCURRENCY: pr-${{ github.event.pull_request.number }}
FULL: "${{ needs.cpp-paths-filter.outputs.cpp_changes }}"
secrets: inherit

min-test-wheel:
name: "Minimum Wheel"
if: github.event.pull_request.head.repo.owner.login == 'rerun-io'
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/on_push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ jobs:
CONCURRENCY: push-${{ github.ref_name }}
secrets: inherit

cpp_checks:
name: Checks
uses: ./.github/workflows/reusable_checks_cpp.yml
with:
CONCURRENCY: push-${{ github.ref_name }}
FULL: 'true'
secrets: inherit

# Check that a CLEAN container with just `cargo` on it can build rerun:
clean-build:
name: cargo build on clean container
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable_build_and_upload_rerun_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ permissions:
jobs:
set-config:
name: Set Config (${{ inputs.PLATFORM }})
runs-on: ubuntu-latest-16-cores
runs-on: ubuntu-latest
Wumpf marked this conversation as resolved.
Show resolved Hide resolved
outputs:
RUNNER: ${{ steps.set-config.outputs.runner }}
TARGET: ${{ steps.set-config.outputs.target }}
Expand Down
74 changes: 0 additions & 74 deletions .github/workflows/reusable_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -369,77 +369,3 @@ jobs:
clang-format-version: "16"
# Only check c/cpp/h/hpp (default checks also .proto and others)
include-regex: ^.*\.(c|cpp|h|hpp)$

cpp-tests-linux:
name: C++ tests Linux
runs-on: ubuntu-latest
container:
image: rerunio/ci_docker:0.10.0
env:
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}

- uses: prefix-dev/[email protected]
with:
pixi-version: v0.6.0
cache: true

- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: "build-linux"
# Cache will be produced by `reusable_checks/rs-lints`
save_cache: false
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}

# TODO(emilk): make this work somehow. Right now this just results in
# > Compiler: GNU 12.3.0 (/__w/rerun/rerun/.pixi/env/bin/x86_64-conda-linux-gnu-c++)
# 😭
# - name: Build and run C++ tests with clang++
# shell: bash
# run: |
# pixi run cpp-clean
# RERUN_WERROR=ON RERUN_USE_ASAN=ON CXX=clang++ pixi run cpp-build-all
# RERUN_WERROR=ON RERUN_USE_ASAN=ON CXX=clang++ pixi run cpp-test

- name: Build and run C++ tests with g++
shell: bash
run: |
pixi run cpp-clean
RERUN_WERROR=ON RERUN_USE_ASAN=ON CXX=g++ pixi run cpp-build-all
RERUN_WERROR=ON RERUN_USE_ASAN=ON CXX=g++ pixi run cpp-test

cpp-tests-windows:
name: C++ tests Windows
runs-on: windows-latest-8-cores
env:
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}

- uses: prefix-dev/[email protected]
with:
pixi-version: v0.6.0
cache: true

- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: "build-windows"
# Cache will be produced by `reusable_checks/rs-lints`
save_cache: false
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}

- name: Build and run C++ tests with MSVC
shell: bash
run: |
pixi run cpp-clean
RERUN_WERROR=ON pixi run cpp-build-all
RERUN_WERROR=ON pixi run cpp-test
92 changes: 92 additions & 0 deletions .github/workflows/reusable_checks_cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: "C++ Tests on all platforms & compilers"

on:
workflow_call:
inputs:
CONCURRENCY:
required: true
type: string
FULL:
# Booleans are almost unusable
# See https://medium.com/@sohail.ra5/github-actions-passing-boolean-input-variables-to-reusable-workflow-call-42d39bf7342e
type: string
required: true
default: 'true'

workflow_dispatch:
inputs:
CONCURRENCY:
required: false
type: string
default: "adhoc"
FULL:
description: "If false only linux is tested"
type: choice
options:
- 'true'
- 'false'

concurrency:
group: ${{ inputs.CONCURRENCY }}-checks_cpp
cancel-in-progress: true

env:
# See: https://github.com/marketplace/actions/sccache-action
SCCACHE_GHA_ENABLED: "false"

permissions:
contents: "read"
id-token: "write"

jobs:
matrix_prep:
runs-on: ubuntu-latest
outputs:
MATRIX: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}
- name: Load C++ test matrix
id: set-matrix
run: |
echo "Full matrix: ${{ inputs.FULL }}"
if ${{ inputs.FULL }}; then
echo "matrix=$(jq -c . < ./.github/workflows/cpp_matrix_full.json)" >> $GITHUB_OUTPUT
else
echo "matrix=$(jq -c . < ./.github/workflows/cpp_matrix_partial.json)" >> $GITHUB_OUTPUT
fi

cpp-tests:
name: C++ build & test - ${{ matrix.name }}
needs: matrix_prep
strategy:
matrix: ${{ fromJson(needs.matrix_prep.outputs.MATRIX) }}
runs-on: ${{ matrix.runs_on }}
env:
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || '' }}

- uses: prefix-dev/[email protected]
with:
pixi-version: v0.6.0
cache: true

- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache_key: ${{ matrix.cache_key }}
# Cache will be produced by `reusable_checks/rs-lints`
save_cache: false
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}

- name: Build and run C++ tests
shell: bash
run: |
pixi run cpp-clean
${{ matrix.extra_env_vars }} RERUN_WERROR=ON pixi run cpp-build-all
${{ matrix.extra_env_vars }} RERUN_WERROR=ON pixi run cpp-test
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.16...3.27)

project(rerun_cpp_proj LANGUAGES CXX)

# ------------------------------------------------------------------------------

# Environment driven hooks so we can configure CMake configure even if its buried deep inside a pixi task.
if(DEFINED ENV{RERUN_WERROR})
message(STATUS "Compiling with warnings as errors since RERUN_WERROR is set.")
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
Expand All @@ -12,6 +15,13 @@ if(DEFINED ENV{RERUN_USE_ASAN})
set(RERUN_USE_ASAN ON)
endif()

if(DEFINED ENV{RERUN_SET_CXX_VERSION})
message(STATUS "Overwriting CMAKE_CXX_STANDARD to $ENV{RERUN_SET_CXX_VERSION} since RERUN_SET_CXX_VERSION is set accordingly.")
set(CMAKE_CXX_STANDARD $ENV{RERUN_SET_CXX_VERSION})
endif()

# ------------------------------------------------------------------------------

function(set_default_warning_settings target)
if(MSVC)
# TODO(andreas): Try to enable /Wall
Expand All @@ -22,6 +32,10 @@ function(set_default_warning_settings target)
if(CMAKE_COMPILE_WARNING_AS_ERROR)
target_compile_options(${target} PRIVATE /WX)
endif()

if(RERUN_USE_ASAN)
message(WARNING "Rerun C++ build does not support address sanatizer ('asan') on Windows. Ignoring RERUN_USE_ASAN.")
endif()
else()
# Enabled warnings.
target_compile_options(${target} PRIVATE
Expand Down Expand Up @@ -129,14 +143,14 @@ FetchContent_Declare(LoguruGitRepo
GIT_REPOSITORY "https://github.com/emilk/loguru" # can be a filesystem path
GIT_TAG "master"
)
FetchContent_MakeAvailable(LoguruGitRepo) # defines target 'loguru::loguru'

# Set any loguru compile-time flags before calling MakeAvailable()
# Stacktraces are not yet supported on Windows.
if(NOT WIN32)
set(LOGURU_STACKTRACES 1)
endif()

FetchContent_MakeAvailable(LoguruGitRepo) # defines target 'loguru::loguru'

# ------------------------------------------------------------------------------
add_subdirectory(rerun_cpp) # The Rerun C++ SDK library
Expand Down
14 changes: 9 additions & 5 deletions rerun_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,15 @@ if(RERUN_DOWNLOAD_AND_BUILD_ARROW)
endif()
endif()

# Enable multithreaded compiling of Arrow on MSVC.

if(MSVC)
set(DARROW_CXXFLAGS "/MP")
# Enable multithreaded compiling of Arrow on MSVC.
set(ARROW_CXXFLAGS "/MP")
# ASAN doesn't work with arrow (yet?)
set(ARROW_ASAN OFF)
else()
set(DARROW_CXXFLAGS "")
set(ARROW_CXXFLAGS "")
set(ARROW_ASAN ${RERUN_USE_ASAN})
endif()

# Workaround for https://github.com/apache/arrow/issues/36117
Expand Down Expand Up @@ -191,11 +195,11 @@ if(RERUN_DOWNLOAD_AND_BUILD_ARROW)
-DARROW_BOOST_USE_SHARED=OFF
-DARROW_BUILD_SHARED=${ARROW_BUILD_SHARED}
-DARROW_BUILD_STATIC=${ARROW_BUILD_STATIC}
-DARROW_CXXFLAGS=${DARROW_CXXFLAGS}
-DARROW_CXXFLAGS=${ARROW_CXXFLAGS}
-DARROW_IPC=ON
-DARROW_JEMALLOC=OFF # We encountered some build issues with jemalloc, use mimalloc instead.
-DARROW_MIMALLOC=ON
-DARROW_USE_ASAN=${RERUN_USE_ASAN}
-DARROW_USE_ASAN=${ARROW_ASAN}
-DARROW_USE_TSAN=OFF
-DARROW_USE_UBSAN=OFF
-DBOOST_SOURCE=BUNDLED
Expand Down
Loading