summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: bbc92637641bc9a37be36ac7b563a3b76e5eaf05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: CI

on:
  - push
  - pull_request

env:
  WEECHAT_DEPENDENCIES: devscripts equivs python3-pip libenchant-dev autopoint cmake ninja-build lcov pkg-config libncursesw5-dev gem2deb libperl-dev python2-dev python3-dev libaspell-dev liblua5.3-dev tcl8.6-dev guile-2.2-dev libv8-dev libcurl4-gnutls-dev libgcrypt20-dev libgnutls28-dev libzstd-dev zlib1g-dev curl libcpputest-dev php8.0-dev libphp8.0-embed libargon2-0-dev libsodium-dev pylint python3-bandit asciidoctor

jobs:

  tests_linux:

    strategy:
      matrix:
        os:
          - ubuntu-20.04
        config:
          - { name: "cmake_gcc", cc: "gcc", cxx: "g++", tool: "cmake", args: "" }
          - { name: "cmake_gcc_ninja", cc: "gcc", cxx: "g++", tool: "cmake", args: "-G Ninja" }
          - { name: "cmake_gcc_no_nls", cc: "gcc", cxx: "g++", tool: "cmake", args: "-DENABLE_NLS=OFF" }
          - { 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: "" }

    name: "Tests: ${{ matrix.config.name }} on ${{ matrix.os }}"
    runs-on: ${{ matrix.os }}

    steps:

    - uses: actions/checkout@v2

    - name: Install dependencies
      run: |
        sudo apt-add-repository --yes ppa:ondrej/php
        sudo apt-get update -qq
        sudo apt-get --yes purge php8.1-dev
        sudo apt-get --yes --no-install-recommends install ${{ env.WEECHAT_DEPENDENCIES }}
        sudo -H pip3 install --ignore-installed msgcheck

    - name: Check gettext files
      run: msgcheck po/*.po

    - name: Check Python scripts
      run: |
        pylint --additional-builtins=_ doc/docgen.py
        pylint doc/python_stub.py
        pylint tests/scripts/python/testapigen.py tests/scripts/python/testapi.py tests/scripts/python/unparse.py
        bandit doc/docgen.py doc/python_stub.py
        bandit tests/scripts/python/testapigen.py tests/scripts/python/testapi.py tests/scripts/python/unparse.py

    - name: Check Python stub file
      run: ./doc/python_stub.py | diff src/plugins/python/weechat.pyi -

    - 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 --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'

  tests_macos:

    strategy:
      matrix:
        os:
          - macos-11
          - macos-10.15
        config:
          - { name: "cmake_gcc", cc: "gcc", cxx: "g++" }
          - { name: "cmake_clang", cc: "clang", cxx: "clang++" }

    name: "Tests: ${{ matrix.config.name }} on ${{ matrix.os }}"
    runs-on: ${{ matrix.os }}

    steps:

    - uses: actions/checkout@v2

    - name: Install dependencies
      run: |
        brew update
        brew install asciidoctor lua ruby

    - name: Build
      env:
        CC: ${{ matrix.config.cc }}
        CXX: ${{ matrix.config.cxx }}
      run: |
        mkdir build-tmp && cd build-tmp
        cmake .. -DENABLE_MAN=ON -DENABLE_DOC=ON -DENABLE_PHP=OFF
        make VERBOSE=1 -j2
        sudo make install

    - name: Run WeeChat
      env:
        TERM: xterm-256color
      run: |
        weechat --help
        weechat-curses --help
        weechat --colors
        weechat --license
        weechat --version
        weechat --run-command "/debug dirs;/debug libs" --run-command "/quit"

  build_debian:

    strategy:
      matrix:
        os:
          - ubuntu-20.04

    name: "Build Debian on ${{ matrix.os }}"
    runs-on: ${{ matrix.os }}

    steps:

    - uses: actions/checkout@v2

    - name: Install dependencies
      run: |
        sudo apt-add-repository --yes ppa:ondrej/php
        sudo apt-get update -qq
        sudo apt-get --yes purge php8.1-dev
        sudo apt-get --yes --no-install-recommends install ${{ env.WEECHAT_DEPENDENCIES }} php-dev

    - name: Test Debian patches
      run: ./tools/build-debian.sh test-patches

    - name: Build Debian packages
      run: ./tools/build-debian.sh devel ubuntu/focal

    - name: Install Debian packages
      run: sudo dpkg -i ../weechat-devel*.deb

    - name: Run WeeChat
      env:
        TERM: xterm-256color
      run: |
        weechat --help
        weechat-curses --help
        weechat --version
        weechat --run-command "/debug dirs;/debug libs" --run-command "/quit"