Skip to content

Commit 4859652

Browse files
Merge pull request #2 from theseus-rs/release-updates
Updates to support release
2 parents 36b7be2 + 68d4456 commit 4859652

File tree

14 files changed

+78
-743
lines changed

14 files changed

+78
-743
lines changed

.github/workflows/checks.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,3 @@ jobs:
108108
uses: Swatinem/rust-cache@v2
109109
- name: Check formatting
110110
run: cargo fmt --all --check
111-
112-
vet:
113-
runs-on: ubuntu-22.04
114-
steps:
115-
- name: Checkout repository
116-
uses: actions/checkout@v4
117-
- name: Install Rust
118-
uses: dtolnay/rust-toolchain@master
119-
with:
120-
toolchain: stable
121-
- name: Enable caching
122-
uses: Swatinem/rust-cache@v2
123-
- name: Install cargo vet
124-
run: cargo install cargo-vet
125-
- name: Vet thirdparty dependencies
126-
run: cargo vet check

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ categories = ["database"]
99
edition = "2021"
1010
keywords = ["postgresql", "ffi", "database"]
1111
license = "(Apache-2.0 OR MIT) AND PostgreSQL"
12-
repository = "https://github.com/theseus-rs/postgresql_embedded"
13-
version = "0.1.1"
12+
repository = "https://github.com/theseus-rs/postgresql-embedded"
13+
version = "0.1.2"
1414

1515
[workspace.dependencies]
1616
anyhow = { version = "1.0" }
@@ -39,8 +39,3 @@ tracing = { version = "0.1", features = ["log"] }
3939
shared-version = true
4040
dependent-version = "upgrade"
4141
tag-name = "v{{version}}"
42-
43-
# The profile that 'cargo dist' will build with
44-
[profile.dist]
45-
inherits = "release"
46-
lto = "thin"

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
<p align="center"><img width="256" height="256" src="images/logo.png"></p>
1+
<p align="center"><img width="250" height="250" src="images/logo.png"></p>
22

33
# PostgreSQL Embedded
44

