Skip to content

Commit

Permalink
Enable GH Actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Mar 24, 2023
1 parent 3337736 commit 08a489e
Show file tree
Hide file tree
Showing 6 changed files with 316 additions and 45 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This is a basic workflow to help you get started with Actions

name: Main CI

# Controls when the action will run.
on:
# Triggers the workflow on all push or pull request events
push:
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
env:
COMPILER: ${{ matrix.compiler }}
BUILD_OS: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-20.04]
compiler: ['gcc', 'clang', 'gcc-9', 'gcc-10', 'clang-9', 'clang-10']
include:
- os: ubuntu-22.04
compiler: 'gcc'
- os: ubuntu-22.04
compiler: 'clang'
- os: ubuntu-22.04
compiler: 'gcc-11'
- os: ubuntu-22.04
compiler: 'gcc-12'
- os: ubuntu-22.04
compiler: 'clang-11'
- os: ubuntu-22.04
compiler: 'clang-12'
- os: ubuntu-22.04
compiler: 'clang-13'
- os: ubuntu-22.04
compiler: 'clang-14'
- os: ubuntu-22.04
compiler: 'clang-15'

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install dependencies
run: sh -x scripts/build/install_depends.sh

- name: Build
run: sh -x scripts/build/do_build.sh

- name: Notify slack fail
if: failure() && github.repository == 'OpenSIPS/opensips'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel: devel
status: FAILED
color: danger
139 changes: 94 additions & 45 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,97 @@
language: c
compiler:
- gcc
- clang
sudo: false
os: linux
dist: bionic
addons:
apt:
packages:
- flex
- bison
- libsqlite3-dev
- libsctp-dev
- libradcli-dev
- libhiredis-dev
- unixodbc-dev
- libconfuse-dev
- libmysqlclient-dev
- libexpat1-dev
- libxml2-dev
- libpq-dev
- zlib1g-dev
- libperl-dev
- libsnmp-dev
- libdb-dev
- libldap2-dev
- libcurl4-gnutls-dev
- libgeoip-dev
- libpcre3-dev
- libmemcached-dev
- libmicrohttpd-dev
- librabbitmq-dev
- liblua5.1-0-dev
- libncurses5-dev
- libjson0-dev
- uuid-dev
# - libjwt-dev
script: CC_EXTRA_OPTS=-Werror FASTER=1 NICER=0 make \
exclude_modules="db_oracle osp sngtc cachedb_cassandra cachedb_couchbase cachedb_mongodb auth_jwt" all
apt:
packages:
- flex
- bison
- libsqlite3-dev
- libsctp-dev
- libradcli-dev
- libhiredis-dev
- libodbc1=2.3.7
- odbcinst=2.3.7
- odbcinst1debian2=2.3.7
- unixodbc=2.3.7
- unixodbc-dev=2.3.7
- libconfuse-dev
- libmysqlclient-dev
- libexpat1-dev
- libxml2-dev
- libpq-dev
- zlib1g-dev
- libperl-dev
- libsnmp-dev
- libdb-dev
- libldap2-dev
- libcurl4-gnutls-dev
- libgeoip-dev
- libpcre3-dev
- libmemcached-dev
- libmicrohttpd-dev
- librabbitmq-dev
- liblua5.1-0-dev
- libncurses5-dev
- libjson-c-dev
- uuid-dev
- python-dev
- libmaxminddb-dev
# - libjwt-dev
before_install: sh -x scripts/build/install_depends.sh
script: sh -x scripts/build/do_build.sh
notifications:
irc:
channels:
- "chat.freenode.net#opensips"
on_success: change
on_failure: always
slack:
secure: MnRvw68QpJHUSZ/IRGUlAjQ62xs3LtEZ0g3pG7Bms0XotuK+YxmSZh7BgV61utuya295LTvdWZQYiutJ4+iPKdF7Mb1KCzaUbY6nrGaIbqif10CKwfIFRsENMhYUKOXdvg52103GNq3/V3/6PGX7Jtiaox9lHcfRhvljs+cUgSk=
on_success: change
on_failure: always
irc:
channels:
- "chat.freenode.net#opensips"
on_success: change
on_failure: always
slack:
secure: MnRvw68QpJHUSZ/IRGUlAjQ62xs3LtEZ0g3pG7Bms0XotuK+YxmSZh7BgV61utuya295LTvdWZQYiutJ4+iPKdF7Mb1KCzaUbY6nrGaIbqif10CKwfIFRsENMhYUKOXdvg52103GNq3/V3/6PGX7Jtiaox9lHcfRhvljs+cUgSk=
on_success: change
on_failure: always
jobs:
include:
- name: "Build with GCC 7 @ Ubuntu 16"
dist: xenial
compiler: gcc
env: COMPILER=gcc
- name: "Build with Clang 7 @ Ubuntu 16"
dist: xenial
compiler: clang
env: COMPILER=clang
- name: "Build with GCC 7 @ Ubuntu 18"
compiler: gcc
env: COMPILER=gcc
- name: "Build with GCC 9 @ Ubuntu 18"
compiler: gcc
env: COMPILER=gcc-9
- name: "Build with GCC 10 @ Ubuntu 18"
compiler: gcc
env: COMPILER=gcc-10
- name: "Build with Clang 7 @ Ubuntu 18"
compiler: clang
env: COMPILER=clang
- name: "Build with Clang 9 @ Ubuntu 18"
compiler: clang
env: COMPILER=clang-9
- name: "Build with Clang 10 @ Ubuntu 18"
compiler: clang
env: COMPILER=clang-10
- name: "Build with GCC 7 @ Ubuntu 18 (ARM64)"
compiler: gcc
arch: arm64
env: COMPILER=gcc
- name: "Build with Clang 7 @ Ubuntu 18 (ARM64)"
compiler: clang
arch: arm64
env: COMPILER=clang
- name: "Build Core with GCC 7 @ Ubuntu 18 (i386)"
compiler: gcc
env: COMPILER=gcc-i386-cross
- name: "Build Core with Clang 7 @ Ubuntu 18 (i386)"
compiler: clang
env: COMPILER=clang-i386-cross
- name: "Build Core with GCC 7 @ Ubuntu 18 (MIPS64)"
compiler: gcc
env: COMPILER=gcc-mips64-cross
86 changes: 86 additions & 0 deletions scripts/build/build.conf.sub
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
enable_ubuntu_toolchain_test() {
sudo apt install software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
}

