Skip to content

Tests

Tests #1511

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches:
- master
- '[0-9]+.x'
schedule:
- cron: '0 0 * * *'
jobs:
tests:
services:
search-server:
image: opensearchproject/opensearch
ports:
- 9200:9200
env:
discovery.type: single-node
plugins.security.disabled: 'true'
OPENSEARCH_INITIAL_ADMIN_PASSWORD: ${{ secrets.OPENSEARCH_INITIAL_ADMIN_PASSWORD }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: ['8.0', 8.1, 8.2, 8.3, 8.4]
stability: [lowest, highest]
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@2.31.1
with:
php-version: ${{ matrix.php }}
coverage: xdebug
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- if: matrix.php == '8.1'
name: Require packages for PHP 8.1
run: composer require orchestra/testbench:'^6.23 || ^7.0 || ^8.0 || ^9.0' --no-update --dev
- if: matrix.php >= '8.2'
name: Require packages for PHP greater than 8.2
run: composer require orchestra/testbench:'^6.23 || ^7.0 || ^8.0 || ^9.0' nesbot/carbon:'^2.62.1 || ^3.4' --no-update --dev
- name: Install dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.stability }}
- name: Wait for Search server
run: php ./.github/wait_for_search_server.php
- name: Execute tests
run: composer run-script test:phpunit -- --coverage-clover coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage to Code Climate
uses: paambaati/codeclimate-action@v9.0.0
continue-on-error: true
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: ls
coverageLocations: ${{github.workspace}}/coverage.xml:clover