Skip to content
Closed
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
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: sparrow-ci-workflow
on:
# Triggers the pipeline on push, on PRs to "main", manually
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+**'
- '![0-9]+.[0-9]+.[0-9]+-DBG**'
workflow_dispatch:

env:
DEBUG: ${{ contains(github.ref_name, 'DBG') }}
MODE: ${{ contains(github.ref_name, 'DBG') && 'debug' || 'release' }}

jobs:
build-job-lnx8-x64:
needs: []
runs-on: ubuntu-latest
container:
image: ghcr.io/infovista-opensource/mysql-server-timeseries-builder-images/mysql8-build-lnx8:0.48
# volumes:
# - /data/conan:/data/conan

steps:
- name: Cache Conan packages
uses: actions/cache@v4
with:
key: ${{ runner.os }}-lnx8-x64
path: /data/conan

- uses: actions/checkout@v4

- name: Building binaries
shell: bash
env:
CI_COMMIT_TAG: ${{ github.ref_name }}
run: |
echo "Working folder `pwd`"
echo "Build mode is ${{ env.MODE }}"
env | sort
ls -l
echo "Conan package folder contains: `ls -l /data/conan`"
conan search
chmod a+x build_scripts/linux/build-linux-github.sh
build_scripts/linux/build-linux-github.sh ${{ env.MODE }}

- name: Uploading binaries
uses: actions/upload-artifact@v4
with:
name: lnx8-x64-binaries
path: |
_distrib/lnx8_64/*.tar.gz
**/*.log

- name: Uploading release assets
uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["_distrib/lnx8_64/*.tar.gz"]'
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ scalability_jobs_*
.cproject
.project
.settings/

*.bak

_build/
_distrib/
**generatorfiles*
18 changes: 18 additions & 0 deletions build_scripts/conan/conanfile.mysqlapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from conans import ConanFile, tools


class MysqlapiConan(ConanFile):
name = "mysqlapi"
version = "5.6.46-42010-SPW-000"
settings = "os", "compiler", "build_type", "arch"
description = "Mysql client API"
url = "None"
license = "None"
author = "None"
topics = None

def package(self):
self.copy("*")

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
18 changes: 18 additions & 0 deletions build_scripts/conan/conanfile.sparrowapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from conans import ConanFile, tools


class SparrowapiConan(ConanFile):
name = "sparrowapi"
version = "5.6.46-42010-SPW-000"
settings = "os", "compiler", "build_type", "arch"
description = "Sparrow client API"
url = "None"
license = "None"
author = "None"
topics = None

def package(self):
self.copy("*")

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
79 changes: 79 additions & 0 deletions build_scripts/conan/lnx_64/conan_download_pckgs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

# Arguments

# SCRIPT_DIR=$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )
# echo `date +"%x %X"` Script directory is $SCRIPT_DIR

echo `date +"%x %X"` Initial directory `pwd`

REDHAT_VERSION=`sed -e 's/.*release \([0-9]*\).*/\1/' /etc/redhat-release`
echo `date +"%x %X"` "Running on RedHat version $REDHAT_VERSION"

GCC_VERSION=`gcc --version | head -n1 | sed -e 's/.*(GCC) \([0-9].[0-9]*\).*/\1/'`
echo `date +"%x %X"` "gcc version is $GCC_VERSION"

PYTHON3_EXISTS=`which python3 2> /dev/null | wc -l`
if [ $PYTHON3_EXISTS -lt 1 ]; then
echo `date +"%x %X"` "python3 is required for conan, but it does not seem to be installed. Aborting."
exit 1
fi

PYTHON_EXISTS=`which python 2> /dev/null | wc -l`
if [ $PYTHON_EXISTS -ge 1 ]; then
PYTHON_VERSION=`python --version 2>&1 | sed -e 's/.*Python \([0-9]\).*/\1/'`
echo `date +"%x %X"` "python version is $PYTHON_VERSION"

