Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ jobs:
needs: analyze
uses: ./.github/workflows/repo-checks.yml

rust-sdk:
needs: analyze
if:
needs.analyze.outputs.UI_ONLY_CHANGE == '0' &&
needs.analyze.outputs.TRIVIAL_CHANGE == '0'
uses: ./.github/workflows/rust-sdk-tests.yml

# This final step joins the results of the nested workflows and succeeds if
# all the non-skipped workflows have suceeded. This job is used by the
# "require CI to pass" GitHub ruleset.
Expand All @@ -130,6 +137,7 @@ jobs:
- bazel
- fuzzer
- repo-checks
- rust-sdk
if: always()
runs-on: ubuntu-latest
steps:
Expand All @@ -144,9 +152,17 @@ jobs:
exit 1
fi
}
warn() {
job="$1"
result="$2"
if [ "$result" != "success" ] && [ "$result" != "skipped" ]; then
echo "::warning::$job failed with result: $result"
fi
}
check linux ${{ needs.linux.result }}
check android ${{ needs.android.result }}
check ui ${{ needs.ui.result }}
check bazel ${{ needs.bazel.result }}
check fuzzer ${{ needs.fuzzer.result }}
check repo-checks ${{ needs.repo-checks.result }}
warn rust-sdk ${{ needs.rust-sdk.result }}
55 changes: 55 additions & 0 deletions .github/workflows/rust-sdk-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright (C) 2025 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This workflow is triggered by analyze.yml
name: Perfetto Rust SDK CI

on:
workflow_call:

permissions:
pull-requests: read

env:
RUSTUP_HOME: "${{ github.workspace }}/buildtools/rustup"
CARGO_HOME: "${{ github.workspace }}/.cargo"

jobs:
rust-sdk:
runs-on: self-hosted
timeout-minutes: 20

steps:
- name: Checkout source
uses: actions/checkout@v4

- uses: ./.github/actions/install-build-deps
with:
install-flags: --rust-toolchain

- name: Generate amalgamated shared library sources
shell: bash
run: tools/gen_amalgamated --gn_args "is_debug=false is_clang=true use_custom_libcxx=false enable_perfetto_ipc=true perfetto_enable_git_rev_version_header=true is_perfetto_build_generator=true enable_perfetto_zlib=false" --output contrib/rust-sdk/perfetto-sys/libperfetto_c/perfetto_c //src/shared_lib:libperfetto_c

- name: Build
run: .cargo/bin/cargo build --manifest-path=contrib/rust-sdk/Cargo.toml --verbose --features=intrinsics

- name: Run tests
run: .cargo/bin/cargo test --manifest-path=contrib/rust-sdk/Cargo.toml --verbose --features=intrinsics

- name: Run clippy
run: .cargo/bin/cargo clippy --manifest-path=contrib/rust-sdk/Cargo.toml --all-targets --features=intrinsics -- -D warnings

- name: Check format
run: tools/format-rust-sources --check
2 changes: 1 addition & 1 deletion contrib/rust-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This workspace consists of three crates:
- **Protozero integration** — auto-generated Rust code from Perfetto `.proto` files via a protoc plugin.
- **Vendored or system builds** — link against a bundled `perfetto_c` library or use an external one.
- **FFI isolation** — `perfetto-sys` is the only crate exposing an API with `unsafe` code.
- **Cross-platform support** — Linux and macOS are tested.
- **Cross-platform support** — Linux support is tested using CI.

---

Expand Down
Loading