setup_qemu() {
ARCH1="${1}"
ARCH2="${2}"
sudo mkdir "/usr/${ARCH1}-linux-${ARCH2}/etc"
sudo touch "/usr/${ARCH1}-linux-${ARCH2}/etc/ld.so.cache"
sudo mkdir "/etc/qemu-binfmt"
sudo ln -sf "/usr/${ARCH1}-linux-${ARCH2}" "/etc/qemu-binfmt/${ARCH1}"
}

COMPILER_VER=`echo "${COMPILER}" | sed -e 's|[a-z]*-||'`

case "${COMPILER}" in
gcc)
export CC="${COMPILER}"
PKGS="${PKGS} gcc g++"
;;
gcc-i386-cross)
export CC="gcc"
CC_EXTRA_OPTS="-Werror -m32"
MAKE_TGT="opensips"
PRE_INSTALL_CMD="sudo dpkg --add-architecture i386"
PKGS="${PKGS} gcc g++ libc6-dev:i386 libstdc++6:i386 lib32gcc-7-dev"
;;
gcc-mips64-cross)
MAKE_TGT="opensips"
export CC="mips64-linux-gnuabi64-gcc"
export AR="mips64-linux-gnuabi64-ar"
export RANLIB="mips64-linux-gnuabi64-ranlib"
POST_INSTALL_CMD="setup_qemu mips64 gnuabi64"
PKGS="${PKGS} gcc-mips64-linux-gnuabi64 libc-dev-mips64-cross qemu-user-static"
;;
gcc-arm32-cross)
MAKE_TGT="opensips"
export CC="arm-linux-gnueabihf-gcc"
export AR="arm-linux-gnueabihf-ar"
export RANLIB="arm-linux-gnueabihf-ranlib"
POST_INSTALL_CMD="setup_qemu arm gnueabihf"
PKGS="${PKGS} gcc-arm-linux-gnueabihf libc-dev-armhf-cross qemu-user-static"
;;
gcc-arm64-cross)
MAKE_TGT="opensips"
export CC="aarch64-linux-gnu-gcc"
export AR="aarch64-linux-gnu-ar"
export RANLIB="aarch64-linux-gnu-ranlib"
POST_INSTALL_CMD="setup_qemu aarch64 gnu"
PKGS="${PKGS} gcc-aarch64-linux-gnu libc-dev-arm64-cross qemu-user-static"
;;
clang)
export CC="${COMPILER}"
export AR="llvm-ar"
export RANLIB="llvm-ranlib"
export GCOV_CMD="llvm-cov gcov"
PKGS="${PKGS} clang llvm-dev"
;;
clang-i386-cross)
export CC="clang"
CC_EXTRA_OPTS="-Werror -m32"
MAKE_TGT="opensips"
PRE_INSTALL_CMD="sudo dpkg --add-architecture i386"
PKGS="${PKGS} clang llvm-dev libc6-dev:i386 libstdc++6:i386 lib32gcc-7-dev"
;;
gcc-*)
export CC="${COMPILER}"
export AR="gcc-ar-${COMPILER_VER}"
export RANLIB="gcc-ranlib-${COMPILER_VER}"
export GCOV_CMD="gcov-${COMPILER_VER}"
PRE_INSTALL_CMD="enable_ubuntu_toolchain_test"
PKGS="${PKGS} gcc-${COMPILER_VER} g++-${COMPILER_VER}"
;;
clang-*)
export CC="${COMPILER}"
export AR="llvm-ar-${COMPILER_VER}"
export RANLIB="llvm-ranlib-${COMPILER_VER}"
export GCOV_CMD="llvm-cov-${COMPILER_VER} gcov"
PKGS="${PKGS} clang-${COMPILER_VER} llvm-${COMPILER_VER}-dev libc++-${COMPILER_VER}-dev libc++abi-${COMPILER_VER}-dev"
;;
*)
printf 'COMPILER="%s" is unknown / unsupported\n' "${COMPILER}" 1>&2
exit 1
;;
esac
11 changes: 11 additions & 0 deletions scripts/build/do_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

