Skip to content

Commit

Permalink
ci: custom docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrery committed Dec 20, 2024
1 parent e7e62d3 commit 68e25bf
Showing 1 changed file with 30 additions and 11 deletions.
41 changes: 30 additions & 11 deletions .github/workflows/concrete_ml_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -73,49 +74,68 @@ 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
cd /concrete/frontends/concrete-python
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' }}
Expand Down Expand Up @@ -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 }})"

0 comments on commit 68e25bf

Please sign in to comment.