From 8f6e67b9b3858f3f4dd06909fa5013a6029634b8 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Wed, 6 Jan 2021 17:10:59 +0100 Subject: [PATCH] Check Irssi compilation using github actions --- .github/actions.yml | 43 ------------ .github/workflows/abicheck.yml | 96 +++++++++++++++++++++------ .github/workflows/check.yml | 118 ++++++++++++++++++++++++++++----- 3 files changed, 178 insertions(+), 79 deletions(-) delete mode 100644 .github/actions.yml diff --git a/.github/actions.yml b/.github/actions.yml deleted file mode 100644 index ae47fbde..00000000 --- a/.github/actions.yml +++ /dev/null @@ -1,43 +0,0 @@ -before_install: - - ./autogen.sh --with-proxy=module --with-bot --with-perl=module --with-otr=module - - make dist - - CO_DIR=$(pwd) - - mkdir -p $HOME/src - - cd $HOME/src - - tar xaf $CO_DIR/irssi-*.tar.* - -install: - - cd $HOME/src/irssi-* - - ./configure --with-proxy=module --with-bot --with-perl=module --with-otr=module --prefix=$HOME/irssi-build --enable-always-build-tests - - make CFLAGS="-Wall -Werror -Werror=declaration-after-statement" - - make install - -unit_tests: - - cd $HOME/src/irssi-* - - make -C tests -sk check - -after_unit_tests: - - cd $HOME/src/irssi-* - - find -name test-suite.log -exec cat {} + - -before_script: - - cd $HOME - - mkdir irssi-test - - | - echo 'echo automated irssi launch test - ^set settings_autosave off - ^set -clear log_close_string - ^set -clear log_day_changed - ^set -clear log_open_string - ^set log_timestamp * - ^window log on' > irssi-test/startup - - echo load perl >> irssi-test/startup - - echo load proxy >> irssi-test/startup - - echo ^quit >> irssi-test/startup - -script: - - cd $HOME - - irssi-build/bin/irssi --home irssi-test | /tools/render.pl - -after_script: - - cat $HOME/irc.log.* diff --git a/.github/workflows/abicheck.yml b/.github/workflows/abicheck.yml index 86b065cd..eceaa32e 100644 --- a/.github/workflows/abicheck.yml +++ b/.github/workflows/abicheck.yml @@ -1,25 +1,24 @@ on: [pull_request] name: abicheck +env: + build_options: -Dbuildtype=debug -Denable-true-color=yes -Dwith-proxy=yes -Dc_args=-DPERL_EUPXS_ALWAYS_EXPORT + prefix: /usr/local + apt_build_deps: ninja-build libutf8proc-dev libperl-dev libotr5-dev + get_pip_build_deps: pip3 install setuptools; pip3 install wheel; pip3 install meson + getabidef_def: getabidef() { awk '$1=="#define" && $2=="IRSSI_ABI_VERSION" { print $3 }' "$1"/include/irssi/src/common.h; } jobs: - check-abi-diff: + build-base-ref: runs-on: ubuntu-latest - env: - build_options: -Dbuildtype=debug -Denable-true-color=yes -Dwith-proxy=yes -Dc_args=-DPERL_EUPXS_ALWAYS_EXPORT - prefix: /usr/local + outputs: + base_abi: ${{ steps.out.outputs.base_abi }} steps: - name: set PATH run: | echo "$HOME/.local/bin" >> $GITHUB_PATH - name: prepare required software run: | - sudo apt install abigail-tools ninja-build libutf8proc-dev libperl-dev libotr5-dev - pip3 install setuptools - pip3 install wheel - pip3 install meson - - name: checkout merge ref - uses: actions/checkout@main - with: - path: merge.src + sudo apt install $apt_build_deps + eval "$get_pip_build_deps" - name: checkout base ref uses: actions/checkout@main with: @@ -30,26 +29,83 @@ jobs: meson Build.base base.src $build_options ninja -C Build.base DESTDIR=$PWD/base ninja -C Build.base install + - id: out + run: | + # print versions and abi versions + eval "$getabidef_def" + base_abi=$(getabidef base$prefix) + echo base abi : $base_abi + ./base$prefix/bin/irssi --version + echo "::set-output name=base_abi::$base_abi" + - uses: actions/upload-artifact@v2 + with: + name: base.inst + path: base + retention-days: 1 + build-merge-ref: + runs-on: ubuntu-latest + outputs: + merge_abi: ${{ steps.out.outputs.merge_abi }} + steps: + - name: set PATH + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: prepare required software + run: | + sudo apt install $apt_build_deps + eval "$get_pip_build_deps" + - name: checkout merge ref + uses: actions/checkout@main + with: + path: merge.src - name: build merge ref run: | meson Build.merge merge.src $build_options ninja -C Build.merge DESTDIR=$PWD/merge ninja -C Build.merge install - - run: | + - id: out + run: | # print versions and abi versions - getabidef() { awk '$1=="#define" && $2=="IRSSI_ABI_VERSION" { print $3 }' "$1"/include/irssi/src/common.h; } - base_abi=$(getabidef base$prefix) - echo base abi : $base_abi - ./base$prefix/bin/irssi --version - echo "base_abi=$base_abi" >> $GITHUB_ENV + eval "$getabidef_def" merge_abi=$(getabidef merge$prefix) echo merge abi : $merge_abi ./merge$prefix/bin/irssi --version - echo "merge_abi=$merge_abi" >> $GITHUB_ENV + echo "::set-output name=merge_abi::$merge_abi" + - uses: actions/upload-artifact@v2 + with: + name: merge.inst + path: merge + retention-days: 1 + check-abi-diff: + runs-on: ubuntu-latest + needs: + - build-merge-ref + - build-base-ref + env: + base_abi: ${{ needs.build-base-ref.outputs.base_abi }} + merge_abi: ${{ needs.build-merge-ref.outputs.merge_abi }} + steps: + - name: prepare required software + run: | + sudo apt install abigail-tools + - name: fetch base build + uses: actions/download-artifact@v2 + with: + name: base.inst + path: base + - name: fetch merge build + uses: actions/download-artifact@v2 + with: + name: merge.inst + path: merge - run: | # abipkgdiff - abipkgdiff -l base merge && diff_ret=0 || diff_ret=$? + abipkgdiff -l base merge >abipkgdiff.out && diff_ret=0 || diff_ret=$? echo "diff_ret=$diff_ret" >> $GITHUB_ENV + cat abipkgdiff.out + - uses: actions/upload-artifact@v2 + with: + path: abipkgdiff.out - run: | # Check if no changes are needed if [ "$diff_ret" -ne 0 ]; then diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4558a244..64e5442f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,21 +1,107 @@ on: [pull_request] name: Check Irssi +env: + apt_build_deps: libutf8proc-dev libperl-dev libotr5-dev + apt_build_deps_meson: ninja-build + apt_build_deps_autotools: autoconf automake libtool + get_pip_build_deps_meson: pip3 install setuptools; pip3 install wheel; pip3 install meson${meson_ver:+==${meson_ver}} + build_options_meson: -Dwith-proxy=yes -Dwith-bot=yes -Dwith-perl=yes -Dwith-otr=yes + build_options_configure: --with-proxy=module --with-bot --with-perl=module --with-otr=module + prefix: ~/irssi-build jobs: - install: + dist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@main - - name: install - uses: irssi-import/actions-irssi/check-irssi@master - with: - args: before_install install - - name: unit_tests - uses: irssi-import/actions-irssi/check-irssi@master - with: - args: unit_tests after_unit_tests - - name: script - uses: irssi-import/actions-irssi/check-irssi@master - env: - TERM: xterm - with: - args: before_script script after_script + - name: prepare required software + run: | + sudo apt install $apt_build_deps $apt_build_deps_autotools + - uses: actions/checkout@main + - name: make dist + run: | + # make dist + ./autogen.sh $build_options_configure + make dist + - uses: actions/upload-artifact@v2 + with: + path: irssi-*.tar.gz + retention-days: 1 + install: + runs-on: ${{ matrix.os }} + env: + CC: ${{ matrix.compiler }} + needs: dist + strategy: + matrix: + os: [ubuntu-16.04, ubuntu-latest] + builder: [meson, configure] + compiler: [clang, gcc] + include: + - os: ubuntu-16.04 + builder: meson + meson_ver: 0.49.2 + steps: + - name: fetch dist + uses: actions/download-artifact@v2 + - name: set PATH + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: prepare required software + env: + meson_ver: ${{ matrix.meson_ver }} + run: | + sudo apt install $apt_build_deps $apt_build_deps_${{ matrix.builder }} + eval "$get_pip_build_deps_${{ matrix.builder }}" + curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl + - name: unpack archive + run: tar xaf artifact/irssi-*.tar.gz + - name: build and install with meson + run: | + # ninja install + cd irssi-*/ + meson Build $build_options_meson --prefix=${prefix/\~/~} + ninja -C Build + ninja -C Build install + if: ${{ matrix.builder == 'meson' }} + - name: build and install with Makefile + run: | + # make install + cd irssi-*/ + mkdir Build + cd Build + ../configure $build_options_configure --prefix=${prefix/\~/~} --enable-always-build-tests + make CFLAGS="-Wall -Werror -Werror=declaration-after-statement" + make install + if: ${{ matrix.builder == 'configure' }} + - name: run tests with Makefile + run: | + # make check + cd irssi-*/Build + make -C tests -sk check + find -name test-suite.log -exec cat {} + + if: ${{ matrix.builder == 'configure' }} + - name: run tests with Meson + run: | + # ninja test + cd irssi-*/ + ninja -C Build test + find -name testlog.txt -exec sed -i -e '/Inherited environment:.* GITHUB/d' {} + -exec cat {} + + if: ${{ matrix.builder == 'meson' }} + - name: run launch test + env: + TERM: xterm + run: | + # automated irssi launch test + cd + mkdir irssi-test + echo 'echo automated irssi launch test + ^set settings_autosave off + ^set -clear log_close_string + ^set -clear log_day_changed + ^set -clear log_open_string + ^set log_timestamp * + ^window log on' > irssi-test/startup + echo load perl >> irssi-test/startup + echo load proxy >> irssi-test/startup + echo ^quit >> irssi-test/startup + irssi-build/bin/irssi --home irssi-test | ~/render.pl + cat irc.log.*