39 Commits

Author SHA1 Message Date
Mike Kruskal
f764f12dc8 Upgrade to protobuf-ci v5
PiperOrigin-RevId: 825653280
2025-10-29 12:14:52 -07:00
Adam Cozzette
4b04dda774 Drop support for building Rust with the old Bazel WORKSPACE setup
The workspace build is already in fairly bad shape, as it does not work with
Bazel 8 or with recent versions of `rules_rust`. I doubt that anyone is using
it, and I think we might as well remove it at this point.

PiperOrigin-RevId: 815894682
2025-10-06 14:54:14 -07:00
Adam Cozzette
850a56e0f5 Upgrade to Rust 1.90 for our Cargo tests and release process
This release stabilizes the workspace publishing feature, so we can now get
that without having to resort to a nightly release.

PiperOrigin-RevId: 811368336
2025-09-25 08:55:32 -07:00
Hong Shin
f4a2f8cb06 ci/oss: remove stale c++17 flags from ci
#test-continuous

PiperOrigin-RevId: 808555670
2025-09-18 06:46:25 -07:00
Adam Cozzette
db4ea2bdd9 Add Windows test run exercising the Cargo build
PiperOrigin-RevId: 793698154
2025-08-11 10:16:26 -07:00
Adam Cozzette
eac8c068dd Use Rust 1.79 for Bazel and nightly for Cargo
We need to use a recent nightly release to be able to use the `--workspace`
flag to `cargo publish`. Our minimum supported Rust version is 1.79,
so I think we should test that version with Bazel to make sure we stay
compatible. Our Bazel build is currently using 1.86 since that is the default
from rules_rust, but this change explicitly selects 1.79.

I also tried having Bazel use a more recent version, but unfortunately
rules_rust is broken for 1.87 and up, due to name mangling changes in rustc:
https://github.com/bazelbuild/rules_rust/issues/3459

As soon as Rust 1.90 is released, we can start using that with Cargo instead of
nightly.

PiperOrigin-RevId: 793660982
2025-08-11 08:39:28 -07:00
Adam Cozzette
25d7981143 Upgrade to Bazel 7.6.1
This is necessary for upgrading setuptools, because older Bazel versions apparently can't handle whitespace in file names: https://github.com/protocolbuffers/protobuf/pull/22094

PiperOrigin-RevId: 780210543
2025-07-07 12:22:23 -07:00
Adam Cozzette
b8427222b2 Upgrade minimum supported Rust version to 1.79.0
This should make it easier to fix #21590, since Rust 1.79 introduces
`std::path::absolute`.

PiperOrigin-RevId: 755529603
2025-05-06 14:43:35 -07:00
Deanna Garcia
98ef1d543f Test rust with bazel 8.
Add rust tests with bazel 8 and remove common build tags that don't work with bazel 8.

PiperOrigin-RevId: 743999146
2025-04-04 10:54:26 -07:00
Protobuf Team Bot
65a9ffe93b Enable bzlmod+workspace rust tests
PiperOrigin-RevId: 726933531
2025-02-14 08:16:57 -08:00
Sandy Zhang
aef40aaf83 Update protobuf repository to use the newest version (v4) of protobuf-ci
#test-continuous

PiperOrigin-RevId: 712618052
2025-01-06 12:33:01 -08:00
Deanna Garcia
afe2de2618 Move to bazel 7 and turn down support for bazel 6.
Migrate all tests to run on bazel 7 and fix errors that came up in the process. 30.x will no longer guarantee support for bazel 6.
#test-continuous

PiperOrigin-RevId: 703590770
2024-12-06 13:05:40 -08:00
Protobuf Team Bot
8ce4952624 Create /release_crates/ directory that contains one directory for each of our 3 crates that we package up.
PiperOrigin-RevId: 702439996
2024-12-03 13:00:05 -08:00
Adam Cozzette
9db4d1ca7a Add the experimental_use_cc_common_link flag for Rust
Upgrading to rules_rust 0.54.1 seems to have fixed some of our Rust linking
problems, but not all, so this change adds back in the
`--@rules_rust//rust/settings:experimental_use_cc_common_link=True` flag.

