Skip to content

Commit c8b3d3b

Browse files
authored
Build and CI improvements for version 1.5.0 (#91)
- Bump version to `1.5.0`. - Updated dockerfile to use latest Debian (Trixie) for building and "distroless" image for the final build -> reduces image size from ~30 MB to 11MB (compressed). - Updated CI workflow to use most recent OSes for building and testing. - Upgraded Release workflow to create a draft GitHub release, build binaries, upload binaries to both S3 and the GitHub release. - Modified test script to be able to test against the latest Memgraph container image, rather than a fixed deb package. - Updated CMLs to allow building with `ninja-build` and updated build instructions to use `cmake` rather than `make`. - Corrected spatial test results. - Updated `build-generic-linux.sh` script to use the latest mgbuild images with the oldest libc versions for the static binary builds: for x86_64 we build in CentOS 9 (libc: 2.34) and on aarch64 we build in Debian 12 (libc 2.36). - Update default install directory to `/usr/local` for macOS.
1 parent e0f7c6e commit c8b3d3b

File tree

13 files changed

+601
-211
lines changed

13 files changed

+601
-211
lines changed

.github/workflows/ci.yml

Lines changed: 157 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -3,118 +3,204 @@ name: CI
33
on:
44
push:
55
workflow_dispatch:
6+
inputs:
7+
build-static:
8+
description: "Build static version of mgconsole"
9+
type: boolean
10+
required: false
11+
default: false
12+
workflow_call:
13+
inputs:
14+
build-static:
15+
description: "Build static version of mgconsole"
16+
type: boolean
17+
required: false
18+
default: false
619

7-
env:
8-
OFFICIAL: true
20+
run-name: "CI: Build and test mgconsole"
921

1022
jobs:
1123
build_and_test_ubuntu:
12-
strategy:
13-
matrix:
14-
platform: [ubuntu-22.04]
15-
mg_version:
16-
- "2.19.0"
17-
runs-on: ${{ matrix.platform }}
24+
name: Build and test mgconsole on Ubuntu
25+
runs-on: ubuntu-latest
1826
steps:
19-
- name: Set up and check memgraph download link
20-
run: |
21-
mg_version=${{ matrix.mg_version }}
22-
mg_version_short=${mg_version%%-*}
23-
if [ "${{ env.OFFICIAL }}" = "true" ]; then
24-
mg_url="https://download.memgraph.com/memgraph/v${mg_version}/${{ matrix.platform }}/memgraph_${mg_version_short}-1_amd64.deb"
25-
else
26-
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"
27-
fi
28-
echo "Checking Memgraph download link: $mg_url"
29-
if curl --output /dev/null --silent --head --fail $mg_url; then
30-
echo "Memgraph download link is valid"
31-
echo "MEMGRAPH_DOWNLOAD_LINK=${mg_url}" >> $GITHUB_ENV
32-
else
33-
echo "Memgraph download link is not valid"
34-
exit 1
35-
fi
36-
- name: Install dependencies (Ubuntu 22.04)
37-
if: matrix.platform == 'ubuntu-22.04'
27+
- name: Pull latest memgraph image
3828
run: |
39-
sudo apt install -y git cmake make gcc g++ libssl-dev # mgconsole deps
40-
sudo apt install -y libpython3.10 python3-pip # memgraph deps
41-
mkdir ~/memgraph
42-
curl -L ${{ env.MEMGRAPH_DOWNLOAD_LINK }} > ~/memgraph/memgraph_${{ matrix.mg_version }}-1_amd64.deb
43-
sudo systemctl mask memgraph
44-
sudo dpkg -i ~/memgraph/memgraph_${{ matrix.mg_version }}-1_amd64.deb
45-
- uses: actions/checkout@v4
29+
docker pull memgraph/memgraph:latest
30+
echo "MEMGRAPH_IMAGE=memgraph/memgraph:latest" >> $GITHUB_ENV
31+
32+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+
4634
- name: Install and test mgconsole
4735
run: |
48-
mkdir build
49-
cd build
50-
cmake ..
51-
make
52-
sudo make install
53-
ctest --verbose
36+
cmake -B build -G Ninja -DMEMGRAPH_USE_DOCKER=ON -DMEMGRAPH_DOCKER_IMAGE=$MEMGRAPH_IMAGE
37+
cmake --build build
38+
sudo cmake --install build
39+
ctest --verbose --test-dir build
40+
5441
- name: Save mgconsole test results
5542
if: always()
56-
uses: actions/upload-artifact@v4
43+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
5744
with:
5845
name: "mgconsole_ctest.log"
5946
path: build/Testing/Temporary/LastTest.log
6047

6148
build_windows_mingw:
62-
runs-on: windows-2022
63-
strategy:
64-
matrix:
65-
include: [
66-
{ msystem: MINGW64, arch: x86_64 }
67-
]
49+
name: Build and test mgconsole on Windows
50+
runs-on: windows-latest
6851
defaults:
6952
run:
7053
shell: msys2 {0}
7154
steps:
7255
- name: Set-up repository
73-
uses: actions/checkout@v4
74-
- uses: msys2/setup-msys2@v2
56+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
57+
58+
- uses: msys2/setup-msys2@4f806de0a5a7294ffabaff804b38a9b435a73bda # v2.30.0
7559
with:
76-
msystem: ${{ matrix.msystem }}
60+
msystem: MINGW64
7761
update: true
7862
install: >-
7963
git base-devel
80-
mingw-w64-${{ matrix.arch }}-toolchain
81-
mingw-w64-${{ matrix.arch }}-cmake
82-
mingw-w64-${{ matrix.arch }}-openssl
64+
mingw-w64-x86_64-toolchain
65+
mingw-w64-x86_64-cmake
66+
mingw-w64-x86_64-openssl
67+
8368
- name: Build and install mgconsole
8469
run: |
85-
mkdir build
86-
cd build
87-
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..
88-
cmake --build . --parallel
89-
make install
70+
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release .
71+
cmake --build build --parallel
72+
cmake --install build
73+
9074
- name: Save mgconsole Windows build
91-
uses: actions/upload-artifact@v4
75+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
9276
with:
9377
name: "mgconsole Windows build"
9478
path: build/src/mgconsole.exe
9579

96-
build_apple:
97-
strategy:
98-
matrix:
99-
platform: [macos-14]
100-
runs-on: ${{ matrix.platform }}
80+
build_apple_arm64:
81+
name: Build and test mgconsole on Apple ARM64
82+
runs-on: macos-15
83+
steps:
84+
- name: Set-up repository
85+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
86+
# NOTE: CI can't execute end2end tests because there is no way to run
87+
# Memgraph on CI MacOS machines.
88+
89+
- name: Install openssl
90+
run: |
91+
brew update
92+
brew install openssl
93+
94+
- name: Build mgconsole
95+
run: |
96+
cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release .
97+
cmake --build build
98+
sudo cmake --install build
99+
100+
- name: Save mgconsole MacOS build
101+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
102+
with:
103+
name: "mgconsole MacOS build ARM64"
104+
path: build/src/mgconsole
105+
106+
build_apple_x86_64:
107+
name: Build and test mgconsole on Apple X86_64
108+
runs-on: macos-15-intel
101109
steps:
102110
- name: Set-up repository
103-
uses: actions/checkout@v4
111+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
104112
# NOTE: CI can't execute end2end tests because there is no way to run
105113
# Memgraph on CI MacOS machines.
114+
106115
- name: Install openssl
107116
run: |
108117
brew update
109118
brew install openssl
119+
110120
- name: Build mgconsole
111121
run: |
112-
mkdir build
113-
cd build
114-
cmake -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release ..
115-
make
122+
cmake -B build -G Ninja -DOPENSSL_ROOT_DIR="$(brew --prefix openssl)" -DCMAKE_BUILD_TYPE=Release .
123+
cmake --build build
124+
sudo cmake --install build
125+
116126
- name: Save mgconsole MacOS build
117-
uses: actions/upload-artifact@v4
127+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
118128
with:
119-
name: "mgconsole MacOS build"
129+
name: "mgconsole MacOS build X86_64"
120130
path: build/src/mgconsole
131+
132+
133+
build_apple_universal:
134+
needs: [build_apple_arm64, build_apple_x86_64]
135+
name: Build Apple universal binary (ARM64 and X86_64)
136+
runs-on: macos-15
137+
steps:
138+
- name: Set-up repository
139+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
140+
141+
- name: Download artifacts Apple ARM64
142+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
143+
with:
144+
name: "mgconsole MacOS build ARM64"
145+
path: temp-macos-arm64
146+
147+
- name: Download artifacts Apple X86_64
148+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
149+
with:
150+
name: "mgconsole MacOS build X86_64"
151+
path: temp-macos-x86_64
152+
153+
- name: Organize binaries
154+
run: |
155+
mkdir -p macos
156+
lipo -create temp-macos-arm64/mgconsole temp-macos-x86_64/mgconsole -output macos/mgconsole
157+
158+
- name: List architecture of the binary
159+
run: |
160+
lipo -info macos/mgconsole
161+
162+
- name: Save mgconsole MacOS universal build
163+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
164+
with:
165+
name: "mgconsole MacOS universal build"
166+
path: macos/mgconsole
167+
168+
build_and_test_static:
169+
if: ${{ inputs.build-static }}
170+
name: Build and test mgconsole static build
171+
strategy:
172+
fail-fast: false
173+
matrix:
174+
arch: [X64, ARM64]
175+
runs-on: [self-hosted, Linux, "${{ matrix.arch }}" ]
176+
steps:
177+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
178+
179+
- name: build mgconsole static
180+
run: |
181+
./build-generic-linux.sh
182+
183+
- name: Save mgconsole static build
184+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
185+
with:
186+
name: "mgconsole static Linux build ${{ matrix.arch }}"
187+
path: build/generic/mgconsole
188+
189+
- name: Pull latest memgraph image
190+
run: |
191+
docker pull memgraph/memgraph:latest
192+
echo "MEMGRAPH_IMAGE=memgraph/memgraph:latest" >> $GITHUB_ENV
193+
194+
- name: Test mgconsole static build
195+
run: |
196+
./tests/test-static.sh --docker $MEMGRAPH_IMAGE
197+
./tests/test-static.sh --use-ssl --docker $MEMGRAPH_IMAGE
198+
199+
- name: Cleanup docker images
200+
run: |
201+
docker rmi $MEMGRAPH_IMAGE || true
202+
if [[ "${{ matrix.arch }}" == "X64" ]]; then
203+
docker rmi memgraph/mgbuild:v7_centos-9 || true
204+
elif [[ "${{ matrix.arch }}" == "ARM64" ]]; then
205+
docker rmi memgraph/mgbuild:v7_debian-12-arm || true
206+
fi

0 commit comments

Comments
 (0)