Add a cargo test step to the rust gha

PiperOrigin-RevId: 673955655
pull/18287/head
Derek Benson 5 months ago committed by Copybara-Service
parent 4c13f48847
commit c3e7e987fe
  1. 8
      .github/workflows/test_rust.yml
  2. 15
      rust/cargo_test.sh

@ -32,3 +32,11 @@ jobs:
//rust:protobuf_upb_test //rust:protobuf_cpp_test
//rust/test/rust_proto_library_unit_test:rust_upb_aspect_test
//src/google/protobuf/compiler/rust/...
- name: Run Cargo tests
uses: protocolbuffers/protobuf-ci/bazel-docker@v3
with:
image: "us-docker.pkg.dev/protobuf-build/containers/release/linux/rust:6.3.0-1.74.0-8858126dd9480abf91e6ce8d6e41a5cd3c03882c"
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: rust_linux
bazel: >-
run //rust:cargo_test

@ -28,10 +28,17 @@ fi
TMP_DIR=$(mktemp -d)
trap 'rm -rf -- "$TMP_DIR"' EXIT
CRATE=$(rlocation com_google_protobuf/rust/rust_crate.zip)
unzip -d $TMP_DIR $CRATE
cd $TMP_DIR
CARGO_HOME=$TMP_DIR/cargo_home
mkdir $CARGO_HOME
CRATE_ROOT=$TMP_DIR/protobuf
mkdir $CRATE_ROOT
CRATE_ZIP=$(rlocation com_google_protobuf/rust/rust_crate.zip)
unzip -d $CRATE_ROOT $CRATE_ZIP
cd $CRATE_ROOT
# Run all tests except doctests
cargo test --lib --bins --tests
CARGO_HOME=$CARGO_HOME cargo test --lib --bins --tests

Loading…
Cancel
Save