-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathJustfile
More file actions
100 lines (78 loc) · 3.25 KB
/
Justfile
File metadata and controls
100 lines (78 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
PRIMARY_IMAGE := "quay.io/centos-bootc/centos-bootc:stream10"
# TODO: Readd quay.io/almalinuxorg/almalinux-bootc:9.6 here after debugging
# <https://github.com/bootc-dev/bcvk/issues/153>
ALL_BASE_IMAGES := "quay.io/fedora/fedora-bootc:42 quay.io/centos-bootc/centos-bootc:stream9 quay.io/centos-bootc/centos-bootc:stream10 quay.io/almalinuxorg/almalinux-bootc:10.0"
# Build the native binary
build:
make
# Static checks
validate:
make validate
# Run unit tests (excludes integration tests)
unit *ARGS:
#!/usr/bin/env bash
set -euo pipefail
if command -v cargo-nextest &> /dev/null; then
cargo nextest run {{ ARGS }}
else
cargo test {{ ARGS }}
fi
pull-test-images:
podman pull -q {{ALL_BASE_IMAGES}} >/dev/null
# Run integration tests (prefers cargo-nextest, falls back to cargo test with
# built-in fork-exec output capture)
test-integration *ARGS: build pull-test-images
#!/usr/bin/env bash
set -euo pipefail
export BCVK_PATH=$(pwd)/target/release/bcvk
export BCVK_PRIMARY_IMAGE={{ PRIMARY_IMAGE }}
# Note: BCVK_ALL_IMAGES is quoted to preserve the space-separated list
export BCVK_ALL_IMAGES="{{ ALL_BASE_IMAGES }}"
# Clean up any leftover containers before starting
cargo run --release --bin test-cleanup -p integration-tests 2>/dev/null || true
# Prefer nextest for better UX (retries, timing, etc.), but the harness
# captures output itself via fork-exec so cargo test works too.
if command -v cargo-nextest &> /dev/null; then
cargo nextest run --release -P integration -p integration-tests {{ ARGS }} && TEST_EXIT_CODE=0 || TEST_EXIT_CODE=$?
else
cargo test --release -p integration-tests -- {{ ARGS }} && TEST_EXIT_CODE=0 || TEST_EXIT_CODE=$?
fi
# Clean up containers after tests complete (must run even on failure)
cargo run --release --bin test-cleanup -p integration-tests 2>/dev/null || true
exit $TEST_EXIT_CODE
# Clean up integration test containers
test-cleanup:
cargo run --release --bin test-cleanup -p integration-tests
# Install cargo-nextest if not already installed
install-nextest:
@which cargo-nextest > /dev/null 2>&1 || cargo install cargo-nextest --locked
# Run this before committing
fmt:
cargo fmt
# Run the binary directly
run *ARGS:
cargo run --release -- {{ ARGS }}
# Create archive with binary, tarball, and checksums
archive: build
#!/usr/bin/env bash
set -euo pipefail
ARCH=$(arch)
BINARY_PATH="target/release/bcvk"
TARGET_NAME="bcvk-${ARCH}-unknown-linux-gnu"
ARTIFACTS_DIR="target"
# Strip the binary
strip "${BINARY_PATH}" || true
# Copy binary with target-specific name to artifacts directory
cp "${BINARY_PATH}" "${ARTIFACTS_DIR}/${TARGET_NAME}"
# Create tarball in artifacts directory
cd "${ARTIFACTS_DIR}"
tar -czf "${TARGET_NAME}.tar.gz" "${TARGET_NAME}"
# Generate checksums
sha256sum "${TARGET_NAME}.tar.gz" > "${TARGET_NAME}.tar.gz.sha256"
# Clean up the temporary binary copy
rm "${TARGET_NAME}"
echo "Archive created: ${ARTIFACTS_DIR}/${TARGET_NAME}.tar.gz"
echo "Checksum: ${ARTIFACTS_DIR}/${TARGET_NAME}.tar.gz.sha256"
# Install the binary to ~/.local/bin
install: build
cp target/release/bcvk ~/.local/bin/