From 8a25e7dcc571642b94b20ca3bd2a0a2e210cbd3a Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 10:51:32 +0000 Subject: [PATCH 01/34] bump version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7314b941..fe844eef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ # along with this program. If not, see . cmake_minimum_required(VERSION 3.5) -project(mgconsole VERSION 1.4) +project(mgconsole VERSION 1.5) include(CTest) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) From 7989d639dbbf186a25b6443a463babfddb8264b8 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 10:51:44 +0000 Subject: [PATCH 02/34] move to distroless container --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2a3d1a9d..54107c9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM debian:bullseye-slim AS builder +FROM debian:trixie-slim AS builder ENV DEBIAN_FRONTEND=noninteractive @@ -21,7 +21,7 @@ RUN mkdir build && cd build && \ make && \ make install -FROM debian:bullseye-slim +FROM gcr.io/distroless/base-debian13 WORKDIR /mgconsole From a1dbf1f1b96aa7f96af8c014fe55425ba4888b59 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 10:53:17 +0000 Subject: [PATCH 03/34] use more recent OSes in CI --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a99fc911..9b795e5a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: build_and_test_ubuntu: strategy: matrix: - platform: [ubuntu-22.04] + platform: [ubuntu-24.04] mg_version: - "2.19.0" runs-on: ${{ matrix.platform }} @@ -59,7 +59,7 @@ jobs: path: build/Testing/Temporary/LastTest.log build_windows_mingw: - runs-on: windows-2022 + runs-on: windows-2025 strategy: matrix: include: [ @@ -96,7 +96,7 @@ jobs: build_apple: strategy: matrix: - platform: [macos-14] + platform: [macos-15] runs-on: ${{ matrix.platform }} steps: - name: Set-up repository From 7dcbf1207007bf3c92e776d9590b3ea56b43f011 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 11:53:28 +0000 Subject: [PATCH 04/34] allow building with ninja --- src/CMakeLists.txt | 33 +++++++++++++++++++-------------- src/utils/CMakeLists.txt | 31 +++++++++++++++++-------------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e56db60b..c45a642f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,32 +58,37 @@ endif() # Setup GFlags. The GIT_TAG refers to this build: # https://github.com/gflags/gflags/tree/70c01a642f08734b7bddc9687884844ca117e080, # which is the earliest to support modern cmake. +get_filename_component(GFLAGS_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gflags" ABSOLUTE) +get_filename_component(GFLAGS_LIB_PATH "${GFLAGS_PREFIX}/lib/libgflags.a" ABSOLUTE) +get_filename_component(GFLAGS_DEBUG_LIB_PATH "${GFLAGS_PREFIX}/lib/libgflags_debug.a" ABSOLUTE) ExternalProject_Add(gflags-proj - PREFIX gflags + PREFIX ${GFLAGS_PREFIX} GIT_REPOSITORY https://github.com/gflags/gflags.git GIT_TAG 70c01a6 CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=" "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" - INSTALL_DIR "${PROJECT_BINARY_DIR}/gflags") + INSTALL_DIR ${GFLAGS_PREFIX} + BUILD_BYPRODUCTS "${GFLAGS_LIB_PATH}" "${GFLAGS_DEBUG_LIB_PATH}") -ExternalProject_Get_Property(gflags-proj install_dir) -set(GFLAGS_ROOT ${install_dir}) +set(GFLAGS_ROOT ${GFLAGS_PREFIX}) set(GFLAGS_INCLUDE_DIRS ${GFLAGS_ROOT}/include) -set(GFLAGS_LIBRARY_PATH ${GFLAGS_ROOT}/lib/libgflags.a) -set(GFLAGS_DEBUG_LIBRARY_PATH ${GFLAGS_ROOT}/lib/libgflags_debug.a) +set(GFLAGS_LIBRARY_PATH ${GFLAGS_LIB_PATH}) +set(GFLAGS_DEBUG_LIBRARY_PATH ${GFLAGS_DEBUG_LIB_PATH}) set(GFLAGS_LIBRARY gflags) add_library(${GFLAGS_LIBRARY} STATIC IMPORTED) target_compile_definitions(${GFLAGS_LIBRARY} INTERFACE GFLAGS_IS_A_DLL=0) set_target_properties(${GFLAGS_LIBRARY} PROPERTIES - IMPORTED_LOCATION ${GFLAGS_LIBRARY_PATH} - IMPORTED_LOCATION_DEBUG ${GFLAGS_DEBUG_LIBRARY_PATH} + IMPORTED_LOCATION "${GFLAGS_LIBRARY_PATH}" + IMPORTED_LOCATION_DEBUG "${GFLAGS_DEBUG_LIBRARY_PATH}" INTERFACE_LINK_LIBRARIES Threads::Threads) add_dependencies(${GFLAGS_LIBRARY} gflags-proj) +get_filename_component(MGCLIENT_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/mgclient" ABSOLUTE) +get_filename_component(MGCLIENT_LIB_PATH "${MGCLIENT_PREFIX}/${MG_INSTALL_LIB_DIR}/libmgclient.a" ABSOLUTE) ExternalProject_Add(mgclient-proj - PREFIX mgclient + PREFIX ${MGCLIENT_PREFIX} GIT_REPOSITORY https://github.com/memgraph/mgclient.git GIT_TAG v1.5.0 CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=" @@ -91,17 +96,17 @@ ExternalProject_Add(mgclient-proj "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" ${MACOSX_OPENSSL_ROOTDIR_FLAG} - INSTALL_DIR "${PROJECT_BINARY_DIR}/mgclient") + INSTALL_DIR ${MGCLIENT_PREFIX} + BUILD_BYPRODUCTS "${MGCLIENT_LIB_PATH}") -ExternalProject_Get_Property(mgclient-proj install_dir) -set(MGCLIENT_ROOT ${install_dir}) +set(MGCLIENT_ROOT ${MGCLIENT_PREFIX}) set(MGCLIENT_INCLUDE_DIRS ${MGCLIENT_ROOT}/include) -set(MGCLIENT_LIBRARY_PATH ${MGCLIENT_ROOT}/${MG_INSTALL_LIB_DIR}/libmgclient.a) +set(MGCLIENT_LIBRARY_PATH ${MGCLIENT_LIB_PATH}) set(MGCLIENT_LIBRARY mgclient) add_library(${MGCLIENT_LIBRARY} STATIC IMPORTED) set_target_properties(${MGCLIENT_LIBRARY} PROPERTIES - IMPORTED_LOCATION ${MGCLIENT_LIBRARY_PATH} + IMPORTED_LOCATION "${MGCLIENT_LIBRARY_PATH}" INTERFACE_LINK_LIBRARIES Threads::Threads) add_dependencies(${MGCLIENT_LIBRARY} mgclient-proj) diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 66dfd4e6..3a0fd788 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -1,5 +1,16 @@ +get_filename_component(REPLXX_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/replxx" ABSOLUTE) + +if(CMAKE_BUILD_TYPE_LOWERCASE STREQUAL "debug") + set(REPLXX_LIB_POSTFIX "-d") +elseif(CMAKE_BUILD_TYPE_LOWERCASE STREQUAL "relwithdebinfo") + set(REPLXX_LIB_POSTFIX "-rd") +else() + set(REPLXX_LIB_POSTFIX "") +endif() + +get_filename_component(REPLXX_LIB_PATH "${REPLXX_PREFIX}/${MG_INSTALL_LIB_DIR}/libreplxx${REPLXX_LIB_POSTFIX}.a" ABSOLUTE) ExternalProject_Add(replxx-proj - PREFIX replxx + PREFIX ${REPLXX_PREFIX} GIT_REPOSITORY https://github.com/AmokHuginnsson/replxx.git GIT_TAG release-0.0.4 CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=" @@ -8,26 +19,18 @@ ExternalProject_Add(replxx-proj "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" "-DREPLXX_BUILD_EXAMPLES=OFF" "-DBUILD_SHARED_LIBS=OFF" - INSTALL_DIR "${PROJECT_BINARY_DIR}/replxx") - -if(CMAKE_BUILD_TYPE_LOWERCASE STREQUAL "debug") - set(REPLXX_LIB_POSTFIX "-d") -elseif(CMAKE_BUILD_TYPE_LOWERCASE STREQUAL "relwithdebinfo") - set(REPLXX_LIB_POSTFIX "-rd") -else() - set(REPLXX_LIB_POSTFIX "") -endif() + INSTALL_DIR ${REPLXX_PREFIX} + BUILD_BYPRODUCTS "${REPLXX_LIB_PATH}") -ExternalProject_Get_Property(replxx-proj INSTALL_DIR) -set(REPLXX_ROOT ${INSTALL_DIR}) +set(REPLXX_ROOT ${REPLXX_PREFIX}) set(REPLXX_INCLUDE_DIRS ${REPLXX_ROOT}/include) -set(REPLXX_LIBRARY_PATH ${REPLXX_ROOT}/${MG_INSTALL_LIB_DIR}/libreplxx${REPLXX_LIB_POSTFIX}.a) +set(REPLXX_LIBRARY_PATH ${REPLXX_LIB_PATH}) set(REPLXX_LIBRARY replxx) add_library(${REPLXX_LIBRARY} STATIC IMPORTED GLOBAL) target_compile_definitions(${REPLXX_LIBRARY} INTERFACE REPLXX_STATIC) set_target_properties(${REPLXX_LIBRARY} PROPERTIES - IMPORTED_LOCATION ${REPLXX_LIBRARY_PATH}) + IMPORTED_LOCATION "${REPLXX_LIBRARY_PATH}") add_dependencies(${REPLXX_LIBRARY} replxx-proj) add_library(utils STATIC utils.cpp thread_pool.cpp bolt.cpp) From 951ce3837dc077b66f6044238ee6a7d229078025 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 12:04:23 +0000 Subject: [PATCH 05/34] update CI workflow --- .github/workflows/ci.yml | 62 ++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b795e5a..8bc35a45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,21 +9,16 @@ env: jobs: build_and_test_ubuntu: - strategy: - matrix: - platform: [ubuntu-24.04] - mg_version: - - "2.19.0" - runs-on: ${{ matrix.platform }} + runs-on: ubuntu-latest steps: - name: Set up and check memgraph download link run: | - mg_version=${{ matrix.mg_version }} + mg_version="3.7.2" mg_version_short=${mg_version%%-*} if [ "${{ env.OFFICIAL }}" = "true" ]; then - mg_url="https://download.memgraph.com/memgraph/v${mg_version}/${{ matrix.platform }}/memgraph_${mg_version_short}-1_amd64.deb" + mg_url="https://download.memgraph.com/memgraph/v${mg_version}/ubuntu-24.04/memgraph_${mg_version_short}-1_amd64.deb" else - mg_url="https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/memgraph/v${mg_version}/${{ matrix.platform }}/memgraph_${mg_version_short}-1_amd64.deb" + mg_url="https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/memgraph/v${mg_version}/ubuntu-24.04/memgraph_${mg_version_short}-1_amd64.deb" fi echo "Checking Memgraph download link: $mg_url" if curl --output /dev/null --silent --head --fail $mg_url; then @@ -33,23 +28,20 @@ jobs: echo "Memgraph download link is not valid" exit 1 fi - - name: Install dependencies (Ubuntu 22.04) - if: matrix.platform == 'ubuntu-22.04' + - name: Install dependencies run: | - sudo apt install -y git cmake make gcc g++ libssl-dev # mgconsole deps + sudo apt install -y git cmake make gcc g++ libssl-dev ninja-build # mgconsole deps sudo apt install -y libpython3.10 python3-pip # memgraph deps mkdir ~/memgraph - curl -L ${{ env.MEMGRAPH_DOWNLOAD_LINK }} > ~/memgraph/memgraph_${{ matrix.mg_version }}-1_amd64.deb + curl -L ${{ env.MEMGRAPH_DOWNLOAD_LINK }} > ~/memgraph/memgraph_${mg_version}-1_amd64.deb sudo systemctl mask memgraph - sudo dpkg -i ~/memgraph/memgraph_${{ matrix.mg_version }}-1_amd64.deb + sudo dpkg -i ~/memgraph/memgraph_${mg_version}-1_amd64.deb - uses: actions/checkout@v4 - name: Install and test mgconsole run: | - mkdir build - cd build - cmake .. - make - sudo make install + cmake -B build -G Ninja + cmake --build build + sudo cmake --install build ctest --verbose - name: Save mgconsole test results if: always() @@ -59,12 +51,7 @@ jobs: path: build/Testing/Temporary/LastTest.log build_windows_mingw: - runs-on: windows-2025 - strategy: - matrix: - include: [ - { msystem: MINGW64, arch: x86_64 } - ] + runs-on: windows-latest defaults: run: shell: msys2 {0} @@ -73,20 +60,20 @@ jobs: uses: actions/checkout@v4 - uses: msys2/setup-msys2@v2 with: - msystem: ${{ matrix.msystem }} + msystem: MINGW64 update: true install: >- git base-devel - mingw-w64-${{ matrix.arch }}-toolchain - mingw-w64-${{ matrix.arch }}-cmake - mingw-w64-${{ matrix.arch }}-openssl + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-cmake + mingw-w64-x86_64-openssl - name: Build and install mgconsole run: | mkdir build cd build - cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release .. - cmake --build . --parallel - make install + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release .. + cmake --build build --parallel + cmake --install build - name: Save mgconsole Windows build uses: actions/upload-artifact@v4 with: @@ -94,10 +81,7 @@ jobs: path: build/src/mgconsole.exe build_apple: - strategy: - matrix: - platform: [macos-15] - runs-on: ${{ matrix.platform }} + runs-on: macos-latest steps: - name: Set-up repository uses: actions/checkout@v4 @@ -109,10 +93,8 @@ jobs: brew install openssl - name: Build mgconsole run: | - mkdir build - cd build - cmake -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release .. - make + cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release .. + cmake --build build - name: Save mgconsole MacOS build uses: actions/upload-artifact@v4 with: From 0d0d7d6a73dd5275b2993ed9029a6e0ff17ad7b9 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 12:05:30 +0000 Subject: [PATCH 06/34] update python version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8bc35a45..c5ff4e45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: - name: Install dependencies run: | sudo apt install -y git cmake make gcc g++ libssl-dev ninja-build # mgconsole deps - sudo apt install -y libpython3.10 python3-pip # memgraph deps + sudo apt install -y libpython3.12 python3-pip # memgraph deps mkdir ~/memgraph curl -L ${{ env.MEMGRAPH_DOWNLOAD_LINK }} > ~/memgraph/memgraph_${mg_version}-1_amd64.deb sudo systemctl mask memgraph From f97daffb559538d3907c677ceccd82036a278aaa Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 12:09:09 +0000 Subject: [PATCH 07/34] workflow fixes --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5ff4e45..7aa43b9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,9 +69,7 @@ jobs: mingw-w64-x86_64-openssl - name: Build and install mgconsole run: | - mkdir build - cd build - cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release .. + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release . cmake --build build --parallel cmake --install build - name: Save mgconsole Windows build @@ -93,7 +91,7 @@ jobs: brew install openssl - name: Build mgconsole run: | - cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release .. + cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release . cmake --build build - name: Save mgconsole MacOS build uses: actions/upload-artifact@v4 From cfe63d0a21831d7fa91fd3747a90306e7feb6eb2 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 12:10:10 +0000 Subject: [PATCH 08/34] update minimum cmake version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe844eef..0834b715 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.10) project(mgconsole VERSION 1.5) include(CTest) From fe3a50b120ed51f4457d022f2144b7000c868600 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 14:09:41 +0000 Subject: [PATCH 09/34] allow tests to run with memgraph in docker --- tests/input_output/CMakeLists.txt | 15 +- tests/input_output/output_csv/spatial.txt | 2 +- tests/input_output/output_tabular/spatial.txt | 2 +- tests/input_output/run-tests.sh | 167 ++++++++++++++---- 4 files changed, 149 insertions(+), 37 deletions(-) diff --git a/tests/input_output/CMakeLists.txt b/tests/input_output/CMakeLists.txt index 1f863109..dc740979 100644 --- a/tests/input_output/CMakeLists.txt +++ b/tests/input_output/CMakeLists.txt @@ -16,11 +16,22 @@ set(MEMGRAPH_PATH "/usr/lib/memgraph/memgraph" CACHE FILEPATH "Path to Memgraph binary for client tests") +set(MEMGRAPH_USE_DOCKER OFF CACHE BOOL + "Use Docker container instead of memgraph binary for tests") +set(MEMGRAPH_DOCKER_IMAGE "memgraph/memgraph" CACHE STRING + "Docker image name to use when MEMGRAPH_USE_DOCKER is enabled") + +# Determine test arguments based on Docker mode +if(MEMGRAPH_USE_DOCKER) + set(MEMGRAPH_TEST_ARGS --docker ${MEMGRAPH_DOCKER_IMAGE}) +else() + set(MEMGRAPH_TEST_ARGS ${MEMGRAPH_PATH}) +endif() add_test(NAME mgconsole-test - COMMAND ./run-tests.sh ${MEMGRAPH_PATH} ${PROJECT_BINARY_DIR}/src/mgconsole + COMMAND ./run-tests.sh ${MEMGRAPH_TEST_ARGS} ${PROJECT_BINARY_DIR}/src/mgconsole WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) add_test(NAME mgconsole-secure-test - COMMAND ./run-tests.sh --use-ssl ${MEMGRAPH_PATH} ${PROJECT_BINARY_DIR}/src/mgconsole + COMMAND ./run-tests.sh --use-ssl ${MEMGRAPH_TEST_ARGS} ${PROJECT_BINARY_DIR}/src/mgconsole WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/tests/input_output/output_csv/spatial.txt b/tests/input_output/output_csv/spatial.txt index 7c399a55..822cd2ba 100644 --- a/tests/input_output/output_csv/spatial.txt +++ b/tests/input_output/output_csv/spatial.txt @@ -3,6 +3,6 @@ "point" "POINT({ x:1, y:0, srid:4326 })" "point" -"POINT({ x:0, y:1, z:2, srid:9757 })" +"POINT({ x:0, y:1, z:2, srid:9157 })" "point" "POINT({ x:1, y:0, z:2, srid:4979 })" diff --git a/tests/input_output/output_tabular/spatial.txt b/tests/input_output/output_tabular/spatial.txt index df8feac2..d1c02c54 100644 --- a/tests/input_output/output_tabular/spatial.txt +++ b/tests/input_output/output_tabular/spatial.txt @@ -11,7 +11,7 @@ +-------------------------------------+ | point | +-------------------------------------+ -| POINT({ x:0, y:1, z:2, srid:9757 }) | +| POINT({ x:0, y:1, z:2, srid:9157 }) | +-------------------------------------+ +-------------------------------------+ | point | diff --git a/tests/input_output/run-tests.sh b/tests/input_output/run-tests.sh index 7570d531..56c8c141 100755 --- a/tests/input_output/run-tests.sh +++ b/tests/input_output/run-tests.sh @@ -31,20 +31,47 @@ function echo_success { printf "\033[1;32m~~ $1 ~~\033[0m\n\n"; } function echo_failure { printf "\033[1;31m~~ $1 ~~\033[0m\n\n"; } use_ssl=false -if [ "$1" == "--use-ssl" ]; then - use_ssl=true - shift -fi +use_docker=false +memgraph_image="memgraph/memgraph" +cert_dir="" +container_name="" + +# Parse flags +while [[ $# -gt 0 ]]; do + case $1 in + --use-ssl) + use_ssl=true + shift + ;; + --docker) + use_docker=true + shift + ;; + *) + break + ;; + esac +done if [ ! $# -eq 2 ]; then - echo "Usage: $0 [path to memgraph binary] [path to client binary]" + echo "Usage: $0 [--use-ssl] [--docker] [path to memgraph binary or docker image] [path to client binary]" exit 1 fi -# Find memgraph binaries. -if [ ! -x $1 ]; then - echo_failure "memgraph executable not found" - exit 1 +if [ "$use_docker" = true ]; then + memgraph_image=$1 + # Check if docker is available + if ! command -v docker &> /dev/null; then + echo_failure "docker command not found" + exit 1 + fi +else + # Find memgraph binaries. + if [ ! -x $1 ]; then + echo_failure "memgraph executable not found" + exit 1 + fi + memgraph_binary=$(realpath $1) fi # Find mgconsole binaries. @@ -53,7 +80,6 @@ if [ ! -x $2 ]; then exit 1 fi -memgraph_binary=$(realpath $1) client_binary=$(realpath $2) ## Environment setup @@ -83,22 +109,79 @@ fi # Start the memgraph process and wait for it to start. echo_info "Starting memgraph" -$memgraph_binary --bolt-port 7687 \ - --bolt-cert-file=$cert_file \ - --bolt-key-file=$key_file \ - --data-directory=$tmpdir \ - --storage-properties-on-edges=true \ - --storage-snapshot-interval-sec=0 \ - --storage-wal-enabled=false \ - --data-recovery-on-startup=false \ - --storage-snapshot-on-exit=false \ - --telemetry-enabled=false \ - --timezone=UTC \ - --log-file='' & - -pid=$! -wait_for_server 7687 -echo_success "Started memgraph" +if [ "$use_docker" = true ]; then + container_name="mgconsole_test_$$" + # Remove container if it already exists (from a previous failed run) + docker rm -f $container_name > /dev/null 2>&1 + # Also check for any containers using port 7687 + existing_container=$(docker ps -a --filter "publish=7687" --format "{{.Names}}" | grep -v "^$" | head -1) + if [ -n "$existing_container" ]; then + echo_info "Error: Existing container using port 7687: $existing_container" + exit 1 + fi + + docker_args=" -p 7687:7687 -p 7444:7444" + if $use_ssl; then + docker create --name $container_name $docker_args \ + $memgraph_image \ + --bolt-port 7687 \ + --bolt-cert-file=/etc/memgraph/ssl/cert.pem \ + --bolt-key-file=/etc/memgraph/ssl/key.pem \ + --storage-properties-on-edges=true \ + --storage-snapshot-interval-sec=0 \ + --storage-wal-enabled=false \ + --data-recovery-on-startup=false \ + --storage-snapshot-on-exit=false \ + --telemetry-enabled=false \ + --timezone=UTC \ + --log-file='' || exit 1 + echo_info "Copying certificates to container" + # Create the SSL directory and copy certificates before starting + docker cp $cert_file $container_name:/tmp/cert.pem + docker cp $key_file $container_name:/tmp/key.pem + docker start $container_name + # Wait a moment for container to be ready + sleep 1 + # Create directory and copy certificates as root, then fix ownership + docker exec -u root $container_name sh -c "mkdir -p /etc/memgraph/ssl/ && cp /tmp/cert.pem /etc/memgraph/ssl/cert.pem && cp /tmp/key.pem /etc/memgraph/ssl/key.pem && chmod 644 /etc/memgraph/ssl/cert.pem && chmod 600 /etc/memgraph/ssl/key.pem && chown -R memgraph:memgraph /etc/memgraph/ssl/ || true" + docker exec $container_name ls -la /etc/memgraph/ssl/ 2>&1 || true + # Restart container to pick up the certificates + docker restart $container_name + sleep 2 + else + docker run -d --name $container_name $docker_args \ + $memgraph_image \ + --bolt-port 7687 \ + --storage-properties-on-edges=true \ + --storage-snapshot-interval-sec=0 \ + --storage-wal-enabled=false \ + --data-recovery-on-startup=false \ + --storage-snapshot-on-exit=false \ + --telemetry-enabled=false \ + --timezone=UTC \ + --log-file='' || exit 1 + fi + + wait_for_server 7687 + echo_success "Started memgraph in docker container" +else + $memgraph_binary --bolt-port 7687 \ + --bolt-cert-file=$cert_file \ + --bolt-key-file=$key_file \ + --data-directory=$tmpdir \ + --storage-properties-on-edges=true \ + --storage-snapshot-interval-sec=0 \ + --storage-wal-enabled=false \ + --data-recovery-on-startup=false \ + --storage-snapshot-on-exit=false \ + --telemetry-enabled=false \ + --timezone=UTC \ + --log-file='' & + + pid=$! + wait_for_server 7687 + echo_success "Started memgraph" +fi ## Tests @@ -109,7 +192,6 @@ echo_info "Prepare database" echo # Blank line $client_binary $client_flags < ${DIR}/prepare.cypher > $tmpdir/prepare.log - echo_info "Running tests" echo # Blank line @@ -126,7 +208,13 @@ for output_dir in ${DIR}/output_*; do run_flags="$client_flags --output-format=$output_format" echo_info "Running test '$test_name' with $output_format output" - $client_binary $run_flags < $filename > $tmpdir/$test_name + $client_binary $run_flags < $filename > $tmpdir/$test_name 2>&1 + test_exit_code=$? + if [ $test_exit_code -ne 0 ]; then + echo_failure "Test '$test_name' with $output_format output failed with exit code $test_exit_code" + echo "Output:" + cat $tmpdir/$test_name + fi diff -b $tmpdir/$test_name $output_dir/$output_name test_code=$? if [ $test_code -ne 0 ]; then @@ -149,17 +237,30 @@ done ## Cleanup echo_info "Starting test cleanup" -# Shutdown the memgraph process. -kill $pid -wait -n -code_mg=$? +# Shutdown the memgraph process or container. +if [ "$use_docker" = true ]; then + docker stop $container_name > /dev/null 2>&1 + code_mg=$? + docker rm $container_name > /dev/null 2>&1 + if [ -n "$cert_dir" ]; then + rm -rf $cert_dir + fi +else + kill $pid + wait -n + code_mg=$? +fi # Remove temporary directory rm -rf $tmpdir # Check memgraph exit code. if [ $code_mg -ne 0 ]; then - echo_failure "The memgraph process didn't terminate properly!" + if [ "$use_docker" = true ]; then + echo_failure "The memgraph container didn't terminate properly!" + else + echo_failure "The memgraph process didn't terminate properly!" + fi exit $code_mg fi echo_success "Test cleanup done" From 387d1681af7555f1160e76ad060fd93496d2179e Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 14:12:27 +0000 Subject: [PATCH 10/34] udpate workflow to test using docker --- .github/workflows/ci.yml | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7aa43b9d..cacd5031 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,35 +11,14 @@ jobs: build_and_test_ubuntu: runs-on: ubuntu-latest steps: - - name: Set up and check memgraph download link + - name: Pull latest memgraph image run: | - mg_version="3.7.2" - mg_version_short=${mg_version%%-*} - if [ "${{ env.OFFICIAL }}" = "true" ]; then - mg_url="https://download.memgraph.com/memgraph/v${mg_version}/ubuntu-24.04/memgraph_${mg_version_short}-1_amd64.deb" - else - mg_url="https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/memgraph/v${mg_version}/ubuntu-24.04/memgraph_${mg_version_short}-1_amd64.deb" - fi - echo "Checking Memgraph download link: $mg_url" - if curl --output /dev/null --silent --head --fail $mg_url; then - echo "Memgraph download link is valid" - echo "MEMGRAPH_DOWNLOAD_LINK=${mg_url}" >> $GITHUB_ENV - else - echo "Memgraph download link is not valid" - exit 1 - fi - - name: Install dependencies - run: | - sudo apt install -y git cmake make gcc g++ libssl-dev ninja-build # mgconsole deps - sudo apt install -y libpython3.12 python3-pip # memgraph deps - mkdir ~/memgraph - curl -L ${{ env.MEMGRAPH_DOWNLOAD_LINK }} > ~/memgraph/memgraph_${mg_version}-1_amd64.deb - sudo systemctl mask memgraph - sudo dpkg -i ~/memgraph/memgraph_${mg_version}-1_amd64.deb + docker pull memgraph/memgraph:latest + echo "MEMGRAPH_IMAGE=memgraph/memgraph:latest" >> $GITHUB_ENV - uses: actions/checkout@v4 - name: Install and test mgconsole run: | - cmake -B build -G Ninja + cmake -B build -G Ninja -DMEMGRAPH_USE_DOCKER=ON -DMEMGRAPH_DOCKER_IMAGE=$MEMGRAPH_IMAGE cmake --build build sudo cmake --install build ctest --verbose From d692e6e4f31259cf0e6db46de08bef41a13e6e47 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 14:15:58 +0000 Subject: [PATCH 11/34] use correct test directory --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cacd5031..cbb0b023 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: cmake -B build -G Ninja -DMEMGRAPH_USE_DOCKER=ON -DMEMGRAPH_DOCKER_IMAGE=$MEMGRAPH_IMAGE cmake --build build sudo cmake --install build - ctest --verbose + ctest --verbose --test-dir build - name: Save mgconsole test results if: always() uses: actions/upload-artifact@v4 From 1e26c739ca582a2a514a016f74d8a86ae30ddb67 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 16:53:32 +0000 Subject: [PATCH 12/34] update build generic script --- build-generic-linux.sh | 81 ++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/build-generic-linux.sh b/build-generic-linux.sh index 20a095d8..810652bf 100755 --- a/build-generic-linux.sh +++ b/build-generic-linux.sh @@ -1,49 +1,52 @@ #!/bin/bash + +set -euo pipefail + SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PROJECT_ROOT="$SCRIPT_DIR" -docker_name="mgconsole_build_generic_linux" -toolchain_url="https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v4/toolchain-v4-binaries-centos-7-x86_64.tar.gz" -toolchain_tar_gz="$(basename $toolchain_url)" -memgraph_repo="https://github.com/memgraph/memgraph.git" -setup_toolchain_cmd="cd /memgraph/environment/os && \ - ./centos-7.sh check TOOLCHAIN_RUN_DEPS || \ - ./centos-7.sh install TOOLCHAIN_RUN_DEPS" -setup_memgraph_cmd="cd /memgraph/environment/os && \ - ./centos-7.sh check MEMGRAPH_BUILD_DEPS || \ - ./centos-7.sh install MEMGRAPH_BUILD_DEPS" -mgconsole_build_cmd="source /opt/toolchain-v4/activate && \ - mkdir -p /mgconsole/build && cd /mgconsole/build && \ - cmake -DCMAKE_BUILD_TYPE=Release .. && make -j" - -if [ ! "$(docker info)" ]; then - echo "ERROR: Docker is required" - exit 1 -fi +RED='\033[1;31m' +GREEN='\033[1;32m' +YELLOW='\033[1;33m' +RESET='\033[0m' -if [ ! "$(docker ps -q -f name=$docker_name)" ]; then - if [ "$(docker ps -aq -f status=exited -f name=$docker_name)" ]; then - echo "Cleanup of the old exited mgconsole build container..." - docker rm $docker_name +function cleanup() { + status=$? + if [ $status -ne 0 ]; then + COLOUR=$RED + else + COLOUR=$YELLOW fi - docker run -d --network host --name "$docker_name" centos:7 sleep infinity + echo -e "${COLOUR}Cleaning up...${RESET}" + docker stop builder || true + exit $status +} + +ARCH="$(arch)" +if [[ $ARCH == "x86_64" ]]; then + DOCKER_IMAGE="memgraph/mgbuild:v7_centos-9" # libc 2.34 +elif [[ $ARCH == "aarch64" ]]; then + DOCKER_IMAGE="memgraph/mgbuild:v7_debian-12-arm" # libc 2.36 fi -echo "The mgconsole build container is active!" -docker_exec () { - cmd="$1" - docker exec -it "$docker_name" bash -c "$cmd" -} +trap cleanup EXIT ERR + +echo -e "${GREEN}Starting build container...${RESET}" +docker run --rm -d --name builder $DOCKER_IMAGE + +echo -e "${GREEN}Copying mgconsole source code to build container...${RESET}" +docker cp "$PROJECT_ROOT/." builder:/home/mg/mgconsole -docker_exec "mkdir -p /mgconsole" -docker cp -q "$PROJECT_ROOT/." "$docker_name:/mgconsole/" -docker_exec "rm -rf /mgconsole/build/*" -docker_exec "yum install -y wget git" -docker_exec "[ ! -f /$toolchain_tar_gz ] && wget -O /$toolchain_tar_gz $toolchain_url" -docker_exec "[ ! -d /opt/toolchain-v4/ ] && tar -xzf /$toolchain_tar_gz -C /opt" -docker_exec "[ ! -d /memgraph/ ] && git clone $memgraph_repo" -docker_exec "$setup_toolchain_cmd" -docker_exec "$setup_memgraph_cmd" -docker_exec "$mgconsole_build_cmd" +echo -e "${GREEN}Building mgconsole...${RESET}" +docker exec -u mg builder bash -c " + source /opt/toolchain-v7/activate && \ + cd /home/mg/mgconsole && \ + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DMGCONSOLE_STATIC_SSL=ON -DCMAKE_INSTALL_PREFIX=/home/mg/mgconsole/build/install . && \ + cmake --build build && \ + cmake --install build" + +echo -e "${GREEN}Saving build...${RESET}" mkdir -p "$PROJECT_ROOT/build/generic" -docker cp -q "$docker_name:/mgconsole/build/src/mgconsole" "$PROJECT_ROOT/build/generic/" +docker cp builder:/home/mg/mgconsole/build/install/bin/mgconsole "$PROJECT_ROOT/build/generic/" + +echo -e "${GREEN}Build complete!${RESET}" From 1648c059855950329efa00ad4dd20cb57f551e46 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 17:11:07 +0000 Subject: [PATCH 13/34] added script to test static build --- .github/workflows/ci.yml | 31 ++++++++++++++++++++++++++--- tests/test-static.sh | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 3 deletions(-) create mode 100755 tests/test-static.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbb0b023..a7606ada 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,6 @@ on: push: workflow_dispatch: -env: - OFFICIAL: true - jobs: build_and_test_ubuntu: runs-on: ubuntu-latest @@ -77,3 +74,31 @@ jobs: with: name: "mgconsole MacOS build" path: build/src/mgconsole + + build_and_test_static: + strategy: + matrix: + arch: [X64, ARM64] + runs-on: [self-hosted, Linux, ${{ matrix.arch}}] + steps: + - uses: actions/checkout@v4 + + - name: build mgconsole static + run: | + ./build-static-linux.sh + + - name: Save mgconsole static build + uses: actions/upload-artifact@v4 + with: + name: "mgconsole static Linux build ${{ matrix.arch }}" + path: build/generic/mgconsole + + - name: Pull latest memgraph image + run: | + docker pull memgraph/memgraph:latest + echo "MEMGRAPH_IMAGE=memgraph/memgraph:latest" >> $GITHUB_ENV + + - name: Test mgconsole static build + run: | + ./tests/test-static.sh --docker $MEMGRAPH_IMAGE build/generic/mgconsole + ./tests/test-static.sh --use-ssl --docker $MEMGRAPH_IMAGE build/generic/mgconsole diff --git a/tests/test-static.sh b/tests/test-static.sh new file mode 100755 index 00000000..93ef4074 --- /dev/null +++ b/tests/test-static.sh @@ -0,0 +1,43 @@ +#!/bin/bash +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +PROJECT_ROOT="$SCRIPT_DIR/.." + +set -euo pipefail + +# Parse flags +use_ssl=false +use_docker=false +while [[ $# -gt 0 ]]; do + case $1 in + --use-ssl) + use_ssl=true + shift + ;; + --docker) + use_docker=true + shift + ;; + *) + break + ;; + esac +done + +client_binary=${1:-"$PROJECT_ROOT/build/generic/mgconsole"} +memgraph_image=${2:-"memgraph/memgraph:latest"} + +echo "Testing mgconsole static build" + +script_args=() +if $use_ssl; then + script_args+=("--use-ssl") +fi +if $use_docker; then + script_args+=("--docker") +fi +script_args+=("$memgraph_image" "$client_binary") +echo "Running tests with arguments: ${script_args[@]}" + +cd "$SCRIPT_DIR/input_output" +./run-tests.sh "${script_args[@]}" +echo "Tests passed" From 85c87e9c567941c47a5f05f2c7fe98dffd25e1d1 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 17:13:22 +0000 Subject: [PATCH 14/34] syntax fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7606ada..3be8e5c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,7 @@ jobs: strategy: matrix: arch: [X64, ARM64] - runs-on: [self-hosted, Linux, ${{ matrix.arch}}] + runs-on: [self-hosted, Linux, ${{ matrix.arch }}] steps: - uses: actions/checkout@v4 From 2a5a83d50181678d4c8fc89a3fc4fa47e5614258 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 17:14:27 +0000 Subject: [PATCH 15/34] fix workflow --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3be8e5c4..153daab2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,13 +79,13 @@ jobs: strategy: matrix: arch: [X64, ARM64] - runs-on: [self-hosted, Linux, ${{ matrix.arch }}] + runs-on: [self-hosted, Linux, "${{ matrix.arch }}" ] steps: - uses: actions/checkout@v4 - name: build mgconsole static run: | - ./build-static-linux.sh + ./build-generic-linux.sh - name: Save mgconsole static build uses: actions/upload-artifact@v4 From 4bf37259a1dd9eda4a47bc4e09e8cf13d6715a7e Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 17:16:46 +0000 Subject: [PATCH 16/34] change ownership --- .github/workflows/ci.yml | 1 + build-generic-linux.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 153daab2..cf5339e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,6 +77,7 @@ jobs: build_and_test_static: strategy: + fail-fast: false matrix: arch: [X64, ARM64] runs-on: [self-hosted, Linux, "${{ matrix.arch }}" ] diff --git a/build-generic-linux.sh b/build-generic-linux.sh index 810652bf..c12e5502 100755 --- a/build-generic-linux.sh +++ b/build-generic-linux.sh @@ -36,6 +36,7 @@ docker run --rm -d --name builder $DOCKER_IMAGE echo -e "${GREEN}Copying mgconsole source code to build container...${RESET}" docker cp "$PROJECT_ROOT/." builder:/home/mg/mgconsole +docker exec -u root builder bash -c "chown -R mg:mg /home/mg/mgconsole" echo -e "${GREEN}Building mgconsole...${RESET}" docker exec -u mg builder bash -c " From 5902e5006973e2b6208070b13b1682c94dba08b3 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 17:25:38 +0000 Subject: [PATCH 17/34] added cleanup --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf5339e8..05af02de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,3 +103,12 @@ jobs: run: | ./tests/test-static.sh --docker $MEMGRAPH_IMAGE build/generic/mgconsole ./tests/test-static.sh --use-ssl --docker $MEMGRAPH_IMAGE build/generic/mgconsole + + - name: Cleanup docker images + run: | + docker rmi $MEMGRAPH_IMAGE || true + if [[ "${{ matrix.arch }}" == "X64" ]]; then + docker rmi memgraph/mgbuild:v7_centos-9 || true + elif [[ "${{ matrix.arch }}" == "ARM64" ]]; then + docker rmi memgraph/mgbuild:v7_debian-12-arm || true + fi From 0eb04a3616d55597133d182c85e631f78950d6f7 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 17:33:26 +0000 Subject: [PATCH 18/34] fix test path --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05af02de..1f326a3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,8 +101,8 @@ jobs: - name: Test mgconsole static build run: | - ./tests/test-static.sh --docker $MEMGRAPH_IMAGE build/generic/mgconsole - ./tests/test-static.sh --use-ssl --docker $MEMGRAPH_IMAGE build/generic/mgconsole + ./tests/test-static.sh --docker $MEMGRAPH_IMAGE + ./tests/test-static.sh --use-ssl --docker $MEMGRAPH_IMAGE - name: Cleanup docker images run: | From 6e4598a688104e1a73778a634ebb4fab154e3777 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 17:40:59 +0000 Subject: [PATCH 19/34] reorder test script args --- tests/test-static.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/test-static.sh b/tests/test-static.sh index 93ef4074..a1103cbd 100755 --- a/tests/test-static.sh +++ b/tests/test-static.sh @@ -23,11 +23,10 @@ while [[ $# -gt 0 ]]; do esac done -client_binary=${1:-"$PROJECT_ROOT/build/generic/mgconsole"} -memgraph_image=${2:-"memgraph/memgraph:latest"} +memgraph_image=${1:-"memgraph/memgraph:latest"} +client_binary=${2:-"$PROJECT_ROOT/build/generic/mgconsole"} echo "Testing mgconsole static build" - script_args=() if $use_ssl; then script_args+=("--use-ssl") @@ -36,7 +35,6 @@ if $use_docker; then script_args+=("--docker") fi script_args+=("$memgraph_image" "$client_binary") -echo "Running tests with arguments: ${script_args[@]}" cd "$SCRIPT_DIR/input_output" ./run-tests.sh "${script_args[@]}" From 4d760e48fcc011bc3eef382ad83a48142b3c8f13 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 18:08:44 +0000 Subject: [PATCH 20/34] added binaries to release workflow --- .github/workflows/ci.yml | 2 + .github/workflows/release.yml | 138 +++++++++++++++++++++++++++++++++- 2 files changed, 138 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f326a3e..2980b06c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ name: CI on: push: workflow_dispatch: + workflow_call: jobs: build_and_test_ubuntu: @@ -76,6 +77,7 @@ jobs: path: build/src/mgconsole build_and_test_static: + if: ${{ github.event_name == 'workflow_call' }} strategy: fail-fast: false matrix: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3932af10..4c261270 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,13 +12,22 @@ on: type: boolean required: false default: false + test-release: + description: "Test the release by pushing to test repository" + type: boolean + required: false + default: true + +env: + S3_BUCKET: "${{ github.event.inputs.test-release == 'true' && 'deps.memgraph.io' || 'download.memgraph.com' }}" + S3_BASE_PREFIX: "${{ github.event.inputs.test-release == 'true' && 'mgconsole-test' || 'mgconsole' }}/v${{ github.event.inputs.version }}" jobs: build-and-push: runs-on: ubuntu-latest env: DOCKER_ORGANIZATION_NAME: memgraph - DOCKER_REPOSITORY_NAME: mgconsole + DOCKER_REPOSITORY_NAME: "${{ github.event.inputs.test-release == 'true' && 'mgconsole-test' || 'mgconsole' }}" steps: - name: Checkout repository @@ -62,4 +71,129 @@ jobs: - name: Verify Docker image run: | - docker run --rm $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ github.event.inputs.version }} --version \ No newline at end of file + docker run --rm $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ github.event.inputs.version }} --version + + build-binaries: + name: Build binaries + uses: ./.github/workflows/ci.yml + + upload-binaries: + name: Upload binaries + needs: [build-binaries, build-and-push] + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + + - name: Login to AWS + uses: aws-actions/configure-aws-credentials@f7b8181755fc1413cd909cbac860d8a76dc848f1 # v6.0.2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-west-1 + + - name: Download artifacts Linux X64 + uses: actions/download-artifact@v4 + with: + name: "mgconsole static Linux build X64" + path: linux-x86_64/mgconsole + + - name: Download artifacts Linux ARM64 + uses: actions/download-artifact@v4 + with: + name: "mgconsole static Linux build ARM64" + path: linux-aarch64/mgconsole + + - name: Download artifacts MacOS + uses: actions/download-artifact@v4 + with: + name: "mgconsole MacOS build" + path: macos/mgconsole + + - name: Download artifacts Windows + uses: actions/download-artifact@v4 + with: + name: "mgconsole Windows build" + path: windows/mgconsole.exe + + - name: Upload binaries to S3 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + run: | + aws s3 cp linux-x86_64/mgconsole s3://${{ env.S3_BUCKET }}/${{ env.S3_BASE_PREFIX }}/linux-x86_64/mgconsole + aws s3 cp linux-aarch64/mgconsole s3://${{ env.S3_BUCKET }}/${{ env.S3_BASE_PREFIX }}/linux-aarch64/mgconsole + aws s3 cp macos/mgconsole s3://${{ env.S3_BUCKET }}/${{ env.S3_BASE_PREFIX }}/macos/mgconsole + aws s3 cp windows/mgconsole.exe s3://${{ env.S3_BUCKET }}/${{ env.S3_BASE_PREFIX }}/windows/mgconsole.exe + + - name: Configure Git + run: | + git config user.name "github-actions" + git config user.email "github-actions@github.com" + + - name: Set tag + if: ${{ github.event.inputs.test-release == 'false' }} + run: | + TAG="v${{ github.event.inputs.version }}" + echo "TAG=${TAG}" >> $GITHUB_ENV + git tag $TAG + git push origin $TAG + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.TAG }} + release_name: "Release ${{ env.TAG }}" + draft: true + prerelease: false + + - name: Compress binaries + run: | + tar -czvf mgconsole-${{ env.TAG }}-linux-x86_64.tar.gz linux-x86_64/mgconsole + tar -czvf mgconsole-${{ env.TAG }}-linux-aarch64.tar.gz linux-aarch64/mgconsole + tar -czvf mgconsole-${{ env.TAG }}-macos.tar.gz macos/mgconsole + tar -czvf mgconsole-${{ env.TAG }}-windows.tar.gz windows/mgconsole.exe + + - name: Upload binaries to Release Linux X64 + uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./mgconsole-${{ env.TAG }}-linux-x86_64.tar.gz + asset_name: mgconsole-${{ env.TAG }}-linux-x86_64.tar.gz + asset_content_type: application/octet-stream + + - name: Upload binaries to Release Linux ARM64 + uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./mgconsole-${{ env.TAG }}-linux-aarch64.tar.gz + asset_name: mgconsole-${{ env.TAG }}-linux-aarch64.tar.gz + asset_content_type: application/octet-stream + + - name: Upload binaries to Release MacOS + uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./mgconsole-${{ env.TAG }}-macos.tar.gz + asset_name: mgconsole-${{ env.TAG }}-macos.tar.gz + asset_content_type: application/octet-stream + + - name: Upload binaries to Release Windows + uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./mgconsole-${{ env.TAG }}-windows.tar.gz + asset_name: mgconsole-${{ env.TAG }}-windows.tar.gz + asset_content_type: application/octet-stream From 9d2f471bf063310c14e04dfcff8555bf2d40b832 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 22:19:35 +0000 Subject: [PATCH 21/34] update workflow logic --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4c261270..63ef5f25 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -133,7 +133,6 @@ jobs: git config user.email "github-actions@github.com" - name: Set tag - if: ${{ github.event.inputs.test-release == 'false' }} run: | TAG="v${{ github.event.inputs.version }}" echo "TAG=${TAG}" >> $GITHUB_ENV From eb659cef64c8ce04d27ccb8004e6b7c04b8b68a6 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 22:25:49 +0000 Subject: [PATCH 22/34] update workflows --- .github/workflows/ci.yml | 14 +++++++++++++- .github/workflows/release.yml | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2980b06c..c3a495ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,19 @@ name: CI on: push: workflow_dispatch: + inputs: + buil-static: + description: "Build static version of mgconsole" + type: boolean + required: false + default: false workflow_call: + inputs: + build-static: + description: "Build static version of mgconsole" + type: boolean + required: false + default: false jobs: build_and_test_ubuntu: @@ -77,7 +89,7 @@ jobs: path: build/src/mgconsole build_and_test_static: - if: ${{ github.event_name == 'workflow_call' }} + if: ${{ inputs.build-static }} strategy: fail-fast: false matrix: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 63ef5f25..bdcf3985 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,6 +76,8 @@ jobs: build-binaries: name: Build binaries uses: ./.github/workflows/ci.yml + with: + build-static: true upload-binaries: name: Upload binaries From 49a9868df5cc5d645af219f9083ed7be8615face Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 6 Feb 2026 23:23:33 +0000 Subject: [PATCH 23/34] hopefully fix artifact upload to S3 --- .github/workflows/release.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bdcf3985..4af476de 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -99,25 +99,33 @@ jobs: uses: actions/download-artifact@v4 with: name: "mgconsole static Linux build X64" - path: linux-x86_64/mgconsole + path: temp-linux-x64 - name: Download artifacts Linux ARM64 uses: actions/download-artifact@v4 with: name: "mgconsole static Linux build ARM64" - path: linux-aarch64/mgconsole + path: temp-linux-arm64 - name: Download artifacts MacOS uses: actions/download-artifact@v4 with: name: "mgconsole MacOS build" - path: macos/mgconsole + path: temp-macos - name: Download artifacts Windows uses: actions/download-artifact@v4 with: name: "mgconsole Windows build" - path: windows/mgconsole.exe + path: temp-windows + + - name: Organize binaries + run: | + mkdir -p linux-x86_64 linux-aarch64 macos windows + find temp-linux-x64 -name "mgconsole" -type f | head -1 | xargs -I {} cp {} linux-x86_64/mgconsole + find temp-linux-arm64 -name "mgconsole" -type f | head -1 | xargs -I {} cp {} linux-aarch64/mgconsole + find temp-macos -name "mgconsole" -type f | head -1 | xargs -I {} cp {} macos/mgconsole + find temp-windows -name "mgconsole.exe" -type f | head -1 | xargs -I {} cp {} windows/mgconsole.exe - name: Upload binaries to S3 env: From 0d3336b0b43d5944809e4f173e54cd33dacbd37f Mon Sep 17 00:00:00 2001 From: Matt James Date: Sun, 8 Feb 2026 10:02:48 +0000 Subject: [PATCH 24/34] update workflows --- .github/workflows/ci.yml | 6 ++++++ .github/workflows/release.yml | 11 +++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3a495ae..4986f847 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,11 @@ on: required: false default: false +run-name: CI: Build and test mgconsole + jobs: build_and_test_ubuntu: + name: Build and test mgconsole on Ubuntu runs-on: ubuntu-latest steps: - name: Pull latest memgraph image @@ -40,6 +43,7 @@ jobs: path: build/Testing/Temporary/LastTest.log build_windows_mingw: + name: Build and test mgconsole on Windows runs-on: windows-latest defaults: run: @@ -68,6 +72,7 @@ jobs: path: build/src/mgconsole.exe build_apple: + name: Build and test mgconsole on Apple runs-on: macos-latest steps: - name: Set-up repository @@ -90,6 +95,7 @@ jobs: build_and_test_static: if: ${{ inputs.build-static }} + name: Build and test mgconsole static build strategy: fail-fast: false matrix: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4af476de..1a5fb53e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,8 +22,11 @@ env: S3_BUCKET: "${{ github.event.inputs.test-release == 'true' && 'deps.memgraph.io' || 'download.memgraph.com' }}" S3_BASE_PREFIX: "${{ github.event.inputs.test-release == 'true' && 'mgconsole-test' || 'mgconsole' }}/v${{ github.event.inputs.version }}" +run-name: Release ${{ github.event.inputs.version }} ${{ github.event.inputs.test-release == 'true' && 'test' || '' }} + jobs: build-and-push: + name: Build and push Docker image runs-on: ubuntu-latest env: DOCKER_ORGANIZATION_NAME: memgraph @@ -162,10 +165,10 @@ jobs: - name: Compress binaries run: | - tar -czvf mgconsole-${{ env.TAG }}-linux-x86_64.tar.gz linux-x86_64/mgconsole - tar -czvf mgconsole-${{ env.TAG }}-linux-aarch64.tar.gz linux-aarch64/mgconsole - tar -czvf mgconsole-${{ env.TAG }}-macos.tar.gz macos/mgconsole - tar -czvf mgconsole-${{ env.TAG }}-windows.tar.gz windows/mgconsole.exe + tar -czvf mgconsole-${{ env.TAG }}-linux-x86_64.tar.gz -C linux-x86_64 mgconsole + tar -czvf mgconsole-${{ env.TAG }}-linux-aarch64.tar.gz -C linux-aarch64 mgconsole + tar -czvf mgconsole-${{ env.TAG }}-macos.tar.gz -C macos mgconsole + tar -czvf mgconsole-${{ env.TAG }}-windows.tar.gz -C windows mgconsole.exe - name: Upload binaries to Release Linux X64 uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 From 2d83d8c19d9fb83496ea2bcda0207769a8c68ba5 Mon Sep 17 00:00:00 2001 From: Matt James Date: Sun, 8 Feb 2026 10:28:34 +0000 Subject: [PATCH 25/34] update workflows --- .github/workflows/ci.yml | 29 +++++++++++++++++++---------- .github/workflows/release.yml | 20 ++++++++++---------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4986f847..780940a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ on: required: false default: false -run-name: CI: Build and test mgconsole +run-name: "CI: Build and test mgconsole" jobs: build_and_test_ubuntu: @@ -28,16 +28,19 @@ jobs: run: | docker pull memgraph/memgraph:latest echo "MEMGRAPH_IMAGE=memgraph/memgraph:latest" >> $GITHUB_ENV - - uses: actions/checkout@v4 + + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Install and test mgconsole run: | cmake -B build -G Ninja -DMEMGRAPH_USE_DOCKER=ON -DMEMGRAPH_DOCKER_IMAGE=$MEMGRAPH_IMAGE cmake --build build sudo cmake --install build ctest --verbose --test-dir build + - name: Save mgconsole test results if: always() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: "mgconsole_ctest.log" path: build/Testing/Temporary/LastTest.log @@ -50,8 +53,9 @@ jobs: shell: msys2 {0} steps: - name: Set-up repository - uses: actions/checkout@v4 - - uses: msys2/setup-msys2@v2 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - uses: msys2/setup-msys2@4f806de0a5a7294ffabaff804b38a9b435a73bda # v2.30.0 with: msystem: MINGW64 update: true @@ -60,13 +64,15 @@ jobs: mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-openssl + - name: Build and install mgconsole run: | cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release . cmake --build build --parallel cmake --install build + - name: Save mgconsole Windows build - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: "mgconsole Windows build" path: build/src/mgconsole.exe @@ -76,19 +82,22 @@ jobs: runs-on: macos-latest steps: - name: Set-up repository - uses: actions/checkout@v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 # NOTE: CI can't execute end2end tests because there is no way to run # Memgraph on CI MacOS machines. + - name: Install openssl run: | brew update brew install openssl + - name: Build mgconsole run: | cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release . cmake --build build + - name: Save mgconsole MacOS build - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: "mgconsole MacOS build" path: build/src/mgconsole @@ -102,14 +111,14 @@ jobs: arch: [X64, ARM64] runs-on: [self-hosted, Linux, "${{ matrix.arch }}" ] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: build mgconsole static run: | ./build-generic-linux.sh - name: Save mgconsole static build - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: "mgconsole static Linux build ${{ matrix.arch }}" path: build/generic/mgconsole diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a5fb53e..064f10b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,13 +34,13 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 - name: Log in to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} @@ -62,7 +62,7 @@ jobs: fi - name: Build and push Docker image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: context: . push: true @@ -71,7 +71,6 @@ jobs: ${{ env.DOCKER_ORGANIZATION_NAME }}/${{ env.DOCKER_REPOSITORY_NAME }}:latest platforms: linux/amd64,linux/arm64 - - name: Verify Docker image run: | docker run --rm $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ github.event.inputs.version }} --version @@ -90,7 +89,6 @@ jobs: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - name: Login to AWS uses: aws-actions/configure-aws-credentials@f7b8181755fc1413cd909cbac860d8a76dc848f1 # v6.0.2 with: @@ -99,25 +97,25 @@ jobs: aws-region: eu-west-1 - name: Download artifacts Linux X64 - uses: actions/download-artifact@v4 + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: name: "mgconsole static Linux build X64" path: temp-linux-x64 - name: Download artifacts Linux ARM64 - uses: actions/download-artifact@v4 + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: name: "mgconsole static Linux build ARM64" path: temp-linux-arm64 - name: Download artifacts MacOS - uses: actions/download-artifact@v4 + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: name: "mgconsole MacOS build" path: temp-macos - name: Download artifacts Windows - uses: actions/download-artifact@v4 + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: name: "mgconsole Windows build" path: temp-windows @@ -152,6 +150,7 @@ jobs: git tag $TAG git push origin $TAG + # TODO(matt): this action is archived, we should probably find a suitable replacement - name: Create GitHub Release id: create_release uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4 @@ -170,6 +169,7 @@ jobs: tar -czvf mgconsole-${{ env.TAG }}-macos.tar.gz -C macos mgconsole tar -czvf mgconsole-${{ env.TAG }}-windows.tar.gz -C windows mgconsole.exe + # TODO(matt): this action is archived, we should probably find a suitable replacement - name: Upload binaries to Release Linux X64 uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 env: From fe2418fc329294a74b008fc1442df1fd93346c97 Mon Sep 17 00:00:00 2001 From: Matt James Date: Sun, 8 Feb 2026 10:32:51 +0000 Subject: [PATCH 26/34] update build instructions in the readme --- README.md | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 5bcdd981..8f8fc85b 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ docker run -it memgraph/mgconsole:latest ## Building and installing To build and install mgconsole from source you will need: - - CMake version >= 3.4 + - CMake version >= 3.10 - OpenSSL version >= 1.0.2 - C compiler supporting C11 - C++ compiler supporting C++20 @@ -31,19 +31,19 @@ To build and install mgconsole from source you will need: To install compile dependencies on Debian / Ubuntu: ``` -apt-get install -y git cmake make gcc g++ libssl-dev +apt-get install -y git cmake make gcc g++ libssl-dev ninja-build ``` On RedHat / CentOS / Fedora: ``` -yum install -y git cmake make gcc gcc-c++ openssl-devel libstdc++-static +yum install -y git cmake make gcc gcc-c++ openssl-devel libstdc++-static ninja-build ``` On MacOS, first make sure you have [XCode](https://developer.apple.com/xcode/) and [Homebrew](https://brew.sh) installed. Then, in the terminal, paste: ``` -brew install git cmake make openssl +brew install git cmake make openssl ninja ``` On Windows, you need to install the MSYS2. Just follow the [instructions](https://www.msys2.org), up to step 6. @@ -59,39 +59,31 @@ inside the MSYS2 MINGW64 terminal: pacman -Syu --needed base-devel git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-openssl ``` -Once everything is in place, create a build directory inside the source -directory and configure the build by running CMake from it as follows: +Once everything is in place, configure the build by running CMake as follows: * on Linux: ``` -mkdir build -cd build -cmake -DCMAKE_BUILD_TYPE=Release .. +cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release . ``` * on MacOS: ``` -mkdir build -cd build -cmake -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release .. +cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release . ``` * on Windows, from the MSYS2 MINGW64 terminal: ``` -mkdir build -cd build -cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release .. +cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release . ``` -After running CMake, you should see a Makefile in the build directory. Then you -can build the project by running: +After running CMake, you can build the project by running: ``` -make +cmake --build build ``` This will build the `mgconsole` binary. To install it, run: ``` -make install +cmake --install build ``` This will install to system default installation directory. If you want to From 3c09ad29504d66d6c761ec6cb3f326a47cc98a55 Mon Sep 17 00:00:00 2001 From: Matt James Date: Sun, 8 Feb 2026 10:38:43 +0000 Subject: [PATCH 27/34] remove unused variable --- tests/input_output/run-tests.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/input_output/run-tests.sh b/tests/input_output/run-tests.sh index 56c8c141..3b204549 100755 --- a/tests/input_output/run-tests.sh +++ b/tests/input_output/run-tests.sh @@ -33,7 +33,6 @@ function echo_failure { printf "\033[1;31m~~ $1 ~~\033[0m\n\n"; } use_ssl=false use_docker=false memgraph_image="memgraph/memgraph" -cert_dir="" container_name="" # Parse flags @@ -242,9 +241,6 @@ if [ "$use_docker" = true ]; then docker stop $container_name > /dev/null 2>&1 code_mg=$? docker rm $container_name > /dev/null 2>&1 - if [ -n "$cert_dir" ]; then - rm -rf $cert_dir - fi else kill $pid wait -n From bbcd92b33c77b6162c4833c858a9eff311349230 Mon Sep 17 00:00:00 2001 From: Matt James Date: Sun, 8 Feb 2026 11:08:47 +0000 Subject: [PATCH 28/34] try install on macos --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 780940a1..477095e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,6 +95,7 @@ jobs: run: | cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release . cmake --build build + sudo cmake --install build - name: Save mgconsole MacOS build uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 From 6c4c268953ad09107bcfce017914a42d9414416b Mon Sep 17 00:00:00 2001 From: Matt James Date: Sun, 8 Feb 2026 11:12:04 +0000 Subject: [PATCH 29/34] update workflow --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 477095e7..dade3a92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,7 +93,7 @@ jobs: - name: Build mgconsole run: | - cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release . + cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local . cmake --build build sudo cmake --install build From 322e6fee500dd93aa98284be9fce4fec644da05e Mon Sep 17 00:00:00 2001 From: Matt James Date: Sun, 8 Feb 2026 11:21:41 +0000 Subject: [PATCH 30/34] update CML to install to /usr/local on macos --- .github/workflows/ci.yml | 2 +- CMakeLists.txt | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dade3a92..477095e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,7 +93,7 @@ jobs: - name: Build mgconsole run: | - cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local . + cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release . cmake --build build sudo cmake --install build diff --git a/CMakeLists.txt b/CMakeLists.txt index 0834b715..a81f2e31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,11 +33,16 @@ string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) # Enable explicit static linking of SSL because of generic Linux binary. set(MGCONSOLE_STATIC_SSL OFF CACHE STRING "Statically link SSL") -# Set default installation directory to '/usr' +# Set default installation directory if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - # '/usr' is a special case, for more details see: - # https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#special-cases - set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "install dir" FORCE) + if(APPLE) + # On macOS, use /usr/local as /usr/bin is protected by SIP + set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "install dir" FORCE) + else() + # '/usr' is a special case, for more details see: + # https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#special-cases + set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "install dir" FORCE) + endif() endif() add_subdirectory(src) From aafed9bcf140b509dbeec55ab15515978be93202 Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 9 Feb 2026 10:02:12 +0000 Subject: [PATCH 31/34] fix typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 477095e7..f93d809c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ on: push: workflow_dispatch: inputs: - buil-static: + build-static: description: "Build static version of mgconsole" type: boolean required: false From 9141fbf01b87b301a49f85f53f2a8a4bb1e29b45 Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 9 Feb 2026 11:21:29 +0000 Subject: [PATCH 32/34] try creating universal binary --- .github/workflows/ci.yml | 65 ++++++++++++++++++++++++++++++++--- .github/workflows/release.yml | 2 +- 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f93d809c..2578eaf1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,9 +77,9 @@ jobs: name: "mgconsole Windows build" path: build/src/mgconsole.exe - build_apple: - name: Build and test mgconsole on Apple - runs-on: macos-latest + build_apple_arm64: + name: Build and test mgconsole on Apple ARM64 + runs-on: macos-15 steps: - name: Set-up repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -100,9 +100,66 @@ jobs: - name: Save mgconsole MacOS build uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: - name: "mgconsole MacOS build" + name: "mgconsole MacOS build ARM64" path: build/src/mgconsole + build_apple_x86_64: + name: Build and test mgconsole on Apple X86_64 + runs-on: macos-15-intel + steps: + - name: Set-up repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + # NOTE: CI can't execute end2end tests because there is no way to run + # Memgraph on CI MacOS machines. + + - name: Install openssl + run: | + brew update + brew install openssl + + - name: Build mgconsole + run: | + cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release . + cmake --build build + sudo cmake --install build + + - name: Save mgconsole MacOS build + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + with: + name: "mgconsole MacOS build X86_64" + path: build/src/mgconsole + + + build_apple_universal: + name: Build Apple universal binary (ARM64 and X86_64) + runs-on: macos-15 + steps: + - name: Set-up repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Download artifacts Apple ARM64 + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 + with: + name: "mgconsole MacOS build ARM64" + path: temp-macos-arm64 + + - name: Download artifacts Apple X86_64 + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 + with: + name: "mgconsole MacOS build X86_64" + path: temp-macos-x86_64 + + - name: Organize binaries + run: | + mkdir -p macos + lipo -create temp-macos-arm64/mgconsole temp-macos-x86_64/mgconsole -output macos/mgconsole + + - name: Save mgconsole MacOS universal build + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + with: + name: "mgconsole MacOS universal build" + path: macos/mgconsole + build_and_test_static: if: ${{ inputs.build-static }} name: Build and test mgconsole static build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 064f10b4..c7197a41 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -111,7 +111,7 @@ jobs: - name: Download artifacts MacOS uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: - name: "mgconsole MacOS build" + name: "mgconsole MacOS universal build" path: temp-macos - name: Download artifacts Windows From 6938797a8b1c4909d86ead4721c021e70e1dd23e Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 9 Feb 2026 11:22:38 +0000 Subject: [PATCH 33/34] fix workflow --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2578eaf1..ff7fbed7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -131,6 +131,7 @@ jobs: build_apple_universal: + needs: [build_apple_arm64, build_apple_x86_64] name: Build Apple universal binary (ARM64 and X86_64) runs-on: macos-15 steps: @@ -154,6 +155,10 @@ jobs: mkdir -p macos lipo -create temp-macos-arm64/mgconsole temp-macos-x86_64/mgconsole -output macos/mgconsole + - name: List architecture of the binary + run: | + lipo -info macos/mgconsole + - name: Save mgconsole MacOS universal build uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: From 55ed25b53c3ffbc0a0ae3e42570230dd0d879f3e Mon Sep 17 00:00:00 2001 From: matt Date: Mon, 9 Feb 2026 11:27:58 +0000 Subject: [PATCH 34/34] rename workflow --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c7197a41..3c0ba3b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,10 @@ -name: Build and Release mgconsole Docker Image +name: Build and Release mgconsole on: workflow_dispatch: inputs: version: - description: "Version of the Docker image to publish." + description: "Version of the mgconsole to publish." required: true default: "0.0.1" force_release: