Release 4.0.0 #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: PHP ${{ matrix.php }} / ${{ matrix.driver }} / ${{ matrix.search_build }} | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| packages: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['8.2', '8.3'] | |
| driver: [mysqli, pdo] | |
| search_build: [SPHINX2, SPHINX3, MANTICORE] | |
| env: | |
| DRIVER: ${{ matrix.driver }} | |
| SEARCH_BUILD: ${{ matrix.search_build }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| extensions: mysqli, pdo_mysql, mbstring | |
| tools: composer:v2 | |
| - name: Resolve search image and group exclusions | |
| id: vars | |
| run: | | |
| EXCLUDE_GROUP="" | |
| SEARCH_IMAGE="" | |
| SEARCH_DOCKERFILE="" | |
| case "$SEARCH_BUILD" in | |
| SPHINX2) | |
| SEARCH_IMAGE="ghcr.io/foolcode/sphinxql-query-builder-search-sphinx2:sphinx2-latest" | |
| SEARCH_DOCKERFILE="docker/search/sphinx2/Dockerfile" | |
| EXCLUDE_GROUP="--exclude-group=Manticore" | |
| ;; | |
| SPHINX3) | |
| SEARCH_IMAGE="ghcr.io/foolcode/sphinxql-query-builder-search-sphinx3:sphinx3-latest" | |
| SEARCH_DOCKERFILE="docker/search/sphinx3/Dockerfile" | |
| EXCLUDE_GROUP="--exclude-group=Manticore" | |
| ;; | |
| MANTICORE) | |
| SEARCH_IMAGE="ghcr.io/foolcode/sphinxql-query-builder-search-manticore:manticore-latest" | |
| SEARCH_DOCKERFILE="docker/search/manticore/Dockerfile" | |
| ;; | |
| *) | |
| echo "Unknown SEARCH_BUILD: $SEARCH_BUILD" | |
| exit 1 | |
| ;; | |
| esac | |
| { | |
| echo "search_image=$SEARCH_IMAGE" | |
| echo "search_dockerfile=$SEARCH_DOCKERFILE" | |
| echo "exclude_group=$EXCLUDE_GROUP" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Fetch search image | |
| run: | | |
| if ! docker pull "${{ steps.vars.outputs.search_image }}"; then | |
| echo "Unable to pull image, building from repository Dockerfile fallback." | |
| docker build -f "${{ steps.vars.outputs.search_dockerfile }}" -t "${{ steps.vars.outputs.search_image }}" . | |
| fi | |
| - name: Start search daemon container | |
| run: | | |
| docker run -d --name searchd \ | |
| -p 9307:9307 \ | |
| -p 9312:9312 \ | |
| "${{ steps.vars.outputs.search_image }}" | |
| - name: Wait for searchd | |
| run: | | |
| n=0 | |
| while [ "$n" -lt 60 ]; do | |
| if (echo > /dev/tcp/127.0.0.1/9307) >/dev/null 2>&1; then | |
| exit 0 | |
| fi | |
| n=$((n + 1)) | |
| sleep 1 | |
| done | |
| echo "searchd did not become ready on 127.0.0.1:9307" | |
| docker logs searchd || true | |
| exit 1 | |
| - name: Validate composer metadata | |
| run: composer validate --strict --no-check-publish | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-interaction --no-progress | |
| - name: Prepare autoload | |
| run: composer dump-autoload | |
| - name: Run tests | |
| run: | | |
| ./vendor/bin/phpunit --configuration "tests/travis/${DRIVER}.phpunit.xml" --coverage-text ${{ steps.vars.outputs.exclude_group }} | |
| - name: Upload debug artifacts on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ci-debug-php${{ matrix.php }}-${{ matrix.driver }}-${{ matrix.search_build }} | |
| if-no-files-found: ignore | |
| path: | | |
| tests/searchd.log | |
| tests/searchd.pid | |
| tests/data/* | |
| - name: Show searchd logs | |
| if: always() | |
| run: docker logs searchd || true | |
| - name: Stop searchd container | |
| if: always() | |
| run: docker rm -f searchd || true |