diff --git a/.github/workflows/integration_bugtracker.yml b/.github/workflows/integration_bugtracker.yml new file mode 100644 index 0000000000..e525e6c8d8 --- /dev/null +++ b/.github/workflows/integration_bugtracker.yml @@ -0,0 +1,35 @@ +name: 'integration / bugtracker' + +on: + push: + branches: master + pull_request: + +jobs: + bugzilla: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Build & run docker containers + run: | + docker-compose -f tests/docker-compose.bugtrackers build + docker-compose -f tests/docker-compose.bugtrackers up -d + sleep 10 + + BUGZILLA_ADDR=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bugzilla_example_bg` + sudo sh -c "echo '$BUGZILLA_ADDR bugzilla.example.bg' >> /etc/hosts" + + - name: Initialize Bugzilla + run: | + pip install -r requirements/tarballs.txt + ./tests/bugzilla/initialize-data diff --git a/tests/bugzilla/Dockerfile b/tests/bugzilla/Dockerfile new file mode 100644 index 0000000000..d1f5352240 --- /dev/null +++ b/tests/bugzilla/Dockerfile @@ -0,0 +1,16 @@ +FROM fedora + +RUN dnf -y install bugzilla "perl(DBD::SQLite)" findutils +# install optional modules, incl. XMLRPC +RUN /usr/share/bugzilla/checksetup.pl --check-modules 2>/dev/null | grep "dnf install" | cut -f2-99 -d: | sed "s/dnf install//" | xargs dnf -y install +RUN /usr/share/bugzilla/checksetup.pl --check-modules + +COPY . /root/ +RUN patch -b /usr/share/bugzilla/Bugzilla/Util.pm /root/Util.pm.patch + +# generate /etc/bugzilla/localconfig +RUN /usr/share/bugzilla/checksetup.pl /root/checksetup_answers.txt + + +EXPOSE 80 +CMD /usr/sbin/httpd -DFOREGROUND diff --git a/tests/bugzilla/Util.pm.patch b/tests/bugzilla/Util.pm.patch new file mode 100644 index 0000000000..2d0514635c --- /dev/null +++ b/tests/bugzilla/Util.pm.patch @@ -0,0 +1,12 @@ +--- /usr/share/bugzilla/Bugzilla/Util.pm.orig 2020-05-13 15:25:00.031963484 +0300 ++++ /usr/share/bugzilla/Bugzilla/Util.pm 2020-05-13 15:31:54.668329481 +0300 +@@ -106,7 +106,8 @@ + # |U+200e|Left-To-Right Mark |0xe2 0x80 0x8e | + # |U+200f|Right-To-Left Mark |0xe2 0x80 0x8f | + # -------------------------------------------------------- +- $var =~ tr/\x{202a}-\x{202e}//d; ++ # workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1588175 ++ # $var =~ tr/\x{202a}-\x{202e}//d; + } + return $var; + } diff --git a/tests/bugzilla/checksetup_answers.txt b/tests/bugzilla/checksetup_answers.txt new file mode 100644 index 0000000000..ba24c33b4b --- /dev/null +++ b/tests/bugzilla/checksetup_answers.txt @@ -0,0 +1,26 @@ +$answer{'ADMIN_EMAIL'} = 'admin@bugzilla.bugs'; +$answer{'ADMIN_LOGIN'} = 'admin'; +$answer{'ADMIN_OK'} = 'Y'; +$answer{'ADMIN_PASSWORD'} = 'password'; +$answer{'ADMIN_REALNAME'} = 'QA Admin'; +$answer{'NO_PAUSE'} = 1; +$answer{'apache_size_limit'} = 700000; +$answer{'create_htaccess'} = 1; +$answer{'db_check'} = 1; +$answer{'db_driver'} = 'sqlite'; +$answer{'db_host'} = 'localhost'; +$answer{'db_mysql_ssl_ca_file'} = ''; +$answer{'db_mysql_ssl_ca_path'} = ''; +$answer{'db_mysql_ssl_client_cert'} = ''; +$answer{'db_mysql_ssl_client_key'} = ''; +$answer{'db_name'} = 'bugs', +$answer{'db_pass'} = 'bugs'; +$answer{'db_port'} = 0; +$answer{'db_sock'} = ''; +$answer{'db_user'} = 'bugs'; +$answer{'diffpath'} = '/usr/bin'; +$answer{'index_html'} = 0; +$answer{'interdiffbin'} = '/usr/bin/interdiff'; +$answer{'urlbase'} = 'http://bugzilla.example.bg/bugzilla/'; +$answer{'use_suexec'} = 0; +$answer{'webservergroup'} = 'apache'; diff --git a/tests/bugzilla/initialize-data b/tests/bugzilla/initialize-data new file mode 100755 index 0000000000..4b8e1c72f9 --- /dev/null +++ b/tests/bugzilla/initialize-data @@ -0,0 +1,11 @@ +#!/bin/bash + +BZ_URL="http://bugzilla.example.bg/bugzilla/xmlrpc.cgi" +BZ_USER="admin@bugzilla.bugs" +BZ_PASS="password" + +# this is Bug #1 +bugzilla --bugzilla $BZ_URL --username $BZ_USER --password $BZ_PASS --ensure-logged-in \ + new --product TestProduct --version unspecified --component TestComponent \ + --summary 'Hello World' --comment 'This is reported via cli' \ + --os Linux --arch All diff --git a/tests/docker-compose.bugtrackers b/tests/docker-compose.bugtrackers new file mode 100644 index 0000000000..0348074bcc --- /dev/null +++ b/tests/docker-compose.bugtrackers @@ -0,0 +1,12 @@ +version: '3' + +services: + # build ourselves b/c bugzilla/docker-bugzilla-dev + # is too old and doesn't work + bugzilla_example_bg: + container_name: bugzilla_example_bg + build: + context: ./bugzilla/ + dockerfile: Dockerfile + image: kiwitcms/bugzilla + restart: always