|
| 1 | +# Copyright (C) 2012-2017 Brazil |
| 2 | +# Copyright (C) 2023 Sutou Kouhei <[email protected]> |
| 3 | +# |
| 4 | +# This library is free software; you can redistribute it and/or |
| 5 | +# modify it under the terms of the GNU Lesser General Public |
| 6 | +# License version 2.1 as published by the Free Software Foundation. |
| 7 | +# |
| 8 | +# This library is distributed in the hope that it will be useful, |
| 9 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | +# Lesser General Public License for more details. |
| 12 | +# |
| 13 | +# You should have received a copy of the GNU Lesser General Public |
| 14 | +# License along with this library; if not, write to the Free Software |
| 15 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 16 | + |
| 17 | +name: Test |
| 18 | +on: |
| 19 | + push: |
| 20 | + pull_request: |
| 21 | +concurrency: |
| 22 | + group: ${{ github.head_ref || github.sha }}-${{ github.workflow }} |
| 23 | + cancel-in-progress: true |
| 24 | +jobs: |
| 25 | + ubuntu: |
| 26 | + name: Ubuntu + Groonga (${{ matrix.groonga-version }}) |
| 27 | + runs-on: ubuntu-latest |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + groonga-version: |
| 32 | + - "latest" |
| 33 | + - "master" |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v3 |
| 36 | + - name: Install dependencies |
| 37 | + run: | |
| 38 | + sudo apt -y install \ |
| 39 | + ccache |
| 40 | + apt source nginx |
| 41 | + ln -fs nginx-* nginx |
| 42 | + - name: Cache ccache |
| 43 | + uses: actions/cache@v3 |
| 44 | + with: |
| 45 | + path: ~/.ccache |
| 46 | + key: ubuntu-${{ matrix.groonga-version }}-ccache-${{ hashFiles('*.c') }} |
| 47 | + restore-keys: ubuntu-${{ matrix.groonga-version }}-ccache- |
| 48 | + - uses: actions/checkout@v3 |
| 49 | + if: |
| 50 | + matrix.groonga-version == 'master' |
| 51 | + with: |
| 52 | + repository: groonga/groonga |
| 53 | + path: groonga |
| 54 | + submodules: recursive |
| 55 | + - name: Install Groonga |
| 56 | + run: | |
| 57 | + if [ ${{ matrix.groonga-version }} = "latest" ]; then |
| 58 | + sudo apt -y install software-properties-common |
| 59 | + sudo add-apt-repository -y universe |
| 60 | + sudo add-apt-repository -y ppa:groonga/ppa |
| 61 | + sudo apt update |
| 62 | + sudo apt -y install libgroonga-dev |
| 63 | + else |
| 64 | + sudo apt -y install ninja-build |
| 65 | + cmake \ |
| 66 | + -S groonga \ |
| 67 | + -B groonga.build \ |
| 68 | + -G Ninja \ |
| 69 | + -DCMAKE_INSTALL_PREFIX=/tmp/local \ |
| 70 | + -DCMAKE_BUILD_TYPE=Debug |
| 71 | + ninja -C groonga.build install |
| 72 | + echo "PKG_CONFIG_PATH=/tmp/local/lib/pkgconfig" >> $GITHUB_ENV |
| 73 | + fi |
| 74 | + - name: Build |
| 75 | + run: | |
| 76 | + cd nginx |
| 77 | + ./configure \ |
| 78 | + --add-dynamic-module=.. \ |
| 79 | + --prefix=/tmp/local |
| 80 | + make -j$(nproc) |
| 81 | + make install |
| 82 | + - name: Enable Apache Arrow repository |
| 83 | + if: |
| 84 | + matrix.groonga-version == 'master' |
| 85 | + run: | |
| 86 | + sudo apt update -o="APT::Acquire::Retries=3" |
| 87 | + sudo apt install -y -V -o="APT::Acquire::Retries=3" \ |
| 88 | + lsb-release \ |
| 89 | + wget |
| 90 | + wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb |
| 91 | + sudo apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb |
| 92 | + sudo apt update -o="APT::Acquire::Retries=3" |
| 93 | + - name: Install test dependencies |
| 94 | + if: |
| 95 | + matrix.groonga-version == 'master' |
| 96 | + run: | |
| 97 | + sudo env MAKEFLAGS=-j$(nproc) gem install \ |
| 98 | + grntest \ |
| 99 | + pkg-config \ |
| 100 | + red-arrow |
| 101 | + - name: Set environment variables |
| 102 | + run: | |
| 103 | + echo "LD_LIBRARY_PATH=/tmp/local/lib" >> ${GITHUB_ENV} |
| 104 | + echo "TZ=Asia/Tokyo" >> ${GITHUB_ENV} |
| 105 | +
|
| 106 | + echo "/tmp/local/bin" >> ${GITHUB_PATH} |
| 107 | + echo "/tmp/local/sbin" >> ${GITHUB_PATH} |
| 108 | + - uses: actions/cache@v3 |
| 109 | + with: |
| 110 | + path: | |
| 111 | + ~/.cache/red-datasets |
| 112 | + key: red-datasets-ubuntu |
| 113 | + - name: "Test: HTTP: groonga-httpd" |
| 114 | + run: | |
| 115 | + cd groonga |
| 116 | + grntest \ |
| 117 | + --base-dir test/command \ |
| 118 | + --groonga-httpd=nginx \ |
| 119 | + --n-retries=3 \ |
| 120 | + --read-timeout=30 \ |
| 121 | + --reporter=mark \ |
| 122 | + --testee groonga-httpd \ |
| 123 | + test/command/suite |
0 commit comments