| 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 } | |
| # TODO: b/379846319 - Fix the tests with bzlmod and enable this. | |
| # - { name: "bzlmod", 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:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75" | |
| - bazel_cmd: "test" | |
| # Override cases with custom images | |
| - config: { name: Cargo } | |
| image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:7.1.2-1.74.0-d9624f2aa83cba3eaf906f751d75b36aacb9aa82" | |
| bazel_cmd: "run" | |
| targets: "//rust/release_crates:cargo_test" | |
| name: Linux ${{ matrix.config.name }} | |
| runs-on: ubuntu-22-4core | |
| steps: | |
| - name: Checkout pending changes | |
| uses: protocolbuffers/protobuf-ci/checkout@v3 | |
| with: | |
| ref: ${{ inputs.safe-checkout }} | |
| - name: Run tests | |
| uses: protocolbuffers/protobuf-ci/bazel-docker@v3 | |
| with: | |
| image: ${{ matrix.image }} | |
| credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} | |
| bazel-cache: rust_linux | |
| bazel: >- | |
| ${{ matrix.bazel_cmd }} --crosstool_top=//toolchain:clang_suite --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --@rules_rust//rust/settings:experimental_use_cc_common_link=True | |
| ${{ matrix.targets }} ${{ matrix.config.flags }} | |