Use IPv6 in in integration tests #2879
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-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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/[email protected] | |
- 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-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update Rust toolchain | |
run: rustup update | |
- name: Rust Cache | |
uses: Swatinem/[email protected] | |
- name: Run unit tests | |
run: cargo test --all-features | |
integration-test: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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/[email protected] | |
- name: Install Pack CLI | |
uses: buildpacks/github-actions/[email protected] | |
- 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: Check libcnb-test has cleaned up test containers, volumes and images | |
run: | | |
if [[ -n "$(docker ps --all --quiet)" ]]; then | |
docker ps --all | |
echo "Unexpected Docker containers left behind!" | |
exit 1 | |
fi | |
if [[ -n "$(docker volume ls --quiet)" ]]; then | |
docker volume ls | |
echo "Unexpected Docker volumes left behind!" | |
exit 1 | |
fi | |
if [[ -n "$(docker images --all --quiet '*libcnb*')" ]]; then | |
docker images --all '*libcnb*' | |
echo "Unexpected Docker images left behind!" | |
exit 1 | |
fi | |
- 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. | |
run: pack build example-basics --force-color --builder cnbs/sample-builder:alpine --trust-builder --trust-extra-buildpacks --buildpack packaged/x86_64-unknown-linux-musl/debug/libcnb-examples_basics --path examples/ |