This fixes some local build errors like the following:
```
$ bazel build //rust/test/shared:bad_names_cpp_test

...

  = note: bazel-out/k8-fastbuild/bin/rust/test/shared/_ambiguous_libs/bad_names_cpp_test/libport-330124825.a(port.pic.o):port.cc:function google::protobuf::internal::CounterMap():(.text+0xe6): error: undefined reference to 'atexit'
```

PiperOrigin-RevId: 702380176
2024-12-03 10:12:36 -08:00
Adam Cozzette
873a695f50 Upgrade to rules_rust v0.54.1
This will have the side effect of upgrading the Rust version we test against to
1.82.0.

This should fix some build issues caused by Bazel trying to use two separate
linkers, one for for Rust and one for C++. The workaround for that was setting
`--@rules_rust//rust/settings:experimental_use_cc_common_link=True`, but this
upgrade makes that unnecessary.

PiperOrigin-RevId: 702349267
2024-12-03 08:37:46 -08:00
Protobuf Team Bot
2dde8f1cb5 Enable opt and asan Rust GHA tests, and split out the Cargo test to make those failures present more cleanly in GHA (the Cargo test was already using a different docker image than the other tests).
Have the spot for enabling a bzlmod test, currently commented out with a TODO because it would be broken at head.

PiperOrigin-RevId: 698842317
2024-11-21 11:01:41 -08:00
Protobuf Team Bot
826ce66117 Enable all //rust/... tests on GHA.
PiperOrigin-RevId: 694218823
2024-11-07 12:59:48 -08:00
Derek Benson
6bfff3909c Cross compiled protoc and protoc-gen-upb_minitable as part of the build process for creating the codegen crate.
Swap to tarballs instead of zips to preserve the +x flag on the executables

PiperOrigin-RevId: 681478567
2024-10-02 09:20:26 -07:00
Protobuf Team Bot
6ae5db635e Enable rust/test/cpp/interop/... tests on GHA
PiperOrigin-RevId: 681051606
2024-10-01 09:33:20 -07:00
Mike Kruskal
6d6571692a Use large runners for rust tests to avoid disk space flakes
PiperOrigin-RevId: 680695472
2024-09-30 13:27:40 -07:00
Protobuf Team Bot
3d39282d73 Fix a missing cfg=bzl flag that made all cpp kernel usage broken in OSS.
Enable //rust:all on the GHA CI, which would have caught this sooner.

PiperOrigin-RevId: 675990704
2024-09-18 07:56:26 -07:00
Derek Benson
c3e7e987fe Add a cargo test step to the rust gha
PiperOrigin-RevId: 673955655
2024-09-12 12:29:38 -07:00
Adam Cozzette
b7a7e71d6e Make UntypedMapIterator a trivial type
We need this type to be trivial and standard layout because we directly read
its contents in Rust. This change removes its user-defined constructors so that
it becomes a trivial type.

PiperOrigin-RevId: 670572557
2024-09-03 08:43:40 -07:00
Mike Kruskal
5695a882bd Move -Werror to our test/dev bazelrc files.
Putting it into BUILD files unintentionally forces it on all our downstream users.  Instead, we just want to enable this during testing and let them choose for themselves in their builds.

Note, that this expands the scope of -Werror to our entire repo for CI, so a bunch of fixes and opt-outs had to be applied to get this change passing.

Closed #14714

PiperOrigin-RevId: 666903224
2024-08-23 13:26:32 -07:00
Deanna Garcia
2f9cdd1d65 Update GHA tests to return single pass/fail signal at the end
Before this PR, we stored a list internally of tests that must pass on presubmit and tried to keep it up to date.

This PR moves that information keeping into GitHub by adding a 'continuous-only' variable to most testing matrices to allow authors to specify which of their tests should be skipped on presubmit. During presubmit, tests that were specified to not run on presubmit will not be run and their names will be prefixed with "[SKIPPED]". All continuous only tests will be suffixed with "(Continuous)".

At the end of running all the tests, we have a single "All Blocking Tests" signal that will tell us whether all of the necessary tests have passed (either for presubmit or continuous based on how the test was triggered).

I've tested this from a different branch [here](https://github.com/protocolbuffers/protobuf/actions/runs/9602443750?pr=17151) and from a different fork [here](https://github.com/protocolbuffers/protobuf/actions/runs/9602554500?pr=17192). These should be the same and are as far as I can tell.

