Skip to content

fix(rustdocfx): formatting of summary fields (#3234) #7025

fix(rustdocfx): formatting of summary fields (#3234)

fix(rustdocfx): formatting of summary fields (#3234) #7025

Workflow file for this run

# Copyright 2024 Google LLC
#
# 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
#
# https://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.
name: Rust SDK
permissions: read-all
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
env:
GHA_RUST_VERSIONS: '{ "rust:msrv": "1.85", "rust:current": "1.89", "rust:nightly": "nightly" }'
GHA_GO_VERSIONS: '{ "go:current": "1.23.8" }'
jobs:
build:
strategy:
matrix:
os: ['macos-14', 'ubuntu-24.04', 'windows-2025']
rust-version: ['rust:current']
include:
- os: 'ubuntu-24.04'
rust-version: 'rust:msrv'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.rust-version }}-cargo-${{ hashFiles('Cargo.lock', '.github/workflows/sdk.yaml') }}
- name: Setup Rust ${{ matrix.rust-version }}
run: rustup toolchain install ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
- run: rustup default ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustup show active-toolchain -v
- name: Running tests for key crates
run: cargo clean && cargo test
- name: Build full workspace
# See Cargo.toml for the definition and motivation of this profile
run: cargo clean && cargo build --profile=ci --workspace
- name: Running tests for full workspace
# See Cargo.toml for the definition and motivation of this profile
run: cargo clean && cargo test --profile=ci --workspace
if: github.event_name == 'push'
features:
strategy:
matrix:
os: ['ubuntu-24.04']
rust-version: ['rust:current']
runs-on: ${{ matrix.os }}
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.rust-version }}-cargo-${{ hashFiles('Cargo.lock', '.github/workflows/sdk.yaml') }}
- name: Setup Rust ${{ matrix.rust-version }}
run: |
set -e
rustup toolchain install ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
rustup default ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
rustup component add clippy
- run: rustup default ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustup show active-toolchain -v
- name: Test crates with features disabled
run: |
set -e
cargo clean
echo "==== google-cloud-wkt ===="
for sub in test doc; do
cargo "${sub}" --package google-cloud-wkt --no-default-features
cargo "${sub}" --package google-cloud-wkt --no-default-features --features chrono
cargo "${sub}" --package google-cloud-wkt --no-default-features --features time
cargo "${sub}" --package google-cloud-wkt --no-default-features --features _internal-semver
cargo "${sub}" --package google-cloud-wkt --all-features
done
cargo clippy --no-deps --package google-cloud-wkt --all-targets -- --deny warnings
cargo clippy --no-deps --package google-cloud-wkt --all-features --all-targets --profile=test -- --deny warnings
cargo clean
echo "==== google-cloud-gax ===="
for sub in test doc; do
cargo "${sub}" --package google-cloud-gax --no-default-features
cargo "${sub}" --package google-cloud-gax --no-default-features --features unstable-stream
cargo "${sub}" --package google-cloud-gax --no-default-features --features _internal-semver
cargo "${sub}" --package google-cloud-gax --all-features
done
cargo clippy --no-deps --package google-cloud-gax --all-targets -- --deny warnings
cargo clippy --no-deps --package google-cloud-gax --all-features --all-targets --profile=test -- --deny warnings
cargo clean
echo "==== google-cloud-gax-internal ===="
for sub in test doc; do
cargo "${sub}" --package google-cloud-gax-internal --no-default-features
cargo "${sub}" --package google-cloud-gax-internal --no-default-features --features _internal-common
cargo "${sub}" --package google-cloud-gax-internal --no-default-features --features _internal-http-client
cargo "${sub}" --package google-cloud-gax-internal --no-default-features --features _internal-grpc-client
cargo "${sub}" --package google-cloud-gax-internal --all-features
done
cargo clippy --no-deps --package google-cloud-gax-internal --all-targets -- --deny warnings
cargo clippy --no-deps --package google-cloud-gax-internal --all-features --all-targets --profile=test -- --deny warnings
cargo clean
echo "==== google-cloud-lro ===="
for sub in test doc; do
cargo "${sub}" --profile=ci --package google-cloud-lro --no-default-features
cargo "${sub}" --profile=ci --package google-cloud-lro --no-default-features --features unstable-stream
cargo "${sub}" --profile=ci --package google-cloud-lro --no-default-features --features _internal-semver
cargo "${sub}" --profile=ci --package google-cloud-lro --all-features
done
cargo clippy --no-deps --package google-cloud-lro --all-targets -- --deny warnings
cargo clippy --no-deps --package google-cloud-lro --all-features --all-targets --profile=test -- --deny warnings
# We use google-cloud-aiplatform-v1 to test the generator w.r.t.
# per-client features. As usual, we assume the generator works for
# other generated libraries if it works for one.
cargo clean
echo "==== google-cloud-aiplatform-v1 ===="
cargo build -p google-cloud-aiplatform-v1 --no-default-features
mapfile -t features < <(sed -n -e '/^default = \[/,/^\]/ p' src/generated/cloud/aiplatform/v1/Cargo.toml | sed -n -e '/",/ s/ *"\(.*\)",/\1/p')
for feature in "${features[@]}"; do
echo "==== google-cloud-aiplatform-v1 + ${feature} ===="
cargo build --profile=ci -p google-cloud-aiplatform-v1 --no-default-features --features "${feature}"
done
cargo clean
echo "==== google-cloud-storage ===="
for sub in test doc; do
cargo "${sub}" --profile=ci --package google-cloud-storage --no-default-features
cargo "${sub}" --profile=ci --package google-cloud-storage --no-default-features --features unstable-stream
cargo "${sub}" --profile=ci --package google-cloud-storage --all-features
done
cargo clippy --no-deps --package google-cloud-storage --all-targets -- --deny warnings
cargo clippy --no-deps --package google-cloud-storage --all-features --all-targets --profile=test -- --deny warnings
coverage:
runs-on: ubuntu-24.04
strategy:
matrix:
rust-version: ['rust:current']
steps:
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.rust-version }}-cargo-${{ hashFiles('Cargo.lock', '.github/workflows/sdk.yaml') }}
- name: Setup Rust ${{ matrix.rust-version }}
run: |
set -e
rustup toolchain install ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
rustup default ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
cargo install cargo-tarpaulin --version 0.32.1 --locked
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustup show active-toolchain -v
- run: cargo tarpaulin --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
minimal-versions:
runs-on: ubuntu-24.04
strategy:
matrix:
rust-version: ['rust:current']
steps:
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.rust-version }}-cargo-${{ hashFiles('Cargo.lock', '.github/workflows/sdk.yaml') }}
- name: Setup Rust ${{ matrix.rust-version }}
run: |
set -e
rustup toolchain install ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
rustup default ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
cargo install cargo-minimal-versions [email protected] [email protected] --locked
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustup show active-toolchain -v
- run: |
set -e
cargo minimal-versions test --package integration-tests
cargo minimal-versions test --package user-guide-samples
cargo minimal-versions test --package storage-samples
cargo minimal-versions test --package google-cloud-storage
cargo minimal-versions test --package google-cloud-gax-internal
cargo minimal-versions test --package google-cloud-auth
cargo minimal-versions test --package google-cloud-gax
cargo minimal-versions test --package google-cloud-wkt
showcase:
runs-on: ubuntu-24.04
strategy:
matrix:
rust-version: ['rust:current']
go-version: ['go:current']
steps:
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.rust-version }}-cargo-${{ hashFiles('Cargo.lock', '.github/workflows/sdk.yaml') }}
- name: Setup Rust ${{ matrix.rust-version }}
run: |
set -e
rustup toolchain install ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
rustup default ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustup show active-toolchain -v
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ fromJson(env.GHA_GO_VERSIONS)[matrix.go-version] }}
- run: |
cargo test --features run-showcase-tests -p integration-tests
protojson-conformance:
runs-on: ubuntu-24.04
strategy:
matrix:
rust-version: ['rust:current']
steps:
- uses: actions/checkout@v5
with:
repository: 'protocolbuffers/protobuf'
ref: '31.x'
path: 'protobuf'
- uses: actions/checkout@v5
with:
path: 'main'
- uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.rust-version }}-cargo-${{ hashFiles('main/Cargo.lock', 'main/.github/workflows/sdk.yaml') }}
- name: Setup Rust ${{ matrix.rust-version }}
run: |
set -e
rustup toolchain install ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
rustup default ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustup show active-toolchain -v
- name: Build conformance testee
working-directory: main
run: |
cargo build -p protojson-conformance
- name: Run conformance test
working-directory: protobuf
env:
USE_BAZEL_VERSION: '8.2.1'
run: |
bazelisk run --enable_bzlmod -- \
//conformance:conformance_test_runner \
--failure_list ${GITHUB_WORKSPACE}/main/src/protojson-conformance/expected_failures.txt \
${GITHUB_WORKSPACE}/main/target/debug/protojson-conformance
docs:
runs-on: ubuntu-24.04
strategy:
matrix:
rust-version: ['rust:current', 'rust:nightly']
steps:
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.rust-version }}-cargo-${{ hashFiles('Cargo.lock', '.github/workflows/sdk.yaml') }}
- name: Setup Rust ${{ matrix.rust-version }}
run: |
set -e
rustup toolchain install ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
rustup default ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
cargo install mdbook
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustup show active-toolchain -v
- run: cargo doc --workspace
env:
RUSTDOCFLAGS: "-D warnings"
- run: cargo doc --package google-cloud-gax
env:
RUSTDOCFLAGS: "-D warnings"
- run: mdbook build guide
- run: mdbook test guide
- name: Upload user guide
if: ${{ matrix.rust-version == 'rust:current' }}
id: deployment
uses: actions/upload-pages-artifact@v4 # or specific "vX.X.X" version tag for this action
with:
path: guide/book/
deploy:
if: github.event_name == 'release'
runs-on: ubuntu-24.04
permissions:
# to deploy to Pages
pages: write
# to verify the deployment originates from an appropriate source
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: docs
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
lint:
runs-on: ubuntu-24.04
strategy:
matrix:
rust-version: ['rust:current']
steps:
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
~/.cargo
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.rust-version }}-cargo-${{ hashFiles('Cargo.lock', '.github/workflows/sdk.yaml') }}
- name: Setup Rust ${{ matrix.rust-version }}
run: |
set -e
rustup toolchain install ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
rustup default ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
rustup component add clippy rustfmt
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustup show active-toolchain -v
- run: cargo clippy --workspace --all-targets --profile=test -- --deny warnings
- run: cargo fmt
- run: git diff --exit-code
regenerate:
# Verifies the generated code has not been tampered with. Or maybe that the
# code requires no tampering.
runs-on: ubuntu-24.04
strategy:
matrix:
rust-version: ['rust:current']
go-version: ['go:current']
steps:
- uses: actions/cache@v4
with:
path: |
~/.cache/sidekick
key: ${{ github.job }}-${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- uses: actions/checkout@v5
- name: Setup Rust ${{ matrix.rust-version }}
run: |
set -e
rustup toolchain install ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
rustup default ${{ fromJson(env.GHA_RUST_VERSIONS)[matrix.rust-version] }}
rustup component add rustfmt
- name: Display Cargo version
run: cargo version
- name: Display rustc version
run: rustup show active-toolchain -v
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ fromJson(env.GHA_GO_VERSIONS)[matrix.go-version] }}
- name: Install protoc
run: |
set -e
curl -fSSL --retry 3 --retry-all-errors --retry-delay 15 -o /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip
cd /usr/local
sudo unzip -x /tmp/protoc.zip
protoc --version
- name: Regenerate all the code
run: go run github.com/googleapis/librarian/cmd/[email protected] refreshall -project-root .
- run: cargo fmt
# If there is any difference between the generated code and the
# committed code that is an error. All the inputs should be pinned,
# including the generator version and the googleapis SHA.
- run: git diff --exit-code