set -e

PKGS=`grep -A 35 packages: .travis.yml | grep -e '^ *[-]' | awk '{print $2}'`

. $(dirname $0)/build.conf.sub

CC_EXTRA_OPTS=${CC_EXTRA_OPTS:-"-Werror"} FASTER=1 NICER=0 make \
exclude_modules="db_oracle osp sngtc cachedb_cassandra cachedb_couchbase \
cachedb_mongodb auth_jwt event_kafka aaa_diameter" ${MAKE_TGT:-"all"}
28 changes: 28 additions & 0 deletions scripts/build/install_depends.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

set -e

PKGS=""
for pkg in `grep -A 35 packages: .travis.yml | grep -e '^ *[-]' | awk '{print $2}'`
do
if [ "${BUILD_OS}" = ubuntu-22.04 -a "${pkg}" = python-dev ]
then
pkg="python-dev-is-python3"
fi
PKGS="${PKGS} ${pkg}"
done

. $(dirname $0)/build.conf.sub

if [ ! -z "${PRE_INSTALL_CMD}" ]
then
${PRE_INSTALL_CMD}
fi

sudo apt-get update -y
sudo apt-get -y --allow-downgrades install ${PKGS}

if [ ! -z "${POST_INSTALL_CMD}" ]
then
${POST_INSTALL_CMD}
fi
28 changes: 28 additions & 0 deletions scripts/build/linkstatic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

set -e

AR=${AR:-"ar"}
RANLIB=${RANLIB:-"ranlib"}

LINKARGS=""
ARNAME=""
nmfollows=0
for var in "$@"
do
if [ ${nmfollows} -ne 0 ]
then
ARNAME="${var}"
nmfollows=0
continue
fi
if [ "${var}" != "-o" ]
then
LINKARGS="${LINKARGS} ${var}"
continue
fi
nmfollows=1
done

${AR} cr "${ARNAME}" ${LINKARGS}
${RANLIB} "${ARNAME}"

0 comments on commit 08a489e

Please sign in to comment.