Skip to content

Commit

Permalink
Add a cargo test step to the rust gha
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 673955655
  • Loading branch information
dbenson24 authored and copybara-github committed Sep 12, 2024
1 parent 4c13f48 commit c3e7e98
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 11 additions & 4 deletions rust/cargo_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c3e7e98

Please sign in to comment.