if [ "$PYTHON_VERSION" == "2" ]; then
echo `date +"%x %X"` To use conan, link /usr/bin/python to /usr/bin/python3
rm -f /usr/bin/python
ln -s /usr/bin/python3 /usr/bin/python
elif [ "$PYTHON_VERSION" != "3" ]; then
echo `date +"%x %X"` Unknown version of python, $PYTHON_VERSION. Aborting
exit 1
fi
fi


# Import third party libs from conan and set env variables to point to the downloaded libraries

echo `date +"%x %X"` Fetching third party librairies from conan

export PATH=$PATH:/opt/cmake/bin

# Be sure the conanfile.txt contains the generator compiler_args
generator_folder=generatorfiles_lnx${REDHAT_VERSION}
rm -Rf $generator_folder; mkdir $generator_folder
conan install -pr profile.txt --build missing conanfile.txt -if $generator_folder -s compiler.version="$GCC_VERSION"

if [[ $? -ne 0 ]]; then
echo `date +"%x %X"` Error: conan install failed. Aborting.
exit 1
fi

echo `date +"%x %X"` Setting environment variables pointing to librairies

SSLDIR=`grep -m 1 'openssl.*include$' $generator_folder/conanbuildinfo.txt`
SSLDIR=${SSLDIR%/*}
if [ -z "${SSLDIR}" ]; then
echo `date +"%x %X"` Error: opennssl library has not been downloaded. Aborting.
exit 1
fi
export SSLDIR
echo "Openssl dir $SSLDIR"

BOOSTDIR=`grep -m 1 'boost.*include$' $generator_folder/conanbuildinfo.txt`
BOOSTDIR=${BOOSTDIR%/*}
if [ -z "${BOOSTDIR}" ]; then
echo `date +"%x %X"` Error: boost library has not been downloaded. Aborting.
exit 1
fi
export BOOSTDIR
echo "Boost dir $BOOSTDIR"


if [ "$PYTHON_VERSION" == "2" ]; then
echo `date +"%x %X"` Set the link /usr/bin/python back to /usr/bin/python2
rm -f /usr/bin/python
ln -s /usr/bin/python2 /usr/bin/python
fi
7 changes: 7 additions & 0 deletions build_scripts/conan/lnx_64/conanfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[requires]
openssl/1.1.1s
boost/1.77.0

[generators]
compiler_args

15 changes: 15 additions & 0 deletions build_scripts/conan/lnx_64/profile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.libcxx=libstdc++11
build_type=Release

[options]

[build_requires]

[env]

96 changes: 96 additions & 0 deletions build_scripts/linux/build-linux-github.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/bin/bash

# Arg 1: Build type: release or debug. Default is release
# Arg 3: What to do. If set "extract_only", then the source code is downloaded and extracted, but the build is not launched.
# If set to "do_not_build", the build process will go one step further. It will download the conan packages and execute cmake.
# If not set ot left empty, the build process will execute completely. That's the default.

# Required environmeent variables
# REPO_USER: User name to use to clone repo where MySQL / Sparrow source is stored
# REPO_PSSWD: Password / token to use to clone repo where MySQL / Sparrow source is stored
# REPO_BRANCH: Branch to check out

# if [[ -z "$REPO_USER" || -z "$REPO_PSSWD" ]] ; then
# echo "Env variable REPO_USER and REPO_PSSWD need to be define and give the credentials to the opensource repository."
# exit 1
# fi

# if [ -z "$REPO_BRANCH" ] ; then
# REPO_BRANCH=8.0
# fi
# echo `date +"%x %X"` Building branch $REPO_BRANCH

BUILD_MODE=release
if [ "$1" == "debug" ] ; then
BUILD_MODE=debug
fi
echo `date +"%x %X"` Build mode is $BUILD_MODE

OPTIONS=$2
# EXTRACT_ONLY=false
# if [ "$OPTIONS" == "extract_only" ] ; then
# EXTRACT_ONLY=true
# fi
# echo "EXTRACT_ONLY is $EXTRACT_ONLY"

if [ -z "$CI_COMMIT_TAG" ]; then
echo "Env variable CI_COMMIT_TAG is empty or not defined. It must be set to a valid tag values, such as 4.2.123 or 4.2.123-spw-287."
exit 1
fi

SCRIPT_NAME=$(basename "$0")
SCRIPT_DIR=$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )
echo `date +"%x %X"` "$SCRIPT_NAME directory: $SCRIPT_DIR"

# Setting execution rights on scripts
echo `date +"%x %X"` Set file rights to additional build scripts
chmod +x $SCRIPT_DIR/*.sh $SCRIPT_DIR/../misc/*.sh $SCRIPT_DIR/../conan/lnx_64/*.sh

# Importing helper functions
# source $SCRIPT_DIR/../misc/misc_functions.sh

# Set the source root folder as working folder.
cd $SCRIPT_DIR/../..;
SOURCE_ROOT_FOLDER=`pwd`
echo `date +"%x %X"` "Source root folder is $SOURCE_ROOT_FOLDER"

# Tag must look like 4.2.123 (without patch), 4.2.123-spw-287-b (with patch)
# Full version (i.e. major.minor.build)
FULL_VERSION=`echo ${CI_COMMIT_TAG} | sed -n 's/\([0-9.]*\).*/\1/p'`
PATCH_VERSION=`echo ${CI_COMMIT_TAG} | sed -n 's/[0-9.]*-\(.*\)/\1/p'`

echo "FULL_VERSION is $FULL_VERSION"

SPW_BUILD_VERSION=`echo ${FULL_VERSION} | cut -d '.' -f 1,2`
SPW_BUILD_VERSION_MAJOR=`echo ${FULL_VERSION} | cut -d '.' -f 1`
SPW_BUILD_VERSION_MINOR=`echo ${FULL_VERSION} | cut -d '.' -f 2`
SPW_BUILD_VERSION_BUILD=`echo ${FULL_VERSION} | cut -d '.' -f 3`
SPW_BUILD_VERSION_FULL=${FULL_VERSION}
SPW_BUILD_VERSION_PATCH=${PATCH_VERSION}
echo "SPW_BUILD_VERSION is $SPW_BUILD_VERSION ($SPW_BUILD_VERSION_MAJOR.$SPW_BUILD_VERSION_MINOR.$SPW_BUILD_VERSION_BUILD)"
echo "SPW_BUILD_VERSION_PATCH is $SPW_BUILD_VERSION_PATCH"

export SPW_BUILD_VERSION SPW_BUILD_VERSION_MAJOR SPW_BUILD_VERSION_MINOR SPW_BUILD_VERSION_BUILD SPW_BUILD_VERSION_FULL SPW_BUILD_VERSION_PATCH

if [ -z "${SPW_BUILD_VERSION_PATCH}" ]; then
echo `date +"%x %X"` Building sparrow $SPW_BUILD_VERSION_FULL, build mode $BUILD_MODE
else
echo `date +"%x %X"` Building sparrow $SPW_BUILD_VERSION_FULL, patch $SPW_BUILD_VERSION_PATCH, build mode $BUILD_MODE
fi

# git clone -b $REPO_BRANCH https://${REPO_USER}:${REPO_PSSWD}@github.com/infovista-opensource/mysql-server-timeseries.git .

# echo `date +"%x %X"` Build and distribution folders
# mkdir -p _build
# mkdir -p _distrib

# if [ "$EXTRACT_ONLY" = true ]; then
# echo "Code has been extracted."
# exit 0
# fi

echo `date +"%x %X"` Executing script to compile source code and make packages, $SOURCE_ROOT_FOLDER/build/mysql/compile-package-linux.sh
# $SCRIPT_DIR/compile-package-linux.sh $SOURCE_ROOT_FOLDER $CI_COMMIT_TAG $BUILD_MODE $OPTIONS
$SCRIPT_DIR/compile-package-linux.sh $CI_COMMIT_TAG $BUILD_MODE $OPTIONS

echo `date +"%x %X"` Done
Loading