Skip to content

Commit

Permalink
Merge branch 'main' into feature/W-12731729_libcnb_package
Browse files Browse the repository at this point in the history
* main:
  Update fastrand requirement from 1.8.0 to 2.0.0 (#573)
  Fix lint failures with Rust 1.70 (#574)
  Bump Swatinem/rust-cache from 2.3.0 to 2.4.0 (#572)
  Bump Swatinem/rust-cache from 2.2.1 to 2.3.0 (#571)
  Bump buildpacks/github-actions from 5.1.0 to 5.2.0 (#569)
  Prepare 0.12.0 release (#568)
  Support Buildpack API `0.9` (#567)
  Add Clone for Scope (#566)
  Improve Env::get, add Env::get_string_lossy (#565)
  Bump buildpacks/github-actions from 5.0.1 to 5.1.0 (#564)
  • Loading branch information
colincasey committed Jun 12, 2023
2 parents b9a24c7 + 0bb114f commit a9d62ae
Show file tree
Hide file tree
Showing 24 changed files with 124 additions and 125 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# which include the latest stable release of Rust, Rustup, Clippy and rustfmt.
run: rustup update
- name: Rust Cache
uses: Swatinem/rust-cache@v2.2.1
uses: Swatinem/rust-cache@v2.4.0
- name: Clippy
# Using --all-targets so tests are checked and --deny to fail on warnings.
# Not using --locked here and below since Cargo.lock is in .gitignore.
Expand All @@ -44,7 +44,7 @@ jobs:
- name: Update Rust toolchain
run: rustup update
- name: Rust Cache
uses: Swatinem/rust-cache@v2.2.1
uses: Swatinem/rust-cache@v2.4.0
- name: Run unit tests
run: cargo test --all-features

Expand All @@ -60,9 +60,9 @@ jobs:
- name: Install Rust linux-musl target
run: rustup target add x86_64-unknown-linux-musl
- name: Rust Cache
uses: Swatinem/rust-cache@v2.2.1
uses: Swatinem/rust-cache@v2.4.0
- name: Install Pack CLI
uses: buildpacks/github-actions/setup-pack@v5.0.1
uses: buildpacks/github-actions/setup-pack@v5.2.0
- name: Run integration tests
# Runs only tests annotated with the `ignore` attribute (which in this repo, are the integration tests).
run: cargo test -- --ignored
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ separate changelogs for each crate were used. If you need to refer to these old
## [Unreleased]
- Changes to `libcnb package` command to support compiling buildpacks and meta-buildpacks from projects containing a single buildpack or multiple buildpacks in a monorepo. ([#575](https://github.com/heroku/libcnb.rs/pull/575))

## [0.12.0] 2023-04-28

Highlight of this release is the bump to [Buildpack API 0.9](https://github.com/buildpacks/spec/releases/tag/buildpack%2Fv0.9). This release contains breaking changes, please refer to the items below for migration advice.

### Changed

- libcnb.rs now targets [Buildpack API 0.9](https://github.com/buildpacks/spec/releases/tag/buildpack%2Fv0.9). Buildpacks need to upgrade the `api` key to `0.9` in their `buildpack.toml`. ([#567](https://github.com/heroku/libcnb.rs/pull/567))
- `Process` no longer supports the `direct` flag. All processes are now `direct`. Processes that need to use bash can use bash explicitly in the command. ([#567](https://github.com/heroku/libcnb.rs/pull/567))
- `Process::command` has been changed to a sequence of values where the first one is the executable and any additional values are arguments to the executable. The already existing `args` field behaves slightly different now as its contents can now be overridden by the user. See the [upstream CNB specification](https://github.com/buildpacks/spec/blob/buildpack/v0.9/buildpack.md#launchtoml-toml) for details. ([#567](https://github.com/heroku/libcnb.rs/pull/567))
- `Env::get` now returns `Option<&OsString>` instead of `Option<OsString>`. This is more in line with expectations users have when dealing with a collection type. This is a breaking change, compile errors can be fixed by adding a [`Option::cloned`](https://doc.rust-lang.org/std/option/enum.Option.html#method.cloned-1) call after `Env::get` to get the old behaviour. In some cases, cloning might not be necessary, slightly improving the code that uses `Env::get`. ([#565](https://github.com/heroku/libcnb.rs/pull/565))

### Added

- `Env::get_string_lossy` as a convenience method to work with environment variables directly. Getting a value out of an `Env` and treating its contents as unicode is a common case. Using this new method can simplify buildpack code. ([#565](https://github.com/heroku/libcnb.rs/pull/565))
- `Clone` implementation for `libcnb::layer_env::Scope`. ([#566](https://github.com/heroku/libcnb.rs/pull/566))

## [0.11.5] 2023-02-07

### Changed
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ members = [
]

[workspace.package]
version = "0.11.5"
version = "0.12.0"
rust-version = "1.64"
edition = "2021"
license = "BSD-3-Clause"

[workspace.dependencies]
libcnb = { version = "0.11.5", path = "libcnb" }
libcnb-data = { version = "0.11.5", path = "libcnb-data" }
libcnb-package = { version = "0.11.5", path = "libcnb-package" }
libcnb-proc-macros = { version = "0.11.5", path = "libcnb-proc-macros" }
libcnb-test = { version = "0.11.5", path = "libcnb-test" }
libcnb = { version = "0.12.0", path = "libcnb" }
libcnb-data = { version = "0.12.0", path = "libcnb-data" }
libcnb-package = { version = "0.12.0", path = "libcnb-package" }
libcnb-proc-macros = { version = "0.12.0", path = "libcnb-proc-macros" }
libcnb-test = { version = "0.12.0", path = "libcnb-test" }
toml = { version = "0.7.1" }
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
It is an opinionated implementation adding language constructs and convenience methods for working
with the spec. It values strong adherence to the spec and data formats.

It currently targets version `0.8` of the CNB spec.
It currently targets version `0.9` of the CNB spec.

## Quick Start Guide

Expand Down Expand Up @@ -79,7 +79,7 @@ Since we're writing a Cloud Native Buildpack, we also need a `buildpack.toml`. U
file named `buildpack.toml` in the root of your project, right next to `Cargo.toml`.

```toml
api = "0.8"
api = "0.9"

[buildpack]
id = "libcnb-examples/my-buildpack"
Expand Down Expand Up @@ -154,7 +154,7 @@ impl Buildpack for HelloWorldBuildpack {
BuildResultBuilder::new()
.launch(
LaunchBuilder::new().process(
ProcessBuilder::new(process_type!("web"), "echo")
ProcessBuilder::new(process_type!("web"), ["echo"])
.arg("Hello World!")
.default(true)
.build(),
Expand Down
2 changes: 1 addition & 1 deletion examples/basics/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.8"
api = "0.9"

[buildpack]
id = "libcnb-examples/basics"
Expand Down
2 changes: 1 addition & 1 deletion examples/execd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false

[dependencies]
libcnb.workspace = true
fastrand = "1.8.0"
fastrand = "2.0.0"

[dev-dependencies]
libcnb-test.workspace = true
2 changes: 1 addition & 1 deletion examples/execd/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.8"
api = "0.9"

[buildpack]
id = "libcnb-examples/execd"
Expand Down
2 changes: 1 addition & 1 deletion examples/ruby-sample/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.8"
api = "0.9"

[buildpack]
id = "libcnb-examples/ruby"
Expand Down
4 changes: 2 additions & 2 deletions examples/ruby-sample/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ impl Buildpack for RubyBuildpack {
.launch(
LaunchBuilder::new()
.process(
ProcessBuilder::new(process_type!("web"), "bundle")
ProcessBuilder::new(process_type!("web"), ["bundle"])
.args(vec!["exec", "ruby", "app.rb"])
.default(true)
.build(),
)
.process(
ProcessBuilder::new(process_type!("worker"), "bundle")
ProcessBuilder::new(process_type!("worker"), ["bundle"])
.args(vec!["exec", "ruby", "worker.rb"])
.build(),
)
Expand Down
28 changes: 14 additions & 14 deletions libcnb-data/src/buildpack/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub use version::*;
/// use libcnb_data::buildpack::BuildpackDescriptor;
///
/// let toml_str = r#"
/// api = "0.8"
/// api = "0.9"
///
/// [buildpack]
/// id = "foo/bar"
Expand Down Expand Up @@ -79,7 +79,7 @@ impl<BM> BuildpackDescriptor<BM> {
/// use libcnb_data::buildpack::{SingleBuildpackDescriptor, Stack};
///
/// let toml_str = r#"
/// api = "0.8"
/// api = "0.9"
///
/// [buildpack]
/// id = "foo/bar"
Expand Down Expand Up @@ -123,7 +123,7 @@ pub struct SingleBuildpackDescriptor<BM> {
/// use libcnb_data::buildpack::MetaBuildpackDescriptor;
///
/// let toml_str = r#"
/// api = "0.8"
/// api = "0.9"
///
/// [buildpack]
/// id = "foo/bar"
Expand Down Expand Up @@ -211,7 +211,7 @@ mod tests {
#[allow(clippy::too_many_lines)]
fn deserialize_singlebuildpack() {
let toml_str = r#"
api = "0.8"
api = "0.9"
[buildpack]
id = "foo/bar"
Expand Down Expand Up @@ -259,7 +259,7 @@ checksum = "abc123"

assert_eq!(
buildpack_descriptor.api,
BuildpackApi { major: 0, minor: 8 }
BuildpackApi { major: 0, minor: 9 }
);
assert_eq!(
buildpack_descriptor.buildpack.id,
Expand Down Expand Up @@ -339,7 +339,7 @@ checksum = "abc123"
#[test]
fn deserialize_metabuildpack() {
let toml_str = r#"
api = "0.8"
api = "0.9"
[buildpack]
id = "foo/bar"
Expand Down Expand Up @@ -380,7 +380,7 @@ checksum = "abc123"

assert_eq!(
buildpack_descriptor.api,
BuildpackApi { major: 0, minor: 8 }
BuildpackApi { major: 0, minor: 9 }
);
assert_eq!(
buildpack_descriptor.buildpack.id,
Expand Down Expand Up @@ -450,7 +450,7 @@ checksum = "abc123"
#[test]
fn deserialize_minimal_singlebuildpack() {
let toml_str = r#"
api = "0.8"
api = "0.9"
[buildpack]
id = "foo/bar"
Expand All @@ -465,7 +465,7 @@ id = "*"

assert_eq!(
buildpack_descriptor.api,
BuildpackApi { major: 0, minor: 8 }
BuildpackApi { major: 0, minor: 9 }
);
assert_eq!(
buildpack_descriptor.buildpack.id,
Expand All @@ -492,7 +492,7 @@ id = "*"
#[test]
fn deserialize_minimal_metabuildpack() {
let toml_str = r#"
api = "0.8"
api = "0.9"
[buildpack]
id = "foo/bar"
Expand All @@ -510,7 +510,7 @@ version = "0.0.1"

assert_eq!(
buildpack_descriptor.api,
BuildpackApi { major: 0, minor: 8 }
BuildpackApi { major: 0, minor: 9 }
);
assert_eq!(
buildpack_descriptor.buildpack.id,
Expand Down Expand Up @@ -545,7 +545,7 @@ version = "0.0.1"
#[test]
fn deserialize_buildpackdescriptor_single() {
let toml_str = r#"
api = "0.8"
api = "0.9"
[buildpack]
id = "foo/bar"
Expand All @@ -566,7 +566,7 @@ id = "*"
#[test]
fn deserialize_buildpackdescriptor_meta() {
let toml_str = r#"
api = "0.8"
api = "0.9"
[buildpack]
id = "foo/bar"
Expand All @@ -587,7 +587,7 @@ version = "0.0.1"
#[test]
fn reject_buildpack_with_both_stacks_and_order() {
let toml_str = r#"
api = "0.8"
api = "0.9"
[buildpack]
id = "foo/bar"
Expand Down
Loading

0 comments on commit a9d62ae

Please sign in to comment.