Skip to content

Latest commit

 

History

History
130 lines (75 loc) · 4.73 KB

README.md

File metadata and controls

130 lines (75 loc) · 4.73 KB

Logo of the project

Pact-Rust Build Windows Build status

Pact-Rust

Pact implementation written in Rust.

This project provides a Pact implementation written in Rust. It supports the V3 Pact specification and V4 Pact specification and provides shared libraries that can be used in other languages via foreign function interfaces (FFI).

Note: The mock server crates have moved to https://github.com/pact-foundation/pact-core-mock-server.

Installing / Getting started

Rust Projects

The project crates are published to crates.io, and you can use them directly.

Consumer Projects

For a Rust consumer, refer to the pact_consumer crate.

You can find examples where the integration to the Pact Broker is tested using Pact tests written with the pact_consumer crate.

Verifying Providers

To verify a provider, you can use the verifier CLI tool. See Pact Verifier CLI.

FFI Interface

Other languages can use the core features through FFI shared libraries. These libraries expose functions that follow a C calling convention.

Consumer Projects

For example for a project using Conan and CMake that links to the pact-ffi crate, see Pact-C++.

Verifying Providers

TODO after merging FFI libs

Developing

There are 8 main crates to this implementation:

This is a library that provides the Pact models and functions for reading and writing pact files.

This is a library that provides the Pact functions for matching requests and responses.

This is a library that implements exported functions using C bindings for use in foreign languages.

Moved to https://github.com/pact-foundation/pact-core-mock-server.

Moved to https://github.com/pact-foundation/pact-core-mock-server.

This is a library that provides the Pact consumer test support and DSL for use in Rust projects.

This library provides support for verifying a provider against pact files.

Command line excutable that uses the pact_verifier to be able to verify a running provider against pact files.

Building

To build the libraries in this project, you need a working Rust environment. Refer to the Rust Guide. Requires Rust 1.71.0 or later.

The build tool used is cargo.

cd rust
cargo build

This will compile all the libraries and put the generated files in rust/target/debug.

Releasing

The released libraries for each module are built by a GH action that attaches the libraries to the GH release for each crate. To release a crate, run the release.groovy script in the crate directory. This will guide you through the release process for the crate. Then create a GH release using the tag and changelog created by the script.

Contributing

See CONTRIBUTING (PRs are always welcome!).

Documentation

Rust crate documentation is published to the Rust documentation site.

Additional documentation can be found at the main Pact website.

Contact

Join us in slack: slack

or

Licensing

The code in this project is licensed under a MIT license. See LICENSE.