I also have a continuous test run [here](https://github.com/protocolbuffers/protobuf/actions/runs/9603824200) which runs the entire test suite.

Closes #17198

PiperOrigin-RevId: 662940724
2024-08-14 09:10:14 -07:00
Bastien Jacot-Guillarmod
7b3682fcf2 Pin the rev of googletest to the GitHub main branch
PiperOrigin-RevId: 630417312
2024-05-03 09:54:29 -07:00
Mike Kruskal
b28d9d4144 Migrate bazel tests to protobuf-ci.
This will allow them to reuse our bazelrc and remote caching setup.  This also silences the non-bzlmod windows test that's hitting the windows path length.

PiperOrigin-RevId: 626390416
2024-04-19 10:00:00 -07:00
Mike Kruskal
89118ba9d4 Fix bazel cache issues in 7.0.0
We're seeing a high flake rate due to remote cache-misses only on Bazel 7 builds.  The key change here seems to be adding the remote_download_output flag, but this also upgrades us to 7.1.1 and adds some retry behavior to caching issues.

PiperOrigin-RevId: 625892332
2024-04-17 20:19:24 -07:00
Marcel Hlopko
648c20d602 Pass crate mapping from Bazel to protoc
This will enable us to get the correct crate names for Rust gencode. The actual
reading of the mapping file in protoc happens in the followup.

PiperOrigin-RevId: 597509582
2024-01-11 03:57:18 -08:00
Mike Kruskal
4ce04206fc Update our tests to use a custom checkout action.
This will retry up to 3 times if we hit networks flakes updating our submodules.  It will also allow us to easily inject other stability fixes to this step in the future.

PiperOrigin-RevId: 568306356
2023-09-25 13:18:39 -07:00
Adam Cozzette
f76f2a6429 Add missing newline to end of test_rust.yml
My editor reformatted this file to add a missing newline, and this ended up
breaking the test. The added newline caused there to be a newline in the middle
of the Bazel command. So this change adds the missing newline and fixes up the
Bazel command by using the `>-` syntax to treat this as a multiline string
without adding any newlines.

PiperOrigin-RevId: 558149295
2023-08-18 08:11:34 -07:00
Mike Kruskal
a80daa2a2c Drop support for Bazel 5.
This moves all our CI to Bazel 6 and drops the additional parameterization we had on Bazel version.

PiperOrigin-RevId: 551986376
2023-07-28 17:11:00 -07:00
Marcel Hlopko
ff750bb4c3 Put shared.rs and cpp.rs/upb.rs into the same crate.
The motivation is to make the setup simpler and more flexible.

PiperOrigin-RevId: 538189061
2023-06-06 08:25:55 -07:00
Marcel Hlopko
f92edc13c2 Automated rollback of commit fe7c4f9422.
PiperOrigin-RevId: 538128679
2023-06-06 03:21:20 -07:00
Joyce
010fde9a18 Set top level permissions to read only on GitHub Workflows (#12971)
Hi, here is Joyce from Google again.

I'd like starting suggesting the [Token-Permission check](https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions) fix.

Let me know if I might be missing any permission. Thanks!

### Security Reason

This is needed because, by default, github grants write-all permission to all workflows, which could be exploit by an attacker in case of a compromised workflow. Limiting permissions is a simple and effective way to also limit the impact of an eventual compromised workflow.

Thus, it is both a recommendation from [OpenSSF Scorecard](https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions) and the [Github](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions) to always use credentials that are minimally scoped.

Closes #12971

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/12971 from joycebrum:main 6d6dac5678
PiperOrigin-RevId: 537973051
2023-06-05 13:56:32 -07:00
Marcel Hlopko
fe7c4f9422 Simplify Protobuf Rust runtime build setup
PiperOrigin-RevId: 537300231
2023-06-02 07:04:18 -07:00
Marcel Hlopko
f7a2f4acea Add initial end-to-end test directory structure.
This turns out to be quite of a yak shave to be able to perfectly test both kernels without having to pass extra Blaze flags.

PiperOrigin-RevId: 521850709
2023-04-04 13:31:07 -07:00
Jakob Buchgraber
515175db66 Build & test Rust compiler on GHA
PiperOrigin-RevId: 520578368
2023-03-30 02:18:46 -07:00
Jakob Buchgraber
ef53613b42 Add GHA workflow for Rust
PiperOrigin-RevId: 518933228
2023-03-23 12:32:07 -07:00