Skip to content

Commit

Permalink
Split tests from the image build (pypa#1008)
Browse files Browse the repository at this point in the history
This allows not to invalidate docker cache when updating tests.
Also saves 5 layers in the image by copying all files needed by the finalize.sh script in 1 COPY.
  • Loading branch information
mayeut authored Feb 20, 2021
1 parent 100dae4 commit 2c345f8
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ docker buildx build \
--rm -t quay.io/pypa/${POLICY}_${PLATFORM}:${COMMIT_SHA} \
-f docker/Dockerfile docker/

docker run --rm -v $(pwd)/tests:/tests:ro quay.io/pypa/${POLICY}_${PLATFORM}:${COMMIT_SHA} /tests/run_tests.sh

if [ -d $(pwd)/.buildx-cache-${POLICY}_${PLATFORM} ]; then
rm -rf $(pwd)/.buildx-cache-${POLICY}_${PLATFORM}
fi
Expand Down
7 changes: 1 addition & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,7 @@ COPY --from=build_cmake /manylinux-rootfs /
COPY --from=build_swig /manylinux-rootfs /
COPY --from=build_cpython /manylinux-rootfs /
COPY --from=all_cpython /opt/_internal /opt/_internal/
COPY build_scripts/finalize.sh /build_scripts/finalize.sh
COPY build_scripts/python-tag-abi-tag.py /build_scripts/python-tag-abi-tag.py
COPY build_scripts/ssl-check.py /build_scripts/ssl-check.py
COPY build_scripts/manylinux-check.py /build_scripts/manylinux-check.py
COPY build_scripts/requirements.txt /build_scripts/requirements.txt
COPY build_scripts/requirements-tools.txt /build_scripts/requirements-tools.txt
COPY build_scripts/finalize.sh build_scripts/python-tag-abi-tag.py build_scripts/requirements.txt build_scripts/requirements-tools.txt /build_scripts/
RUN manylinux-entrypoint /build_scripts/finalize.sh && rm -rf /build_scripts

ENV SSL_CERT_FILE=/opt/_internal/certs.pem
Expand Down
10 changes: 0 additions & 10 deletions docker/build_scripts/finalize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,10 @@ export SSL_CERT_FILE=/opt/_internal/certs.pem
# Deactivate the tools virtual environment
deactivate


for PYTHON in /opt/python/*/bin/python; do
# Smoke test to make sure that our Pythons work, and do indeed detect as
# being manylinux compatible:
$PYTHON $MY_DIR/manylinux-check.py ${AUDITWHEEL_POLICY} ${AUDITWHEEL_ARCH}
# Make sure that SSL cert checking works
$PYTHON $MY_DIR/ssl-check.py
done

# We do not need the precompiled .pyc and .pyo files.
clean_pyc /opt/_internal

# remove cache
rm -rf /root/.cache

hardlink -cv /opt/_internal

File renamed without changes.
25 changes: 25 additions & 0 deletions tests/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Stop at any error, show all commands
set -exuo pipefail

# Get script directory
MY_DIR=$(dirname "${BASH_SOURCE[0]}")


for PYTHON in /opt/python/*/bin/python; do
# Smoke test to make sure that our Pythons work, and do indeed detect as
# being manylinux compatible:
$PYTHON $MY_DIR/manylinux-check.py ${AUDITWHEEL_POLICY} ${AUDITWHEEL_ARCH}
# Make sure that SSL cert checking works
$PYTHON $MY_DIR/ssl-check.py
done

# minimal tests for tools that should be present
autoconf --version
automake --version
libtoolize --version
patchelf --version
git --version
cmake --version
swig -version
File renamed without changes.

0 comments on commit 2c345f8

Please sign in to comment.