Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions .github/workflows/build-blah2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,20 @@ jobs:
echo "Loaded images:"
docker images | grep ${{ inputs.tag }}

- name: Run blah2 unit tests
# The unit tests now run inside the build stage (see Dockerfile), which is
# the only image that contains them. A failing test fails the build job,
# so there is nothing left to run here.
#
# This step used to run them against the runtime image, which ships the
# binary alone, so it always printed "No unit tests directory found" and
# exited 0. It reported success without executing a single test.
- name: Confirm the runtime image carries no test binaries
run: |
echo "Running blah2 unit tests..."
docker run --rm blah2:${{ inputs.tag }} sh -c '
cd /opt/blah2/bin/test/unit 2>/dev/null || { echo "No unit tests directory found"; exit 0; }
TEST_COUNT=0
for test in *; do
if [ -x "$test" ] && [ -f "$test" ]; then
echo "Running: $test"
./"$test" || exit 1
TEST_COUNT=$((TEST_COUNT + 1))
fi
done
echo "Ran $TEST_COUNT unit tests"
'
if docker run --rm blah2:${{ inputs.tag }} sh -c 'test -d /opt/blah2/bin/test/unit'; then
echo "Unexpected: test binaries shipped in the runtime image"
exit 1
fi
echo "Runtime image is test-free, as intended. Tests ran during the build."

- name: Check image size
run: |
Expand Down
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:bookworm as blah2_env

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
LABEL maintainer="Jehan <jehan.azad@gmail.com>"
LABEL org.opencontainers.image.source https://github.com/30hours/blah2

Check warning on line 3 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "LABEL key=value" should be used instead of legacy "LABEL key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

Expand Down Expand Up @@ -87,10 +87,10 @@

&& cp ${ARCH}/libsdrplay_api.so.${MAJVER} /usr/local/lib/libsdrplay_api.so.${MAJVER} \
&& cp inc/* /usr/local/include \
&& chmod 644 /usr/local/lib/libsdrplay_api.so.${MAJVER}

Check warning on line 90 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Empty continuation lines will become errors in a future release

NoEmptyContinuation: Empty continuation line More info: https://docs.docker.com/go/dockerfile/rule/no-empty-continuation/


FROM blah2_env as blah2

Check warning on line 93 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
LABEL maintainer="Jehan <jehan.azad@gmail.com>"

WORKDIR /opt/blah2
Expand All @@ -114,6 +114,30 @@
&& cp -v /opt/blah2/bin/blah2 /blah2/bin/ \
&& chmod +x /blah2/bin/blah2

# Run the unit tests here, in the build stage, because this is the only image
# that has them: the runtime stage deliberately ships the binary alone. The
# workflow used to run them against the runtime image, where the directory does
# not exist, and swallowed that with `exit 0`, so no test had ever actually
# executed in CI.
#
# set -e means a failing test fails the build. The emptiness checks mean a
# missing or empty test directory fails the build too, rather than passing
# silently the way the old step did.
RUN set -eu; \
cd /opt/blah2/bin/test/unit; \
if [ -z "$(ls -A .)" ]; then echo "FAIL: no unit tests were built"; exit 1; fi; \
export BLAH2_FFT_CACHE=/tmp/blah2-fft-length.cache; \
count=0; \
for t in *; do \
if [ -f "$t" ] && [ -x "$t" ]; then \
echo "==== $t ===="; \
./"$t"; \
count=$((count+1)); \
fi; \
done; \
if [ "$count" -eq 0 ]; then echo "FAIL: no executable unit tests found"; exit 1; fi; \
echo "==== $count unit test binaries passed ===="

WORKDIR /blah2/bin

# =============================================================================
Expand All @@ -121,9 +145,9 @@
# Minimal image with only the binary and runtime libraries
# For full build environment: docker build --target blah2 -t blah2:dev .
# =============================================================================
FROM debian:bookworm-slim as runtime

Check warning on line 148 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
LABEL maintainer="Jehan <jehan.azad@gmail.com>"
LABEL org.opencontainers.image.source https://github.com/30hours/blah2

Check warning on line 150 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "LABEL key=value" should be used instead of legacy "LABEL key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

# Install only runtime dependencies (no dev packages, no compilers)
# Note: libfftw3-double3 removed - using NEON-optimized build from source
Expand Down
Loading