Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all OS builds #66

Merged
merged 10 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ jobs:
build_and_test_apple:
strategy:
matrix:
platform: [macos-11]
platform: [macos-14]
runs-on: ${{ matrix.platform }}
env:
MG_VERSION: "1.4.0"
steps:
- name: Set-up repository
uses: actions/checkout@v2
Expand All @@ -42,7 +40,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
env:
VCPKG_ROOT: "${{ github.workspace }}\\vcpkg"
deps: "openssl:x64-windows"
Expand Down Expand Up @@ -78,8 +76,8 @@ jobs:
build_and_test_linux:
strategy:
matrix:
platform: [ubuntu-20.04, ubuntu-22.04]
mgversion: ["2.0.0", "2.3.0"]
platform: [ubuntu-24.04]
mgversion: ["2.19.0"]
packages: ["gcc g++ clang"]
gcc-postfix: [""]
clang-postfix: [""]
Expand All @@ -100,11 +98,11 @@ jobs:
if: steps.cache-memgraph-docker.outputs.cache-hit != 'true'
run: |
mkdir ~/memgraph
curl -L https://memgraph.com/download/memgraph/v${{ matrix.mgversion }}/docker/memgraph-${{ matrix.mgversion }}-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz
curl -L https://download.memgraph.com/memgraph/v${{ matrix.mgversion }}/docker/memgraph-${{ matrix.mgversion }}-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz
- name: Load and run Memgraph Docker image
run: |
docker load -i ~/memgraph/memgraph-docker.tar.gz
docker run -d -p 7687:7687 memgraph --telemetry-enabled=false
docker run -d -p 7687:7687 memgraph/memgraph --telemetry-enabled=false
- name: Build with gcc, test and install mgclient
run: |
mkdir build-gcc && cd build-gcc
Expand All @@ -128,11 +126,11 @@ jobs:
# Memgraph has to be started manually because systemd is not available on
# WSL (init process does not exist).
build_and_test_windows_mingw:
runs-on: windows-2019
runs-on: windows-2022
strategy:
matrix:
include: [
{ msystem: MINGW64, arch: x86_64, mgversion: "1.4.0" }
{ msystem: MINGW64, arch: x86_64, mgversion: "2.19.0" }
]
defaults:
run:
Expand All @@ -147,14 +145,15 @@ jobs:
install: git base-devel mingw-w64-${{ matrix.arch }}-toolchain mingw-w64-${{ matrix.arch }}-cmake mingw-w64-${{ matrix.arch }}-openssl
- uses: Vampire/setup-wsl@v1
with:
distribution: Ubuntu-18.04
distribution: Ubuntu-22.04
- name: Download, install and run Memgraph under WSL
shell: wsl-bash {0} # root shell
run: |
mkdir ~/memgraph
curl -L https://download.memgraph.com/memgraph/v${{matrix.mgversion}}/ubuntu-18.04/memgraph_${{matrix.mgversion}}-community-1_amd64.deb --output ~/memgraph/memgraph-community.deb
dpkg -i ~/memgraph/memgraph-community.deb
nohup /usr/lib/memgraph/memgraph --bolt-port 7687 --bolt-cert-file="" --bolt-key-file="" --data-directory="~/memgraph/data" --storage-properties-on-edges=true --storage-snapshot-interval-sec=0 --storage-wal-enabled=false --storage-recover-on-startup=false --storage-snapshot-on-exit=false --telemetry-enabled=false --log-file='' &
# https://download.memgraph.com/memgraph/v2.19.0/ubuntu-24.04/memgraph_2.19.0-1_amd64.deb
curl -L https://download.memgraph.com/memgraph/v${{matrix.mgversion}}/ubuntu-22.04/memgraph_${{matrix.mgversion}}-1_amd64.deb --output ~/memgraph/memgraph.deb
dpkg -i ~/memgraph/memgraph.deb
nohup /usr/lib/memgraph/memgraph --bolt-port 7687 --bolt-cert-file="" --bolt-key-file="" --data-directory="~/memgraph/data" --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 --log-file='' &
sleep 1 # Wait for Memgraph a bit.
- name: Build and test mgclient
run: |
Expand All @@ -167,7 +166,7 @@ jobs:
build_and_test_linux_wasm:
strategy:
matrix:
platform: [ubuntu-20.04]
platform: [ubuntu-24.04]
runs-on: ${{ matrix.platform }}
steps:
- name: Set-up repository
Expand Down
10 changes: 5 additions & 5 deletions include/mgclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,17 @@ extern "C" {
/// Client software version.
///
/// \return Client version in the major.minor.patch format.
MGCLIENT_EXPORT const char *mg_client_version();
MGCLIENT_EXPORT const char *mg_client_version(void);

/// Initializes the client (the whole process).
/// Should be called at the beginning of each process using the client.
///
/// \return Zero if initialization was successful.
MGCLIENT_EXPORT int mg_init();
MGCLIENT_EXPORT int mg_init(void);

/// Finalizes the client (the whole process).
/// Should be called at the end of each process using the client.
MGCLIENT_EXPORT void mg_finalize();
MGCLIENT_EXPORT void mg_finalize(void);

/// An enum listing all the types as specified by Bolt protocol.
enum mg_value_type {
Expand Down Expand Up @@ -297,7 +297,7 @@ typedef struct mg_point_3d mg_point_3d;
/// Constructs a nil \ref mg_value.
///
/// \return Pointer to the newly constructed value or NULL if error occurred.
MGCLIENT_EXPORT mg_value *mg_value_make_null();
MGCLIENT_EXPORT mg_value *mg_value_make_null(void);

/// Constructs a boolean \ref mg_value.
///
Expand Down Expand Up @@ -1221,7 +1221,7 @@ typedef int (*mg_trust_callback_type)(const char *, const char *, const char *,
const char *, void *);

/// Creates a new `mg_session_params` object.
MGCLIENT_EXPORT mg_session_params *mg_session_params_make();
MGCLIENT_EXPORT mg_session_params *mg_session_params_make(void);

/// Destroys a `mg_session_params` object.
MGCLIENT_EXPORT void mg_session_params_destroy(mg_session_params *);
Expand Down
8 changes: 3 additions & 5 deletions src/apple/mgsocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#include <string.h>

#include "mgcommon.h"

#define MG_RETRY_ON_EINTR(expression) \
__extension__({ \
long result; \
Expand All @@ -27,7 +25,7 @@
result; \
})

int mg_socket_init() { return MG_SUCCESS; }
int mg_socket_init(void) { return MG_SUCCESS; }

int mg_socket_create(int af, int type, int protocol) {
int sockfd = socket(af, type, protocol);
Expand Down Expand Up @@ -92,6 +90,6 @@ int mg_socket_pair(int d, int type, int protocol, int *sv) {

int mg_socket_close(int sock) { return MG_RETRY_ON_EINTR(close(sock)); }

char *mg_socket_error() { return strerror(errno); }
char *mg_socket_error(void) { return strerror(errno); }

void mg_socket_finalize() {}
void mg_socket_finalize(void) {}
8 changes: 3 additions & 5 deletions src/linux/mgsocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include <stdlib.h>
#include <string.h>

#include "mgcommon.h"

#ifdef __EMSCRIPTEN__
#include "emscripten.h"
#include "mgwasm.h"
Expand All @@ -36,7 +34,7 @@
// Please refer to https://man7.org/linux/man-pages/man2 for more details about
// Linux system calls.

int mg_socket_init() { return MG_SUCCESS; }
int mg_socket_init(void) { return MG_SUCCESS; }

int mg_socket_create(int af, int type, int protocol) {
int sockfd = socket(af, type, protocol);
Expand Down Expand Up @@ -151,6 +149,6 @@ int mg_socket_pair(int d, int type, int protocol, int *sv) {

int mg_socket_close(int sock) { return MG_RETRY_ON_EINTR(close(sock)); }

char *mg_socket_error() { return strerror(errno); }
char *mg_socket_error(void) { return strerror(errno); }

void mg_socket_finalize() {}
void mg_socket_finalize(void) {}
10 changes: 5 additions & 5 deletions src/mgclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#include "mgtransport.h"
#include "mgvalue.h"

const char *mg_client_version() { return MGCLIENT_VERSION; }
const char *mg_client_version(void) { return MGCLIENT_VERSION; }

int mg_init_session_static_vars() {
int mg_init_session_static_vars(void) {
mg_value *n_val = mg_value_make_integer(-1);
if (!n_val) {
goto fatal_failure;
Expand All @@ -55,13 +55,13 @@ int mg_init_session_static_vars() {
return MG_ERROR_CLIENT_ERROR;
}

int mg_init() {
int mg_init(void) {
int init_status = mg_init_session_static_vars();
if (init_status != 0) return init_status;
return mg_socket_init();
}

void mg_finalize() { mg_socket_finalize(); }
void mg_finalize(void) { mg_socket_finalize(); }

typedef struct mg_session_params {
const char *address;
Expand All @@ -78,7 +78,7 @@ typedef struct mg_session_params {
void *trust_data;
} mg_session_params;

mg_session_params *mg_session_params_make() {
mg_session_params *mg_session_params_make(void) {
mg_session_params *params =
mg_allocator_malloc(&mg_system_allocator, sizeof(mg_session_params));
if (!params) {
Expand Down
6 changes: 3 additions & 3 deletions src/mgsocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef long ssize_t;

/// Initializes underlying resources. Has to be called at the beginning of a
/// process using socket resources.
int mg_socket_init();
int mg_socket_init(void);

/// Returns a descriptor referencing the new socket or MG_ERROR_SOCKET in the
/// case of any failure.
Expand Down Expand Up @@ -110,11 +110,11 @@ int mg_socket_close(int sock);

/// Used to get a native error message after some socket call fails.
/// Has to be called immediately after the failed socket function.
char *mg_socket_error();
char *mg_socket_error(void);

/// Should be called at the end of any process which previously called the
/// \ref mg_socket_init function.
void mg_socket_finalize();
void mg_socket_finalize(void);

#ifdef __cplusplus
}
Expand Down
4 changes: 1 addition & 3 deletions src/mgtransport.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "mgtransport.h"

#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#ifdef MGCLIENT_ON_LINUX
Expand All @@ -26,7 +25,6 @@

#include "mgallocator.h"
#include "mgclient.h"
#include "mgcommon.h"
#include "mgsocket.h"
#ifdef __EMSCRIPTEN__
#include "mgwasm.h"
Expand Down Expand Up @@ -160,7 +158,7 @@ static char *hex_encode(unsigned char *data, unsigned int len,
return encoded;
}

static void mg_openssl_init() {
static void mg_openssl_init(void) {
#if OPENSSL_VERSION_NUMBER < 0x10100000L
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static int mg_ssl_initialized = 0;
Expand Down
3 changes: 1 addition & 2 deletions src/mgvalue.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include "mgallocator.h"
#include "mgclient.h"
#include "mgconstants.h"

mg_string *mg_string_alloc(uint32_t size, mg_allocator *allocator) {
char *block = mg_allocator_malloc(allocator, sizeof(mg_string) + size);
Expand Down Expand Up @@ -178,7 +177,7 @@ mg_point_3d *mg_point_3d_alloc(mg_allocator *allocator) {
return point_3d;
}

mg_value *mg_value_make_null() {
mg_value *mg_value_make_null(void) {
mg_value *value = mg_allocator_malloc(&mg_system_allocator, sizeof(mg_value));
if (!value) {
return NULL;
Expand Down
Loading