libcnb-test: Implement fmt::Display
for LogOutput
#2047
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
# Avoid duplicate builds on PRs. | |
branches: | |
- main | |
pull_request: | |
permissions: | |
contents: read | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Update Rust toolchain | |
# Most of the time this will be a no-op, since GitHub releases new images every week | |
# which include the latest stable release of Rust, Rustup, Clippy and rustfmt. | |
run: rustup update | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2.6.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. | |
run: cargo clippy --all-targets --all-features -- --deny warnings | |
- name: rustfmt | |
run: cargo fmt -- --check | |
- name: Check docs | |
# Using RUSTDOCFLAGS until `cargo doc --check` is stabilised: | |
# https://github.com/rust-lang/cargo/issues/10025 | |
run: RUSTDOCFLAGS="-D warnings" cargo doc --all-features --document-private-items --no-deps | |
unit-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Update Rust toolchain | |
run: rustup update | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2.6.0 | |
- name: Run unit tests | |
run: cargo test --all-features | |
integration-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install musl-tools | |
run: sudo apt-get install musl-tools --no-install-recommends | |
- name: Update Rust toolchain | |
run: rustup update | |
- name: Install Rust linux-musl target | |
run: rustup target add x86_64-unknown-linux-musl | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2.6.0 | |
- name: Install Pack CLI | |
uses: buildpacks/github-actions/setup-pack@v5.3.1 | |
- name: Run integration tests | |
# Runs only tests annotated with the `ignore` attribute (which in this repo, are the integration tests). | |
run: cargo test -- --ignored | |
- name: Compile and package examples/basics | |
run: cargo run --package libcnb-cargo -- libcnb package | |
working-directory: ./examples/basics | |
- name: Pack build using examples/basics | |
# Uses a non-libc image to validate the static musl cross-compilation. | |
# TODO: Switch this back to using the `alpine` tag once the stable Pack CLI release supports | |
# image extensions (currently newer sample alpine images fail to build with stable Pack). | |
run: pack build example-basics --builder cnbs/sample-builder@sha256:da5ff69191919f1ff30d5e28859affff8e39f23038137c7751e24a42e919c1ab --trust-builder --buildpack target/buildpack/x86_64-unknown-linux-musl/debug/libcnb-examples_basics --path examples/ |