blob: 504b15bca26fd11aa3204a690578289366b4f1bb [file] [log] [blame]
name: Rust Tests
on:
workflow_call:
inputs:
safe-checkout:
required: true
description: "The SHA key for the commit we want to run over"
type: string
permissions:
contents: read
jobs:
# This job should be run on presubmit, if any continuous-only tests are added we will need to input test-type above
linux:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
config:
- { name: "No bzlmod", flags: --noenable_bzlmod --enable_workspace }
- { name: "Bzlmod and Workspace", flags: --enable_bzlmod --enable_workspace }
- { name: Optimized, flags: --config=opt }
- { name: ASAN, flags: --config=asan }
include:
- targets: "//rust/... //src/google/protobuf/compiler/rust/..."
- image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:8.0.1-e78301df86b3e4c46ec9ac4d98be00e19305d8f3"
- bazel_cmd: "test"
# Override cases with custom images
- config: { name: Cargo }
# We currently need to be on nightly to have access to the
# multi-package publishing feature. This will be stabilized in
# 1.90, so we should switch to that as soon as it is released.
image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:8.0.1-nightly-2025-08-07-f0d1e209ed9369f69d93ce418990ecff3aa08d6f"
bazel_cmd: "run"
targets: "//rust/release_crates:cargo_test"
# rules_rust does not support workspace + bazel 8, so we test workspace + bazel 7
- name: "No bzlmod"
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.6.1-e0df73e51131ccaf53451355d22577f377357604"
name: Linux ${{ matrix.config.name }}
runs-on: ubuntu-22-4core
steps:
- name: Checkout pending changes
uses: protocolbuffers/protobuf-ci/checkout@v4
with:
ref: ${{ inputs.safe-checkout }}
- name: Run tests
uses: protocolbuffers/protobuf-ci/bazel-docker@v4
with:
image: ${{ matrix.image }}
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: rust_linux
bazel: >-
${{ matrix.bazel_cmd }} --crosstool_top=//toolchain:clang_suite --@rules_rust//rust/settings:experimental_use_cc_common_link=True
${{ matrix.targets }} ${{ matrix.config.flags }}
windows:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
name: Windows Cargo
runs-on: windows-2022
steps:
- name: Checkout pending changes
uses: protocolbuffers/protobuf-ci/checkout@v4
with:
ref: ${{ inputs.safe-checkout }}
- name: Install Rust
shell: bash
run: rustup default nightly-2025-08-07
- name: Run tests
uses: protocolbuffers/protobuf-ci/bazel@v4
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel: run //rust/release_crates:cargo_test
bazel-cache: windows-cargo
version: 8.0.1