Skip to content

ci: actualize osx testing workflow #119

ci: actualize osx testing workflow

ci: actualize osx testing workflow #119

Workflow file for this run

name: OS X testing
on: [push, pull_request]
# TODO: Use caching of fixed tarantool versions or improve
# setup-tarantool to use it here.
jobs:
testing_mac_os:
# We want to run on external PRs, but not on our own internal
# PRs as they'll be run by the push to the branch.
#
# The main trick is described here:
# https://github.com/Dart-Code/Dart-Code/pull/2375
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
runs-on:
- macos-13
tarantool:
- brew
- 2.11.6
- 3.2.1
- 3.3.1
- master
env:
# Make sense only for non-brew jobs.
#
# Set as absolute paths to avoid any possible confusion
# after changing a current directory.
T_VERSION: ${{ matrix.tarantool }}
T_SRCDIR: ${{ format('{0}/tarantool-{1}', github.workspace, matrix.tarantool) }}
T_DESTDIR: ${{ format('{0}/tarantool-{1}-dest', github.workspace, matrix.tarantool) }}
SRCDIR: ${{ format('{0}/{1}', github.workspace, github.repository) }}
runs-on: ${{ matrix.runs-on }}
steps:
- name: Install latest tarantool from brew
run: brew install tarantool
if: matrix.tarantool == 'brew'
- name: Setup python3 for tests
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache built tarantool ${{ env.T_VERSION }}
uses: actions/cache@v4
id: cache
with:
path: ${{ env.T_DESTDIR }}
key: ${{ matrix.runs-on }}-${{ matrix.tarantool }}
if: matrix.tarantool != 'brew' && matrix.tarantool != 'master'
- name: Install tarantool build dependencies
run: brew install autoconf automake libtool [email protected]
if: matrix.tarantool != 'brew' && steps.cache.outputs.cache-hit != 'true'
- name: Clone tarantool ${{ env.T_VERSION }}
uses: actions/checkout@v4
with:
repository: tarantool/tarantool
ref: ${{ env.T_VERSION }}
path: ${{ env.T_SRCDIR }}
submodules: true
# fetch-depth is 1 by default and it is okay for
# building from a tag. However we have master in
# the version list.
fetch-depth: 0
if: matrix.tarantool != 'brew' && steps.cache.outputs.cache-hit != 'true'
- name: Build tarantool ${{ env.T_VERSION }} from sources
run: |
mkdir "${T_DESTDIR}"
cd "${T_SRCDIR}"
# Set RelWithDebInfo just to disable -Werror.
#
# There are tarantool releases on which AppleClang
# complains about the problem that was fixed later in
# https://github.com/tarantool/tarantool/commit/7e8688ff8885cc7813d12225e03694eb8886de29
#
# Set OpenSSL root directory for linking tarantool with OpenSSL of version 1.1
# This is related to #49. There are too much deprecations which affect the build and tests.
# Must be revisited after fixing https://github.com/tarantool/tarantool/issues/6477
#
# Added -DENABLE_DIST=ON in case of tarantoolctl abcense in destdir.
# Fixes not-brew tarantool build on Mac OS
cmake . -DENABLE_DIST=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENSSL_ROOT_DIR=/usr/local/opt/[email protected] -DOPENSSL_LIBRARIES=/usr/local/opt/[email protected]/lib
# {{{ Workaround Mac OS build failure (gh-6076)
#
# https://github.com/tarantool/tarantool/issues/6076
#
# In brief: when "src/lib/small" is in include paths,
# `#include <version>` from inside Mac OS SDK headers
# attempts to include "src/lib/small/VERSION" as a
# header file that leads to a syntax error.
#
# It was fixed in the following commits:
#
# * 1.10.10-24-g7bce4abd1
# * 2.7.2-44-gbb1d32903
# * 2.8.1-56-ga6c29c5af
# * 2.9.0-84-gc5ae543f3
#
# However applying the workaround for all versions looks
# harmless.
#
# Added -f just in case: I guess we'll drop this useless
# obsoleted VERSION file from the git repository sooner
# or later.
rm -f src/lib/small/VERSION
# The same as above, but for the VERSION file generated
# by tarantool's CMake script.
rm VERSION
# }}} Workaround Mac OS build failure (gh-6076)
# Continue the build.
make -j$(sysctl -n hw.logicalcpu)
make DESTDIR="${T_DESTDIR}" install
if: matrix.tarantool != 'brew' && steps.cache.outputs.cache-hit != 'true'
- name: Export TARANTOOL_DIR and PATH
run: |
printf '%s=%s\n' TARANTOOL_DIR "${T_DESTDIR}/usr/local" >> "${GITHUB_ENV}"
printf '%s\n' "${T_DESTDIR}/usr/local/bin" >> "${GITHUB_PATH}"
if: matrix.tarantool != 'brew'
- name: Verify tarantool version
run: |
# Workaround https://github.com/tarantool/tarantool/issues/4983
# Workaround https://github.com/tarantool/tarantool/issues/5040
tarantool -e "require('fiber').sleep(0) assert(_TARANTOOL:startswith('${T_VERSION}'), _TARANTOOL) os.exit()"
if: matrix.tarantool != 'brew' && matrix.tarantool != 'master'
- name: Clone the connector
uses: actions/checkout@v4
with:
path: ${{ env.SRCDIR }}
# Needed because of tarantool-c dependence on submodules
submodules: recursive
fetch-depth: 0
- name: Build the connector
run: |
cd "${SRCDIR}"
cmake . && make
- name: Install testing dependencies
run: |
cd "${SRCDIR}"
pip3 install PyYAML gevent==22.10.2
- name: Run tests
run: |
cd "${SRCDIR}"
ulimit -n 4096
make test