Cloud to remote access #3281
Workflow file for this run
This file contains hidden or 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
| name: C/C++ | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["**"] | |
| pull_request: {} | |
| workflow_call: | |
| inputs: | |
| sdk-version: | |
| required: true | |
| type: string | |
| outputs: | |
| artifact_pattern: | |
| description: "pattern to match all uploaded artifact names" | |
| value: ${{ jobs.build.outputs.artifact_pattern }} | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: | | |
| sudo apt install -y --no-install-recommends clang-format-19 | |
| echo "/usr/lib/llvm-19/bin" >> $GITHUB_PATH | |
| - run: clang-format --version | |
| - run: make lint | |
| working-directory: cpp | |
| - run: make CLANG_TIDY=true build | |
| working-directory: cpp | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux | |
| - runner: ubuntu-22.04 | |
| target: aarch64-unknown-linux-gnu | |
| staticlib_name: libfoxglove.a | |
| cdylib_name: libfoxglove.so | |
| staticlib_artifact_name: libfoxglove-aarch64-unknown-linux-gnu.a | |
| cdylib_artifact_name: libfoxglove-aarch64-unknown-linux-gnu.so | |
| compiler: clang | |
| cross: true | |
| test_debug: false | |
| - runner: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| staticlib_name: libfoxglove.a | |
| cdylib_name: libfoxglove.so | |
| staticlib_artifact_name: libfoxglove-x86_64-unknown-linux-gnu.a | |
| cdylib_artifact_name: libfoxglove-x86_64-unknown-linux-gnu.so | |
| compiler: clang | |
| cross: false | |
| test_debug: true | |
| # Linux (extra build to test GCC support) | |
| - runner: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| staticlib_name: libfoxglove.a | |
| cdylib_name: libfoxglove.so | |
| staticlib_artifact_name: libfoxglove-x86_64-unknown-linux-gnu.a | |
| cdylib_artifact_name: libfoxglove-x86_64-unknown-linux-gnu.so | |
| cross: false | |
| compiler: gcc | |
| skip_upload: true | |
| test_debug: true | |
| # macOS | |
| - runner: macos-15 | |
| target: aarch64-apple-darwin | |
| staticlib_name: libfoxglove.a | |
| cdylib_name: libfoxglove.dylib | |
| staticlib_artifact_name: libfoxglove-aarch64-apple-darwin.a | |
| cdylib_artifact_name: libfoxglove-aarch64-apple-darwin.dylib | |
| cross: false | |
| test_debug: true | |
| - runner: macos-15 | |
| target: x86_64-apple-darwin | |
| staticlib_name: libfoxglove.a | |
| cdylib_name: libfoxglove.dylib | |
| staticlib_artifact_name: libfoxglove-x86_64-apple-darwin.a | |
| cdylib_artifact_name: libfoxglove-x86_64-apple-darwin.dylib | |
| cross: true | |
| test_debug: false | |
| # Windows | |
| - runner: windows-2025 | |
| target: x86_64-pc-windows-msvc | |
| staticlib_name: foxglove.lib | |
| cdylib_name: foxglove.dll | |
| staticlib_artifact_name: foxglove-x86_64-pc-windows-msvc.lib | |
| cdylib_artifact_name: foxglove-x86_64-pc-windows-msvc.dll | |
| cross: false | |
| test_debug: false | |
| - runner: windows-2025 | |
| target: aarch64-pc-windows-msvc | |
| staticlib_name: foxglove.lib | |
| cdylib_name: foxglove.dll | |
| staticlib_artifact_name: foxglove-aarch64-pc-windows-msvc.lib | |
| cdylib_artifact_name: foxglove-aarch64-pc-windows-msvc.dll | |
| cross: true | |
| test_debug: false | |
| # iOS | |
| - runner: macos-15 | |
| target: aarch64-apple-ios | |
| staticlib_name: libfoxglove.a | |
| cdylib_name: libfoxglove.dylib | |
| staticlib_artifact_name: libfoxglove-aarch64-apple-ios.a | |
| cdylib_artifact_name: libfoxglove-aarch64-apple-ios.dylib | |
| cross: true | |
| test_debug: false | |
| # iOS simulator | |
| - runner: macos-15 | |
| target: aarch64-apple-ios-sim | |
| staticlib_name: libfoxglove.a | |
| cdylib_name: libfoxglove.dylib | |
| staticlib_artifact_name: libfoxglove-aarch64-apple-ios-sim.a | |
| cdylib_artifact_name: libfoxglove-aarch64-apple-ios-sim.dylib | |
| cross: true | |
| test_debug: false | |
| - runner: macos-15 | |
| target: x86_64-apple-ios | |
| staticlib_name: libfoxglove.a | |
| cdylib_name: libfoxglove.dylib | |
| staticlib_artifact_name: libfoxglove-x86_64-apple-ios.a | |
| cdylib_artifact_name: libfoxglove-x86_64-apple-ios.dylib | |
| cross: true | |
| test_debug: false | |
| name: build (${{ matrix.target }}, ${{ matrix.compiler || 'default compiler' }}) | |
| runs-on: ${{ matrix.runner }} | |
| env: | |
| CARGO_BUILD_TARGET: ${{ matrix.target }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| - run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| - run: echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| - run: echo "IPHONEOS_DEPLOYMENT_TARGET=13.0.0" >> $GITHUB_ENV | |
| # Min version needed for libaws_lc_sys | |
| if: contains(matrix.target, 'apple-ios') | |
| - if: matrix.target == 'aarch64-apple-ios-sim' | |
| run: | | |
| # https://github.com/aws/aws-lc-rs/issues/761 | |
| unset CARGO_BUILD_TARGET | |
| cargo install bindgen-cli --version 0.72.0 | |
| echo "AWS_LC_SYS_EXTERNAL_BINDGEN=1" >> $GITHUB_ENV | |
| echo "~/.cargo/bin" >> $GITHUB_PATH | |
| - if: matrix.target == 'aarch64-apple-ios-sim' | |
| run: which bindgen | |
| - name: Build C library for ${{ matrix.target }} | |
| env: | |
| FOXGLOVE_SDK_LANGUAGE: c | |
| run: cargo build --release | |
| working-directory: c | |
| - name: Ensure generated files are up to date | |
| run: git diff --exit-code | |
| - name: Use Clang | |
| if: matrix.compiler == 'clang' | |
| run: | | |
| echo "CC=clang" >> $GITHUB_ENV | |
| echo "CXX=clang++" >> $GITHUB_ENV | |
| - name: Use GCC | |
| if: matrix.compiler == 'gcc' | |
| run: | | |
| echo "CC=gcc" >> $GITHUB_ENV | |
| echo "CXX=g++" >> $GITHUB_ENV | |
| - if: contains(matrix.target, 'windows') | |
| uses: ilammy/setup-nasm@v1 | |
| - name: Build C++ library and run tests | |
| if: ${{ !fromJson(matrix.cross) }} | |
| run: make test | |
| working-directory: cpp | |
| - name: Build & test (Debug mode) | |
| if: ${{ fromJson(matrix.test_debug) }} | |
| env: | |
| CMAKE_BUILD_TYPE: Debug | |
| run: make test | |
| working-directory: cpp | |
| - name: Organize artifacts for zip | |
| shell: bash | |
| run: | | |
| mkdir -p artifacts/foxglove/lib | |
| mkdir -p artifacts/foxglove/include | |
| mkdir -p artifacts/foxglove/src | |
| mv target/${{ matrix.target }}/release/${{ matrix.staticlib_name }} artifacts/foxglove/lib/ | |
| mv target/${{ matrix.target }}/release/${{ matrix.cdylib_name }} artifacts/foxglove/lib/ | |
| cp -R c/include/foxglove-c artifacts/foxglove/include/ | |
| cp -R cpp/foxglove/include/foxglove artifacts/foxglove/include/ | |
| cp -R cpp/foxglove/src/* artifacts/foxglove/src/ | |
| - name: Zip libraries for artifact | |
| if: runner.os != 'Windows' | |
| working-directory: artifacts | |
| run: | | |
| zip -r \ | |
| foxglove-${{inputs.sdk-version || github.sha}}-cpp-${{ matrix.target }}.zip \ | |
| foxglove/ | |
| - name: Zip libraries for artifact (Windows) | |
| if: runner.os == 'Windows' | |
| working-directory: artifacts | |
| run: | | |
| 7z a -tzip -sse ` | |
| foxglove-${{inputs.sdk-version || github.sha}}-cpp-${{ matrix.target }}.zip ` | |
| foxglove/ | |
| - name: Upload static & shared library to artifacts | |
| uses: actions/upload-artifact@v6 | |
| if: ${{ !(matrix.skip_upload || false) }} | |
| with: | |
| name: foxglove-${{inputs.sdk-version || github.sha}}-cpp-${{ matrix.target }}.zip | |
| path: artifacts/foxglove-${{inputs.sdk-version || github.sha}}-cpp-${{ matrix.target }}.zip | |
| if-no-files-found: error | |
| test-asan-ubsan: | |
| runs-on: ubuntu-latest | |
| env: | |
| CC: clang | |
| CXX: clang++ | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: nightly | |
| components: rust-src | |
| - run: make SANITIZE=address,undefined test | |
| working-directory: cpp |