migrate to github actions

This commit is contained in:
Infactum 2020-07-25 23:57:15 +03:00 committed by GitHub
parent 4dca437ff6
commit 6e08102559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 103 additions and 192 deletions

84
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,84 @@
name: CI
on: [push, pull_request]
jobs:
build:
name: Native Build
runs-on: ubuntu-latest
strategy:
matrix:
tag: [bionic, centos7]
container: infactum/tg2sip-builder:${{ matrix.tag }}
steps:
- uses: actions/checkout@v2
- name: Build
run: |
[ -d "/opt/rh" ] && source /opt/rh/devtoolset-7/enable
mkdir build && cd build
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . -j $(grep -c ^processor /proc/cpuinfo);
- uses: actions/upload-artifact@v2
with:
name: tg2sip_${{ matrix.tag }}
path: |
build/tg2sip
build/gen_db
build/settings.ini
# AppImage generation cannot be fully done inside container
# because of FUSE requirements
- name: Prepare AppImage
if: matrix.tag == 'centos7'
run: |
linuxdeploy --appdir tg2sip -e build/tg2sip
linuxdeploy --appdir gen_db -e build/gen_db
- uses: actions/upload-artifact@v2
if: matrix.tag == 'centos7'
with:
name: tmp
path: |
tg2sip/
gen_db/
appimage:
name: Pack AppImage
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: tmp
path: tmp
- name: Prepare
run: |
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool.AppImage
chmod +x appimagetool.AppImage
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O linuxdeploy.AppImage
chmod +x linuxdeploy.AppImage
- name: Pack
run: |
./linuxdeploy.AppImage --appdir tmp/tg2sip -d buildenv/tg2sip.desktop -i buildenv/icon.svg
./linuxdeploy.AppImage --appdir tmp/gen_db -d buildenv/gen_db.desktop -i buildenv/icon.svg
chmod +x tmp/tg2sip/usr/bin/tg2sip
chmod +x tmp/gen_db/usr/bin/gen_db
./appimagetool.AppImage tmp/tg2sip
./appimagetool.AppImage tmp/gen_db
- uses: actions/upload-artifact@v2
with:
name: tg2sip_universal
path: |
tg2sip-x86_64.AppImage
gen_db-x86_64.AppImage
settings.ini;

View File

