1
0
Fork 0
mirror of https://github.com/imjasonh/krust synced 2026-07-08 14:55:35 +00:00

Add e2e tests and CI integration for docker run workflow

- Add comprehensive e2e tests for build functionality
- Add integration job to CI that tests `docker run $(krust build)`
- Test KRUST_REPO environment variable usage
- Test --no-push flag and clean stdout for command substitution
- Add tests for verbose logging
- Remove outdated basic_test.rs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jason Hall 2025-06-07 21:03:33 -04:00
parent 2cf7ab1c17
commit 93bb4561fc
Failed to extract signature
3 changed files with 168 additions and 31 deletions

View file

@ -69,14 +69,53 @@ jobs:
- name: Run clippy
run: cargo clippy -- -D warnings
coverage:
name: Code coverage
integration:
name: Integration Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
- name: Generate code coverage
run: cargo tarpaulin --verbose --workspace
with:
targets: x86_64-unknown-linux-musl
- name: Install musl tools
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Build krust
run: cargo build --release
- name: Add krust to PATH
run: echo "${{ github.workspace }}/target/release" >> $GITHUB_PATH
- name: Test krust version
run: krust version
- name: Build and run example with krust
run: |
cd example/hello-krust
# Build and push to ttl.sh (ephemeral registry)
export KRUST_REPO=ttl.sh/${{ github.run_id }}
IMAGE_REF=$(krust build ./)
echo "Built image: $IMAGE_REF"
# Run the image
docker run --rm $IMAGE_REF
- name: Test docker run with command substitution
run: |
cd example/hello-krust
export KRUST_REPO=ttl.sh/${{ github.run_id }}-test2
docker run --rm $(krust build ./)
- name: Test build with --no-push
run: |
cd example/hello-krust
krust build --no-push --image local.test/hello:latest ./
# Takes too long to run on CI, so it's commented out for now.
# coverage:
# name: Code coverage
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Install Rust
# uses: dtolnay/rust-toolchain@stable
# - name: Install cargo-tarpaulin
# run: cargo install cargo-tarpaulin
# - name: Generate code coverage
# run: cargo tarpaulin --verbose --workspace