Run Tests #2369
This file contains 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: Run Tests | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 8 * * *' # run at 08:00 UTC | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: [8.0, 8.1, 8.2] | |
solr: [7, 8, 9] | |
mode: [cloud, server] | |
name: PHP ${{ matrix.php }}, Solr ${{ matrix.solr }} ${{ matrix.mode }} | |
env: | |
COMPOSER_MEMORY_LIMIT: -1 | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, iconv, json, simplexml | |
ini-values: memory_limit=256M, post_max_size=256M, zend.exception_ignore_args=Off | |
coverage: pcov | |
- name: Checkout solarium | |
uses: actions/checkout@v2 | |
- name: Checkout solr 7.7 | |
if: matrix.solr == 7 | |
uses: actions/checkout@v2 | |
with: | |
repository: apache/lucene-solr | |
ref: branch_7_7 | |
path: lucene-solr | |
- name: Checkout solr 8.11 | |
if: matrix.solr == 8 | |
uses: actions/checkout@v2 | |
with: | |
repository: apache/lucene-solr | |
ref: branch_8_11 | |
path: lucene-solr | |
- name: Checkout solr 9.3 | |
if: matrix.solr == 9 | |
uses: actions/checkout@v2 | |
with: | |
repository: apache/solr | |
ref: branch_9_3 | |
path: lucene-solr | |
- name: Start Solr ${{ matrix.solr }} in ${{ matrix.mode }} mode | |
run: | | |
chmod -R a+w lucene-solr | |
cd lucene-solr | |
patch -p1 < ../tests/Integration/Fixtures/solrconf.patch | |
patch -p1 < ../tests/Integration/Fixtures/schema${{ matrix.solr }}.patch | |
cd solr/server/solr/configsets/sample_techproducts_configs/conf | |
zip -r techproducts.zip * | |
cd - | |
mv solr/server/solr/configsets/sample_techproducts_configs/conf/techproducts.zip ../tests/Integration/Fixtures/ | |
cd ../tests/Integration/Fixtures/docker/solr${{ matrix.solr }}_${{ matrix.mode }} | |
docker-compose up -d | |
- name: Install dependencies | |
run: | | |
composer update | |
sed -i "s/'dev-.*'/'76.5.4'/g" vendor/composer/installed.php | |
- name: Run tests | |
run: | | |
vendor/bin/phpstan analyze src/ tests/ --level=1 --memory-limit=1G | |
vendor/bin/phpunit -c phpunit.xml --exclude-group skip_for_solr_${{ matrix.mode }} -v --coverage-clover build/logs/clover.xml | |
- name: Execute examples | |
run: | | |
cd examples | |
php execute_all.php | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: PHP_${{ matrix.php }}-Solr_${{ matrix.solr }}_${{ matrix.mode }} | |
path: build/logs | |
coverage: | |
runs-on: ubuntu-latest | |
name: Upload coverage to codecov.io | |
needs: [run-tests] | |
steps: | |
- name: Checkout solarium | |
uses: actions/checkout@v2 | |
- name: Download coverage reports from tests | |
uses: actions/download-artifact@v2 | |
- name: List report files | |
run: | | |
ls -l PHP*/clover*.xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: PHP*/clover*.xml | |
flags: unittests | |
name: solarium | |
fail_ci_if_error: false | |
verbose: false |