|
| 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 | + |
| 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 | + |
| 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