From 1d2a83b9a26c0b172f362c6f9728efe2bf8e7c31 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Thu, 17 Oct 2019 15:45:08 +0900 Subject: [PATCH] Add CI --- .gitignore | 1 + ibus-anthy.spec | 5 +- .../defaults/main.yml | 3 + .../ibus-desktop-testing-role/meta/main.yml | 4 + .../ibus-desktop-testing-role/tasks/main.yml | 114 ++++++++++++++++++ tests/tests.yml | 8 ++ 6 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 tests/roles/ibus-desktop-testing-role/defaults/main.yml create mode 100644 tests/roles/ibus-desktop-testing-role/meta/main.yml create mode 100644 tests/roles/ibus-desktop-testing-role/tasks/main.yml create mode 100644 tests/tests.yml diff --git a/.gitignore b/.gitignore index c60ab8d..b265bd5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +tests/artifacts ibus-anthy-1.2.1.tar.gz ibus-anthy.png /ibus-anthy-1.2.2.20101015.tar.gz diff --git a/ibus-anthy.spec b/ibus-anthy.spec index 337d2df..18282b4 100644 --- a/ibus-anthy.spec +++ b/ibus-anthy.spec @@ -32,7 +32,7 @@ Name: ibus-anthy Version: 1.5.11 -Release: 3%{?dist} +Release: 4%{?dist} Summary: The Anthy engine for IBus input platform License: GPLv2+ URL: https://github.com/ibus/ibus/wiki @@ -205,6 +205,9 @@ touch --no-create %{_datadir}/icons/hicolor || : %{_datadir}/installed-tests/%{name} %changelog +* Thu Oct 17 2019 Takao Fujiwara - 1.5.11-4 +- Add CI + * Wed Oct 16 2019 Takao Fujiwara - 1.5.11-3 - Replace anthy with anthy-unicode - Install ibus-anthy-tests sub package diff --git a/tests/roles/ibus-desktop-testing-role/defaults/main.yml b/tests/roles/ibus-desktop-testing-role/defaults/main.yml new file mode 100644 index 0000000..8ff7991 --- /dev/null +++ b/tests/roles/ibus-desktop-testing-role/defaults/main.yml @@ -0,0 +1,3 @@ +role_pkgs_req: + - rsync + - xorg-x11-server-Xvfb diff --git a/tests/roles/ibus-desktop-testing-role/meta/main.yml b/tests/roles/ibus-desktop-testing-role/meta/main.yml new file mode 100644 index 0000000..6626402 --- /dev/null +++ b/tests/roles/ibus-desktop-testing-role/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: + - role: str-common-init diff --git a/tests/roles/ibus-desktop-testing-role/tasks/main.yml b/tests/roles/ibus-desktop-testing-role/tasks/main.yml new file mode 100644 index 0000000..5d1d8cc --- /dev/null +++ b/tests/roles/ibus-desktop-testing-role/tasks/main.yml @@ -0,0 +1,114 @@ +--- +- name: Check if GNOME installed-tests testing harness is installed + register: gnome_desktop_testing_runner + find: + paths: "{{ ansible_env.PATH.split(':') }}" + pattern: gnome-desktop-testing-runner + +- name: Build and install GNOME installed-tests testing harness + when: gnome_desktop_testing_runner.matched == 0 + block: + - name: Installing build dependencies for IBus and GNOME installed-tests testing harness + package: + name: + - git + - make + - gcc + - diffutils + - autoconf + - automake + - libtool + - glib2-devel + - systemd-devel + - gnome-session + - gnome-shell + - dbus-x11 + - xorg-x11-server-Xvfb + - ibus + - ibus-desktop-testing + - ibus-anthy-tests + # ibus-compose test needs locales + - glibc-langpack-el + - glibc-langpack-fi + - glibc-langpack-pt + + - name: Fetching GNOME installed-tests testing harness source from remote repository + git: + repo: 'https://gitlab.gnome.org/GNOME/gnome-desktop-testing.git' + dest: gnome-desktop-testing + force: yes + + - name: Configure GNOME installed-tests testing harness build + command: ./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var + args: + chdir: gnome-desktop-testing + + - name: Build GNOME installed-tests testing harness + command: make + args: + chdir: gnome-desktop-testing + + - name: Install GNOME installed-tests testing harness + command: make install + args: + chdir: gnome-desktop-testing + + - name: Install tap.py + shell: | + TAP_DIR=`python -m site --user-site`/tap + if [ x"$TAP_DIR" != x -a ! -d "$TAP_DIR" ] ; then + echo "pip install tap.py --user" + pip install tap.py --user + fi + +- name: Start IBus installed-tests testing harness + block: + - name: Execute IBus tests + shell: | + set -e + status="FAIL: frame" + if [ -f $HOME/.config/anthy/last-record2_default.utf8 ] ; then \ + rm $HOME/.config/anthy/last-record2_default.utf8 + fi + if [ -f $HOME/.anthy/last-record2_default.utf8 ] ; then \ + rm $HOME/.anthy/last-record2_default.utf8 + fi + env TMPDIR='{{ remote_artifacts }}' G_MESSAGES_DEBUG='all' \ + ibus-desktop-testing-runner \ + --no-graphics \ + --runner=gnome \ + --tests='{{ installed_test_name }}' \ + --output='{{ remote_artifacts }}/{{ installed_test_name }}.log' \ + --result='{{ remote_artifacts }}/test.log' \ + null + if [ $? -eq 0 ]; then + status="PASS: frame" + fi + echo "${status} $TEST" >> {{ remote_artifacts }}/test.log + + - name: Check the results + #shell: grep "^FAIL" {{ remote_artifacts }}/test.log + shell: | + log="{{ remote_artifacts }}/test.log" + if [ ! -f $log ] ; then + echo ERROR + else + FAIL=`grep "^FAIL: " {{ remote_artifacts }}/test.log | grep -v 'FAIL: 0$'` + if [ x"$FAIL" != x ] ; then + echo ERROR + else + echo PASS + fi + fi + register: test_fails + #failed_when: False + + - name: Set role result + set_fact: + role_result: "{{ test_fails.stdout }}" + role_result_failed: "{{ (test_fails.stdout|d|length > 0) or (test_fails.stderr|d|length > 0) }}" + role_result_msg: "{{ test_fails.stdout|d('tests failed.') }}" + + - include_role: + name: str-common-final + diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..b175564 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,8 @@ +- hosts: localhost + roles: + - role: ibus-desktop-testing-role + installed_test_name: ibus-anthy + tags: + - classic + - gating +