@ -1,4 +1,4 @@
[![Build status](https://ci.appveyor.com/api/projects/status/4dnph34apvfy6vft?svg=true)](https://ci.appveyor.com/project/Infactum/tg2sip) [![Build status](https://github.com/Infactum/tg2sip/workflows/CI/badge.svg)](https://github.com/Infactum/tg2sip/actions)
# TG2SIP # TG2SIP
@ -14,10 +14,8 @@ Your SIP PBX should be comaptible with `L16@48000` or `OPUS@48000` voice codec.
* Build them from source. * Build them from source.
Requires C++17 supported comiler, which may be a trouble for old linux distros. Requires C++17 supported comiler, which may be a trouble for old linux distros.
* Download prebuild native binaries for one of supported distros. * Download prebuild native binaries for one of supported distros.
[Ubuntu 18.04 Bionic](https://ci.appveyor.com/api/projects/Infactum/tg2sip/artifacts/tg2sip_bionic.zip?branch=master&job=Environment%3A%20target_name%3DUbuntu%20Bionic%2C%20docker_tag%3Dbionic)
[CentOS 7](https://ci.appveyor.com/api/projects/Infactum/tg2sip/artifacts/tg2sip_centos7.zip?branch=master&job=Environment%3A%20target_name%3DCentOS%207%2C%20docker_tag%3Dcentos7)
Prebuild binaries requires OPUS libraries (`libopus0` for Ubuntu, `opus` for CentOS, etc). Prebuild binaries requires OPUS libraries (`libopus0` for Ubuntu, `opus` for CentOS, etc).
* [Download](https://ci.appveyor.com/api/projects/Infactum/tg2sip/artifacts/tg2sip.zip?branch=master&job=Environment%3A%20target_name%3DAppImage%2C%20docker_tag%3Dcentos6) universal AppImage package. * Download universal AppImage package.
More information of what is AppImage can be found here https://appimage.org/ More information of what is AppImage can be found here https://appimage.org/
2. Obtain `api_id` and `api_hash` tokens from [this](https://my.telegram.org) page and put them in `settings.ini` file. 2. Obtain `api_id` and `api_hash` tokens from [this](https://my.telegram.org) page and put them in `settings.ini` file.

View File

@ -1,75 +0,0 @@
version: 1.0.0+{build}
image:
- Ubuntu
services:
- docker
configuration: Release
platform: x64
environment:
global:
docker_image: infactum/tg2sip-builder
matrix:
- target_name: Ubuntu Bionic
docker_tag: bionic
- target_name: CentOS 7
docker_tag: centos7
- target_name: AppImage
docker_tag: centos6
init:
- sh: |
docker pull "$docker_image":"$docker_tag"
build_script:
- sh: >-
if [ "$target_name" != "AppImage" ] ; then
mkdir build;
docker run --rm -v "$(pwd)":/src "$docker_image":"$docker_tag" /bin/bash -c "
mkdir build && cd build;
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && cmake -DCMAKE_BUILD_TYPE=Release /src;
cmake --build .;
chmod +x tg2sip;
chmod +x gen_db;
cp tg2sip /src/build;
cp gen_db /src/build;"
7z a tg2sip.zip ./build/tg2sip ./build/gen_db ./settings.ini;
fi;
- sh: >-
if [ "$target_name" = "AppImage" ] ; then
mkdir build;
docker run --rm -v "$(pwd)":/src "$docker_image":"$docker_tag" /bin/bash -c "
mkdir build && cd build;
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && cmake -DCMAKE_BUILD_TYPE=Release /src;
cmake --build .;
chmod +x tg2sip;
chmod +x gen_db;
linuxdeploy --appdir /src/build/tg2sip -e tg2sip;
linuxdeploy --appdir /src/build/gen_db -e gen_db;"
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool.AppImage;
chmod +x appimagetool.AppImage;
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O linuxdeploy.AppImage;
chmod +x linuxdeploy.AppImage;
sudo chown -R "$(id -u)":"$(id -g)" ./build;
./linuxdeploy.AppImage --appdir ./build/tg2sip -d ./buildenv/tg2sip.desktop -i ./buildenv/icon.svg;
./linuxdeploy.AppImage --appdir ./build/gen_db -d ./buildenv/gen_db.desktop -i ./buildenv/icon.svg;
./appimagetool.AppImage ./build/tg2sip;
./appimagetool.AppImage ./build/gen_db;
7z a tg2sip.zip ./tg2sip-x86_64.AppImage ./gen_db-x86_64.AppImage ./settings.ini;
fi;
after_build:
- sh: >-
if [ "$target_name" != "AppImage" ] ; then
appveyor PushArtifact tg2sip.zip -FileName tg2sip_"$docker_tag".zip -DeploymentName "TG2SIP $target_name"
else
appveyor PushArtifact tg2sip.zip -FileName tg2sip.zip -DeploymentName "TG2SIP AppImage"
fi

View File

@ -1,94 +0,0 @@
FROM centos:6 as builder
# https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/
RUN yum -y install centos-release-scl yum-utils \
&& yum-config-manager --enable rhel-server-rhscl-7-rpms \
&& yum install -y devtoolset-7-gcc devtoolset-7-gcc-c++
RUN set -xe \
&& yum install -y \
make patch \
git wget \
zlib-devel openssl-devel gperf \
pkgconfig ccache gperf unzip \
libpng-devel libjpeg-devel \
epel-release \
&& yum install -y opus-devel patchelf
RUN wget https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh \
&& sh cmake-3.18.0-Linux-x86_64.sh --prefix=/usr --exclude-subdir
COPY glibc_gcc.patch /
RUN source /opt/rh/devtoolset-7/enable \
&& wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz \
&& tar zxf glibc-2.14.tar.gz \
&& rm glibc-2.14.tar.gz \
&& cd glibc-2.14 \
&& patch < /glibc_gcc.patch \
&& gcc --version \
&& mkdir build \
&& cd build \
&& ../configure --prefix=/opt/glibc-2.14 \
&& make -j $(grep -c ^processor /proc/cpuinfo) \
&& make install \
&& cd / \
&& rm -rf glibc-2.14 \
ENV LD_LIBRARY_PATH="/opt/glibc-2.14/lib:${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
COPY tdlib_header.patch /
COPY tdlib_threadname.patch /
RUN source /opt/rh/devtoolset-7/enable \
&& git clone https://github.com/tdlib/td.git \
&& cd td \
&& git reset --hard v1.6.0 \
&& git apply /tdlib_header.patch \
&& git apply /tdlib_threadname.patch \
&& mkdir build \
&& cd build \
&& export CPLUS_INCLUDE_PATH="/opt/glibc-2.14/include" \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& cmake --build . --target install -j $(grep -c ^processor /proc/cpuinfo) \
&& cd / \
&& rm -rf td
COPY config_site.h /
RUN source /opt/rh/devtoolset-7/enable \
&& git clone https://github.com/pjsip/pjproject.git \
&& cd pjproject \
&& git reset --hard 2.9 \
&& cp /config_site.h pjlib/include/pj \
&& ./configure --disable-sound CFLAGS="-O3 -DNDEBUG" \
&& make dep && make -j $(grep -c ^processor /proc/cpuinfo) && make install \
&& cd / \
&& rm -rf pjproject
RUN source /opt/rh/devtoolset-7/enable \
&& git clone -n https://github.com/gabime/spdlog.git \
&& cd spdlog \
&& git checkout tags/v0.17.0 \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_EXAMPLES=OFF -DSPDLOG_BUILD_TESTING=OFF .. \
&& cmake --build . --target install -j $(grep -c ^processor /proc/cpuinfo) \
&& cd / \
&& rm -rf spdlog
RUN source /opt/rh/devtoolset-7/enable \
&& git clone --recursive https://github.com/linuxdeploy/linuxdeploy.git \
&& cd linuxdeploy \
&& git checkout f9fc51a832185158d3e0e64858c83a941047871f \
&& mkdir build \
&& cd build \
&& export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && cmake -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_CIMG=0 .. \
&& cmake --build . -j $(grep -c ^processor /proc/cpuinfo) \
&& cp bin/linuxdeploy /usr/local/bin \
&& cd / \
&& rm -rf linuxdeploy
COPY centos_entrypoint.sh /
ENTRYPOINT ["/centos_entrypoint.sh"]

View File

@ -9,7 +9,10 @@ RUN yum install -y \
make \ make \
git wget \ git wget \
zlib-devel opus-devel openssl-devel gperf \ zlib-devel opus-devel openssl-devel gperf \
pkgconfig ccache gperf unzip pkgconfig ccache gperf unzip \
libpng-devel libjpeg-devel \
epel-release \
&& yum install -y patchelf
RUN wget https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh \ RUN wget https://cmake.org/files/v3.18/cmake-3.18.0-Linux-x86_64.sh \
&& sh cmake-3.18.0-Linux-x86_64.sh --prefix=/usr --exclude-subdir && sh cmake-3.18.0-Linux-x86_64.sh --prefix=/usr --exclude-subdir
@ -53,6 +56,18 @@ RUN source /opt/rh/devtoolset-7/enable \
&& cd / \ && cd / \
&& rm -rf spdlog && rm -rf spdlog
RUN source /opt/rh/devtoolset-7/enable \
&& git clone --recursive https://github.com/linuxdeploy/linuxdeploy.git \
&& cd linuxdeploy \
&& git checkout 557bad2241df2c33972c7e6bdbf0c528cee27cc8 \
&& mkdir build \
&& cd build \
&& export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && cmake -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_CIMG=0 .. \
&& cmake --build . -j $(grep -c ^processor /proc/cpuinfo) \
&& cp bin/linuxdeploy /usr/local/bin \
&& cd / \
&& rm -rf linuxdeploy
COPY centos_entrypoint.sh / COPY centos_entrypoint.sh /
ENTRYPOINT ["/centos_entrypoint.sh"] ENTRYPOINT ["/centos_entrypoint.sh"]

View File

@ -1,17 +0,0 @@
diff --git a/configure b/configure
index 6cf85e5..2613fc4 100755
--- a/configure
+++ b/configure
@@ -4938,10 +4938,10 @@ else
$as_echo_n "checking version of $CC... " >&6; }
ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
- '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=no;;
3.4* | 4.[0-9]* )
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
- *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=no;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5

View File

@ -4,7 +4,7 @@ set -e
DOCKER_IMAGE=infactum/tg2sip-builder DOCKER_IMAGE=infactum/tg2sip-builder
for DOCKER_TAG in bionic centos6 centos7 for DOCKER_TAG in bionic centos7
do do
docker build . -f Dockerfile."$DOCKER_TAG" -t "$DOCKER_IMAGE:$DOCKER_TAG" docker build . -f Dockerfile."$DOCKER_TAG" -t "$DOCKER_IMAGE:$DOCKER_TAG"
docker push "$DOCKER_IMAGE:$DOCKER_TAG" docker push "$DOCKER_IMAGE:$DOCKER_TAG"