Browse Source

core: add CI with GitHub Actions, move codecov.io upload to GitHub Actions

master
Sébastien Helleu 1 year ago
parent
commit
c4832737e9
  1. 74
      .github/workflows/ci.yml
  2. 7
      .travis.yml
  3. 3
      ChangeLog.adoc
  4. 2
      README.adoc
  5. 10
      tools/build-test.sh

74
.github/workflows/ci.yml

@ -0,0 +1,74 @@
name: CI
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config:
- { name: "cmake_gcc", cc: "gcc", cxx: "g++", tool: "cmake", args: "" }
- { name: "cmake_gcc_py2", cc: "gcc", cxx: "g++", tool: "cmake", args: "-DENABLE_PYTHON2=ON" }
- { name: "cmake_gcc_coverage", cc: "gcc", cxx: "g++", tool: "cmake", args: "-DENABLE_CODE_COVERAGE=ON" }
- { name: "cmake_clang", cc: "clang", cxx: "clang++", tool: "cmake", args: "" }
- { name: "autotools_gcc", cc: "gcc", cxx: "g++", tool: "autotools", args: "" }
- { name: "autotools_clang", cc: "clang", cxx: "clang++", tool: "autotools", args: "" }
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
echo 'APT::Install-Recommends "false";' | sudo tee -a /etc/apt/apt.conf
sudo apt-get update -qq
sudo apt-get -y install devscripts equivs python-pip libenchant-dev autopoint cmake lcov pkg-config libncursesw5-dev gem2deb libperl-dev python-dev python3-dev libaspell-dev liblua5.3-dev tcl8.6-dev guile-2.0-dev libv8-dev libcurl4-gnutls-dev libgcrypt20-dev libgnutls28-dev zlib1g-dev curl libcpputest-dev php7.4-dev libphp7.4-embed libargon2-0-dev libsodium-dev pylint3 asciidoctor
sudo -H pip install --ignore-installed msgcheck
- name: Test patches
run: ./tools/build-debian.sh test-patches
- name: Check gettext files
run: msgcheck po/*.po
- name: Check Python scripts
run: |
pylint3 --additional-builtins=_ doc/docgen.py
pylint3 tests/scripts/python/testapigen.py
pylint3 tests/scripts/python/testapi.py
pylint3 tests/scripts/python/unparse.py
- name: Build and run tests
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
BUILDTOOL: ${{ matrix.config.tool }}
BUILDARGS: ${{ matrix.config.args }}
run: ./tools/build-test.sh
- name: Run WeeChat
env:
TERM: xterm-256color
run: |
weechat --help
weechat-curses --help
weechat --colors
weechat --license
weechat --version
weechat --temp-dir --run-command "/debug dirs;/debug libs" --run-command "/quit"
- name: Code coverage
if: ${{ matrix.config.name == 'cmake_gcc_coverage' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
cd build-tmp-*
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info
bash <(curl -s https://codecov.io/bash) -f coverage.info || echo 'Codecov error'

7
.travis.yml

@ -5,7 +5,7 @@ language: c
env:
- CC="gcc" CXX="g++" BUILDTOOL="cmake" BUILDARGS=""
- CC="gcc" CXX="g++" BUILDTOOL="cmake" BUILDARGS="-DENABLE_PYTHON2=ON"
- CC="gcc" CXX="g++" BUILDTOOL="cmake" BUILDARGS="-DENABLE_CODE_COVERAGE=ON" CODECOVERAGE="1"
# - CC="gcc" CXX="g++" BUILDTOOL="cmake" BUILDARGS="-DENABLE_CODE_COVERAGE=ON" CODECOVERAGE="1"
- CC="gcc" CXX="g++" BUILDTOOL="autotools" BUILDARGS=""
- CC="gcc" CXX="g++" BUILDTOOL="autotools" BUILDARGS="--enable-python2"
- CC="clang" CXX="clang++" BUILDTOOL="cmake" BUILDARGS=""
@ -15,9 +15,6 @@ env:
matrix:
fast_finish: true
exclude:
- compiler: clang
env: BUILDTOOL="cmake" BUILDARGS="-DENABLE_CODE_COVERAGE=ON" CODECOVERAGE="1"
before_script:
- echo 'APT::Install-Recommends "false";' | sudo tee -a /etc/apt/apt.conf
@ -46,4 +43,4 @@ after_success:
- weechat --license
- weechat --version
- weechat --temp-dir --run-command "/debug dirs;/debug libs" --run-command "/quit"
- if [ "$CODECOVERAGE" = "1" ]; then bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov error"; fi
# - if [ "$CODECOVERAGE" = "1" ]; then bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov error"; fi

3
ChangeLog.adoc

@ -76,8 +76,9 @@ Documentation::
Tests::
* core: run tests on plugins only if the plugins are enabled and compiled
* core: add CI with GitHub Actions, move codecov.io upload to GitHub Actions
* core: switch to Ubuntu Bionic on Travis CI, use pylint3 to lint Python scripts
* core: run tests on plugins only if the plugins are enabled and compiled
* irc: add tests on IRC color functions
Build::

2
README.adoc

@ -12,7 +12,7 @@ image:https://img.shields.io/badge/devel%20blog-follow-blue.svg["Devel blog", li
image:https://img.shields.io/badge/slant-recommend-28acad.svg["Slant", link="https://www.slant.co/topics/1323/~best-irc-clients-for-linux"]
image:https://img.shields.io/badge/help-donate%20%E2%9D%A4-ff69b4.svg["Donate", link="https://weechat.org/donate/"]
image:https://travis-ci.org/weechat/weechat.svg?branch=master["Build Status", link="https://travis-ci.org/weechat/weechat"]
image:https://github.com/weechat/weechat/workflows/CI/badge.svg["CI", link="https://github.com/weechat/weechat/actions"]
image:https://codecov.io/gh/weechat/weechat/branch/master/graph/badge.svg["Code coverage", link="https://codecov.io/gh/weechat/weechat"]
*WeeChat* (Wee Enhanced Environment for Chat) is a free chat client, fast and

10
tools/build-test.sh

@ -22,7 +22,6 @@
# Build WeeChat according to environment variables:
# - BUILDTOOL: cmake or autotools
# - BUILDARGS: arguments for cmake or configure commands
# - CODECOVERAGE: "1" to build with code coverage (works only with cmake)
#
# Syntax to run the script with environment variables:
# BUILDTOOL=cmake ./build-test.sh
@ -34,7 +33,7 @@
# ./build-test.sh cmake [arguments]
# ./build-test.sh autotools [arguments]
#
# This script is used to build WeeChat in Travis CI environment.
# This script is used to build WeeChat in CI environment.
#
run ()
@ -71,12 +70,7 @@ if [ "$BUILDTOOL" = "cmake" ]; then
run "cmake .. -DENABLE_MAN=ON -DENABLE_DOC=ON -DENABLE_TESTS=ON ${BUILDARGS}"
run "make VERBOSE=1 -j$(nproc)"
run "sudo make install"
if run "ctest -V" && [ "$CODECOVERAGE" = "1" ]; then
run "lcov --directory . --capture --output-file coverage.info"
run "lcov --remove coverage.info '/usr/*' --output-file coverage.info"
run "lcov --list coverage.info"
run "mv coverage.info .."
fi
run "ctest -V"
fi
if [ "$BUILDTOOL" = "autotools" ]; then

Loading…
Cancel
Save