Skip to content

Commit 3f239f0

Browse files
committed
CI: add Rust SDK checks
Only FYI and don't prevent CI from being green. Fixes: #3497
1 parent 2b4c0fe commit 3f239f0

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

.github/workflows/analyze.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ jobs:
118118
needs: analyze
119119
uses: ./.github/workflows/repo-checks.yml
120120

121+
rust-sdk:
122+
needs: analyze
123+
if:
124+
needs.analyze.outputs.UI_ONLY_CHANGE == '0'
125+
uses: ./.github/workflows/rust-sdk-tests.yml
126+
121127
# This final step joins the results of the nested workflows and succeeds if
122128
# all the non-skipped workflows have suceeded. This job is used by the
123129
# "require CI to pass" GitHub ruleset.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Copyright (C) 2025 The Android Open Source Project
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# This workflow is triggered by analyze.yml
16+
name: Perfetto Rust SDK CI
17+
18+
on:
19+
workflow_call:
20+
21+
permissions:
22+
contents: read
23+
24+
env:
25+
# Nightly version that receives extra testing by SDK maintainers.
26+
NIGHTLY_VERSION: nightly-2025-01-03
27+
NIGHTLY_FEATURES: "--features=intrinsics"
28+
29+
jobs:
30+
build-test:
31+
name: Rust ${{ matrix.toolchain }} - ${{ matrix.name }}
32+
runs-on: self-hosted
33+
timeout-minutes: 20
34+
35+
strategy:
36+
matrix:
37+
include:
38+
- name: stable
39+
toolchain: stable
40+
features: ""
41+
- name: nightly
42+
toolchain: $NIGHTLY_VERSION
43+
features: $NIGHTLY_FEATURES
44+
steps:
45+
- name: Checkout source
46+
uses: actions/checkout@v4
47+
48+
- name: Install Rust (${{ matrix.name }})
49+
uses: dtolnay/[email protected]
50+
with:
51+
toolchain: ${{ matrix.toolchain }}
52+
components: clippy
53+
54+
- name: Show Rust version
55+
run: rustc --version && cargo --version
56+
57+
- name: Install build dependencies
58+
uses: ./.github/actions/install-build-deps
59+
with:
60+
install-flags: --no-dev-tools
61+
62+
- name: Generate amalgamated shared library sources
63+
shell: bash
64+
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
65+
66+
- name: Build (${{ matrix.name }})
67+
run: cargo build --manifest-path=contrib/rust-sdk/Cargo.toml --verbose ${{ matrix.features }}
68+
69+
- name: Run tests (${{ matrix.name }})
70+
run: cargo test --manifest-path=contrib/rust-sdk/Cargo.toml --verbose ${{ matrix.features }}
71+
72+
- name: Run clippy (${{ matrix.name }})
73+
run: cargo clippy --manifest-path=contrib/rust-sdk/Cargo.toml --all-targets --all-features -- -D warnings
74+
75+
fmt:
76+
name: Rust format (nightly)
77+
runs-on: self-hosted
78+
timeout-minutes: 10
79+
80+
steps:
81+
- name: Checkout source
82+
uses: actions/checkout@v4
83+
84+
- name: Install Rust (nightly)
85+
uses: dtolnay/[email protected]
86+
with:
87+
toolchain: $NIGHTLY_VERSION
88+
components: rustfmt
89+
90+
- name: Check format of source
91+
run: cargo fmt --manifest-path=contrib/rust-sdk/Cargo.toml -- --check

0 commit comments

Comments
 (0)