55
[![ci](https://github.com/theseus-rs/postgresql-embedded/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/theseus-rs/postgresql-embedded/actions/workflows/ci.yml)
66
[![Latest version](https://img.shields.io/crates/v/postgresql_embedded.svg)](https://crates.io/crates/postgresql_embedded)
77
[![Documentation](https://docs.rs/postgresql_embedded/badge.svg)](https://docs.rs/postgresql_embedded)
8-
[![License](https://img.shields.io/crates/p/postgresql_embedded.svg)](https://github.com/theseus-rs/postgresql_embedded#license)
8+
[![License](https://img.shields.io/crates/l/postgresql_embedded)](https://github.com/theseus-rs/postgresql-embedded#license)
99
[![Semantic Versioning](https://img.shields.io/badge/%E2%9A%99%EF%B8%8F_SemVer-2.0.0-blue)](https://semver.org/spec/v2.0.0.html)
1010

11-
---
12-
1311
Install and run a PostgreSQL database locally on Linux, MacOS or Windows. PostgreSQL can be
1412
bundled with your application, or downloaded on demand.
1513

postgresql_archive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition.workspace = true
66
keywords.workspace = true
77
license.workspace = true
88
name = "postgresql_archive"
9-
repository.workspace = true
9+
repository = "https://github.com/theseus-rs/postgresql-embedded/tree/main/postgresql_archive"
1010
version.workspace = true
1111

1212
[dependencies]

postgresql_archive/README.md

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
# PostgreSQL Archive
22

33
[![ci](https://github.com/theseus-rs/postgresql-embedded/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/theseus-rs/postgresql-embedded/actions/workflows/ci.yml)
4-
[![Latest version](https://img.shields.io/crates/v/postgresql_embedded.svg)](https://crates.io/crates/postgresql_embedded)
5-
[![Documentation](https://docs.rs/postgresql_embedded/badge.svg)](https://docs.rs/postgresql_embedded)
6-
[![License](https://img.shields.io/crates/p/postgresql_embedded.svg)](https://github.com/theseus-rs/postgresql_embedded#license)
4+
[![Latest version](https://img.shields.io/crates/v/postgresql_archive.svg)](https://crates.io/crates/postgresql_embedded)
5+
[![Documentation](https://docs.rs/postgresql_archive/badge.svg)](https://docs.rs/postgresql_embedded)
6+
[![License](https://img.shields.io/crates/l/postgresql_archive?)](https://github.com/theseus-rs/postgresql-embedded/tree/main/postgresql_archive#license)
77
[![Semantic Versioning](https://img.shields.io/badge/%E2%9A%99%EF%B8%8F_SemVer-2.0.0-blue)](https://semver.org/spec/v2.0.0.html)
88

9-
---
10-
119
A library for downloading and extracting PostgreSQL archives from
1210
[theseus-rs/postgresql-binaries](https://github.com/theseus-rs/postgresql-binaries).
1311

1412
## Examples
1513

1614
### Asynchronous API
17-
**Note**: The following example requires the `tokio` runtime.
1815

1916
```rust
2017
use postgresql_archive::{extract, get_archive, LATEST};
@@ -23,7 +20,7 @@ use postgresql_archive::{extract, get_archive, LATEST};
2320
async fn main() {
2421
let (archive_version, archive, hash) = get_archive(&LATEST).await.unwrap();
2522
let out_dir = std::env::temp_dir();
26-
let result = extract(&archive, &out_dir).await;
23+
let result = extract(&archive, &out_dir).await.unwrap();
2724
}
2825
```
2926

@@ -35,7 +32,7 @@ use postgresql_archive::blocking::{extract, get_archive};
3532
fn main() {
3633
let (archive_version, archive, hash) = get_archive(&LATEST).unwrap();
3734
let out_dir = std::env::temp_dir();
38-
let result = extract(&archive, &out_dir);
35+
let result = extract(&archive, &out_dir).unwrap();
3936
}
4037
```
4138

@@ -46,41 +43,41 @@ uses.
4643

4744
The following features are available:
4845

49-
Name | Description | Default?
50-
---|---|---
51-
`blocking` | Enables the blocking API | No
46+
| Name | Description | Default? |
47+
|---|---|---|
48+
| `blocking` | Enables the blocking API | No |
5249

5350
## Supported platforms
5451

5552
`postgresql_archive` supports all platforms provided by [theseus-rs/postgresql-binaries](https://github.com/theseus-rs/postgresql-binaries).
5653

5754
Currently supported platforms are:
5855

59-
OS | [Target](https://doc.rust-lang.org/nightly/rustc/platform-support.html)
60-
---|---
61-
Linux | aarch64-unknown-linux-gnu
62-
Linux | aarch64-unknown-linux-musl
63-
Linux | arm-unknown-linux-gnueabi
64-
Linux | arm-unknown-linux-gnueabihf
65-
Linux | arm-unknown-linux-musleabi
66-
Linux | arm-unknown-linux-musleabihf
67-
Linux | armv5te-unknown-linux-gnueabi
68-
Linux | armv7-unknown-linux-gnueabihf
69-
Linux | armv7-unknown-linux-musleabihf
70-
Linux | i586-unknown-linux-gnu
71-
Linux | i586-unknown-linux-musl
72-
Linux | i686-unknown-linux-gnu
73-
Linux | i686-unknown-linux-musl
74-
Linux | mips64-unknown-linux-gnuabi64
75-
Linux | powerpc64le-unknown-linux-gnu
76-
Linux | powerpc64le-unknown-linux-musl
77-
Linux | s390x-unknown-linux-gnu
78-
Linux | s390x-unknown-linux-musl
79-
Linux | x86_64-unknown-linux-gnu
80-
Linux | x86_64-unknown-linux-musl
81-
MacOS | aarch64-apple-darwin
82-
MacOS | x86_64-apple-darwin
83-
Windows | x86_64-pc-windows-msvc
56+
| OS | [Target](https://doc.rust-lang.org/nightly/rustc/platform-support.html) |
57+
|---|---|
58+
| Linux | aarch64-unknown-linux-gnu |
59+
| Linux | aarch64-unknown-linux-musl |
60+
| Linux | arm-unknown-linux-gnueabi |
61+
| Linux | arm-unknown-linux-gnueabihf |
62+
| Linux | arm-unknown-linux-musleabi |
63+
| Linux | arm-unknown-linux-musleabihf |
64+
| Linux | armv5te-unknown-linux-gnueabi |
65+
| Linux | armv7-unknown-linux-gnueabihf |
66+
| Linux | armv7-unknown-linux-musleabihf |
67+
| Linux | i586-unknown-linux-gnu |
68+
| Linux | i586-unknown-linux-musl |
69+
| Linux | i686-unknown-linux-gnu |
70+
| Linux | i686-unknown-linux-musl |
71+
| Linux | mips64-unknown-linux-gnuabi64 |
72+
| Linux | powerpc64le-unknown-linux-gnu |
73+
| Linux | powerpc64le-unknown-linux-musl |
74+
| Linux | s390x-unknown-linux-gnu |
75+
| Linux | s390x-unknown-linux-musl |
76+
| Linux | x86_64-unknown-linux-gnu |
77+
| Linux | x86_64-unknown-linux-musl |
78+
| MacOS | aarch64-apple-darwin |
79+
| MacOS | x86_64-apple-darwin |
80+
| Windows | x86_64-pc-windows-msvc |
8481

8582
## Safety
8683

postgresql_archive/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
//! ## Examples
2121
//!
2222
//! ### Asynchronous API
23-
//! **Note**: The following example requires the `tokio` runtime.
2423
//!
2524
//! ```rust, ignore
2625
//! use postgresql_archive::{extract, get_archive, LATEST};
@@ -29,7 +28,7 @@
2928
//! async fn main() {
3029
//! let (archive_version, archive, hash) = get_archive(&LATEST).await.unwrap();
3130
//! let out_dir = std::env::temp_dir();
32-
//! let result = extract(&archive, &out_dir).await;
31+
//! let result = extract(&archive, &out_dir).await.unwrap();
3332
//! }
3433
//! ```
3534
//!
@@ -40,7 +39,7 @@
4039
//!
4140
//! let (archive_version, archive, hash) = get_archive(&LATEST).unwrap();
4241
//! let out_dir = std::env::temp_dir();
43-
//! let result = extract(&archive, &out_dir);
42+
//! let result = extract(&archive, &out_dir).unwrap();
4443
//! ```
4544
//!
4645
//! ## Feature flags

postgresql_embedded/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ edition.workspace = true
77
keywords.workspace = true
88
license.workspace = true
99
name = "postgresql_embedded"
10-
repository.workspace = true
10+
repository = "https://github.com/theseus-rs/postgresql-embedded/tree/main/postgresql_embedded"
1111
version.workspace = true
1212

1313
[build-dependencies]
1414
anyhow = { workspace = true }
1515
hex = { workspace = true }
16-
postgresql_archive = { path = "../postgresql_archive", version = "0.1.1" }
16+
postgresql_archive = { path = "../postgresql_archive", version = "0.1.2" }
1717
sha2 = { workspace = true }
1818
tokio = { workspace = true }
1919

@@ -23,7 +23,7 @@ bytes = { workspace = true }
2323
hex = { workspace = true }
2424
home = { workspace = true }
2525
lazy_static = { workspace = true }
26-
postgresql_archive = { path = "../postgresql_archive", version = "0.1.1" }
26+
postgresql_archive = { path = "../postgresql_archive", version = "0.1.2" }
2727
rand = { workspace = true }
2828
sha2 = { workspace = true }
2929
tempfile = { workspace = true }

postgresql_embedded/README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
[![ci](https://github.com/theseus-rs/postgresql-embedded/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/theseus-rs/postgresql-embedded/actions/workflows/ci.yml)
44
[![Latest version](https://img.shields.io/crates/v/postgresql_embedded.svg)](https://crates.io/crates/postgresql_embedded)
55
[![Documentation](https://docs.rs/postgresql_embedded/badge.svg)](https://docs.rs/postgresql_embedded)
6-
[![License](https://img.shields.io/crates/p/postgresql_embedded.svg)](https://github.com/theseus-rs/postgresql_embedded#license)
6+
[![License](https://img.shields.io/crates/l/postgresql_embedded)](https://github.com/theseus-rs/postgresql-embedded/tree/main/postgresql_embedded#license)
77
[![Semantic Versioning](https://img.shields.io/badge/%E2%9A%99%EF%B8%8F_SemVer-2.0.0-blue)](https://semver.org/spec/v2.0.0.html)
88

9-
---
10-
119
Install and run a PostgreSQL database locally on Linux, MacOS or Windows. PostgreSQL can be
1210
bundled with your application, or downloaded on demand.
1311

@@ -53,7 +51,17 @@ fn main() {
5351

5452
## Information
5553

56-
The downloaded postgresql binaries are cached in the following directories:
54+
During the build process, when the `bundled` feature is enabled, the PostgreSQL binaries are
55+
downloaded and included in the resulting binary. The version of the PostgreSQL binaries is
56+
determined by the `POSTGRESQL_VERSION` environment variable. If the `POSTGRESQL_VERSION`
57+
environment variable is not set, then `postgresql_archive::LATEST` will be used to determine the
58+
version of the PostgreSQL binaries to download.
59+
60+
When downloading the PostgreSQL binaries, either during build, or at runtime, the `GITHUB_TOKEN`
61+
environment variable can be set to a GitHub personal access token to increase the rate limit for
62+
downloading the PostgreSQL binaries. The `GITHUB_TOKEN` environment variable is not required.
63+
64+
At runtime, the PostgreSQL binaries are cached by default in the following directories:
5765

5866
- Unix: `$HOME/.theseus/postgresql`
5967
- Windows: `%USERPROFILE%\.theseus\postgresql`
@@ -65,15 +73,15 @@ uses.
6573

6674
The following features are available:
6775

68-
Name | Description | Default?
69-
---|---|---
70-
`bundled` | Bundles the PostgreSQL archive into the resulting binary | Yes
71-
`blocking` | Enables the blocking API; requires `tokio` | No
72-
`tokio` | Enables using tokio for async | No
76+
| Name | Description | Default? |
77+
|------------|---|---|
78+
| `bundled` | Bundles the PostgreSQL archive into the resulting binary | Yes |
79+
| `blocking` | Enables the blocking API; requires `tokio` | No |
80+
| `tokio` | Enables using tokio for async | No |
7381

7482
## Safety
7583

76-
These crates use `#![forbid(unsafe_code)]` to ensure everything is implemented in 100% safe Rust.
84+
This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in 100% safe Rust.
7785

7886
## License
7987

postgresql_embedded/src/command/traits.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,15 @@ impl CommandToString for tokio::process::Command {
7373
}
7474
}
7575

76+
/// Interface for executing a command
7677
pub trait CommandExecutor {
78+
/// Execute the command and return the stdout and stderr
7779
async fn execute(&mut self, timeout: Option<Duration>) -> Result<(String, String)>;
7880
}
7981

8082
/// Implement the [`CommandExecutor`] trait for [`Command`](std::process::Command)
8183
impl CommandExecutor for std::process::Command {
84+
/// Execute the command and return the stdout and stderr
8285
async fn execute(&mut self, _timeout: Option<Duration>) -> Result<(String, String)> {
8386
debug!("Executing command: {}", self.to_command_string());
8487
self.stdout(Stdio::piped());
@@ -108,6 +111,7 @@ impl CommandExecutor for std::process::Command {
108111
#[cfg(feature = "tokio")]
109112
/// Implement the [`CommandExecutor`] trait for [`Command`](tokio::process::Command)
110113
impl CommandExecutor for tokio::process::Command {
114+
/// Execute the command and return the stdout and stderr
111115
async fn execute(&mut self, timeout: Option<Duration>) -> Result<(String, String)> {
112116
debug!("Executing command: {}", self.to_command_string());
113117
self.stdout(Stdio::piped());

0 commit comments

Comments
 (0)