From 68e25bf8848d380bafcb1251d6484d88edd28e52 Mon Sep 17 00:00:00 2001 From: jfrery Date: Thu, 19 Dec 2024 15:04:25 +0100 Subject: [PATCH] ci: custom docker build --- .github/workflows/concrete_ml_test.yml | 41 +++++++++++++++++++------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/.github/workflows/concrete_ml_test.yml b/.github/workflows/concrete_ml_test.yml index 550b30b9a..1faf29275 100644 --- a/.github/workflows/concrete_ml_test.yml +++ b/.github/workflows/concrete_ml_test.yml @@ -50,6 +50,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: submodules: recursive + - name: Set release version run: echo "__version__ = \"$(date +"%Y.%m.%d")\"" >| frontends/concrete-python/version.txt - name: Expose release version from Python @@ -73,17 +74,17 @@ jobs: run: | set -e rm -rf /build/* - + export PYTHON=${{ format('python{0}', matrix.python-version) }} echo "Using $PYTHON" cd /concrete/frontends/concrete-python make PYTHON=$PYTHON venv source .venv/bin/activate - + cd /concrete/compilers/concrete-compiler/compiler make BUILD_DIR=/build CCACHE=ON DATAFLOW_EXECUTION_ENABLED=ON Python3_EXECUTABLE=$(which python) python-bindings - + echo "Debug: ccache statistics (after the build):" ccache -s @@ -91,31 +92,50 @@ jobs: export COMPILER_BUILD_DIRECTORY="/build" make whl - + deactivate - name: ML Tests run: | + # Install git-lfs + sudo apt-get update && sudo apt-get install -y git-lfs + # Set wheel path and extract filename WHEEL_PATH="frontends/concrete-python/dist" WHEEL_FILENAME=$(ls ${WHEEL_PATH}/*manylinux*.whl | xargs basename) - - # Checkout the concrete-ml repository on branch main + + # Clone the concrete-ml repository and pull LFS files git clone --branch main https://github.com/zama-ai/concrete-ml.git + cd concrete-ml + git lfs pull + cd .. + + # Copy the generated wheel to the concrete-ml directory + mkdir -p concrete-ml/wheels + cp ${WHEEL_PATH}/${WHEEL_FILENAME} concrete-ml/wheels/ + + # Copy the test script + cp ci/scripts/test_cml.sh concrete-ml/ # Make test script executable - chmod +x ci/scripts/test_cml.sh + chmod +x concrete-ml/test_cml.sh + + # Set permissions for the concrete-ml directory + chmod -R 777 concrete-ml/ # Build the docker image with specific tag cd concrete-ml - make docker_build DEV_DOCKER_PYTHON=py38 + DOCKER_BUILDKIT=1 docker build \ + --pull \ + -t concrete-ml-dev:py38 \ + -f docker/Dockerfile.dev . # Run the tests docker run --rm \ -v "$(pwd):/src/" \ -w /src/concrete-ml \ concrete-ml-dev:py38 \ - /bin/bash -l -i -c "./ci/scripts/test_cml.sh --use-wheel \"/src/${WHEEL_PATH#$(pwd)/}/${WHEEL_FILENAME}\" --verbose" + /bin/bash -l -i -c "./test_cml.sh --use-wheel \"/src/wheels/${WHEEL_FILENAME}\" --verbose" - name: Slack Notification if: ${{ failure() && github.ref == 'refs/heads/main' }} @@ -146,5 +166,4 @@ jobs: uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 env: SLACK_COLOR: ${{ job.status }} - SLACK_MESSAGE: "Instance teardown finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})" - + SLACK_MESSAGE: "Instance teardown finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})" \ No newline at end of file