Skip to content

Add wildcards to each search token (#48) #88

Add wildcards to each search token (#48)

Add wildcards to each search token (#48) #88

Workflow file for this run

name: Tests
on:
push:
branches:
- master
pull_request_target:
types: [opened, synchronize, reopened]
jobs:
test-all:
name: Test PHP ${{ matrix.php-version }} targeting ${{ matrix.db-connection }}
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-version: ['8.0', '8.1', '8.2']
db-connection: ['sqlite_inmemory', 'sqlite_file', 'mysql', 'pgsql', 'sqlsrv']
include:
- operating-system: 'ubuntu-latest'
php-version: '8.2'
db-connection: 'sqlite_inmemory'
run-sonarqube-analysis: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Shutdown Ubuntu built-in MySQL
if: matrix.db-connection == 'mysql'
run: sudo service mysql stop
- name: Setup MySQL 8.0
uses: haltuf/mysql-action@master
if: matrix.db-connection == 'mysql'
with:
host port: 3306
character set server: 'utf8mb4'
collation server: 'utf8mb4_general_ci'
mysql version: '8.0'
mysql database: 'scoutdb'
mysql user: 'scoutdb'
mysql password: ${{ secrets.TESTS_MYSQL_DB_SECRET }}
authentication plugin: 'mysql_native_password'
- name: Setup PostgreSQL 13.1
uses: harmon758/postgresql-action@v1
if: matrix.db-connection == 'pgsql'
with:
postgresql version: '13.1'
postgresql db: 'scoutdb'
postgresql user: 'scoutdb'
postgresql password: ${{ secrets.TESTS_PGSQL_DB_SECRET }}
- name: Setup SQL Server 2017
uses: 280780363/sqlserver-action@v1.0
if: matrix.db-connection == 'sqlsrv'
with:
accept eula: 'Y'
sa password: ${{ secrets.TESTS_SQLSRV_DB_SECRET }}
- name: Setup PHPUnit
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: phpunit:9.5.0
coverage: pcov
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Run phpunit tests
run: composer test
env:
DB_CONNECTION: ${{ matrix.db-connection }}
DB_MYSQL_DATABASE: 'scoutdb'
DB_MYSQL_USERNAME: 'scoutdb'
DB_MYSQL_PASSWORD: ${{ secrets.TESTS_MYSQL_DB_SECRET }}
DB_PGSQL_DATABASE: 'scoutdb'
DB_PGSQL_USERNAME: 'scoutdb'
DB_PGSQL_PASSWORD: ${{ secrets.TESTS_PGSQL_DB_SECRET }}
DB_SQLSRV_DATABASE: 'master'
DB_SQLSRV_USERNAME: 'sa'
DB_SQLSRV_PASSWORD: ${{ secrets.TESTS_SQLSRV_DB_SECRET }}
- name: Prepare paths for SonarQube analysis
if: matrix.run-sonarqube-analysis
run: |
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" phpunit.coverage-clover.xml
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" phpunit.report-junit.xml
- name: Run SonarQube analysis
uses: sonarsource/sonarcloud-github-action@master
if: matrix.run-sonarqube-analysis
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}