|
| 1 | +name: tests |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: phpunit-tests-${{ github.ref_name }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +on: ['push', 'pull_request', 'workflow_dispatch'] |
| 8 | + |
| 9 | +env: |
| 10 | + ELASTICSEARCH_PORT: 9201 |
| 11 | + |
| 12 | +jobs: |
| 13 | + static_code_analysis: |
| 14 | + runs-on: 'ubuntu-20.04' |
| 15 | + name: 'Static code analysis' |
| 16 | + steps: |
| 17 | + - name: Setup PHP |
| 18 | + uses: shivammathur/setup-php@v2 |
| 19 | + with: |
| 20 | + php-version: '8.1' |
| 21 | + |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: 'Validate composer.json and composer.lock' |
| 26 | + run: composer validate |
| 27 | + |
| 28 | + - name: 'Install dependencies with Composer' |
| 29 | + uses: 'ramsey/composer-install@v2' |
| 30 | + with: |
| 31 | + dependency-versions: 'highest' |
| 32 | + composer-options: '--prefer-dist' |
| 33 | + |
| 34 | + - name: Check PHP coding standards |
| 35 | + run: php vendor/bin/php-cs-fixer fix --verbose --dry-run |
| 36 | + |
| 37 | + phpunit: |
| 38 | + needs: [ static_code_analysis ] |
| 39 | + runs-on: 'ubuntu-20.04' |
| 40 | + name: 'PHPUnit (PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, ES ${{ matrix.elasticsearch }})' |
| 41 | + timeout-minutes: 30 |
| 42 | + continue-on-error: ${{ matrix.experimental }} |
| 43 | + strategy: |
| 44 | + matrix: |
| 45 | + experimental: |
| 46 | + - false |
| 47 | + dependencies: |
| 48 | + - 'highest' |
| 49 | + php: |
| 50 | + - '8.1' |
| 51 | + - '8.2' |
| 52 | + elasticsearch: |
| 53 | + - '7.17.13' |
| 54 | + symfony: |
| 55 | + - '~5.0' |
| 56 | + include: |
| 57 | + - php: '8.1' |
| 58 | + symfony: '~5.0' |
| 59 | + elasticsearch: '8.0.1' |
| 60 | + experimental: false |
| 61 | + - php: '8.1' |
| 62 | + symfony: '~5.0' |
| 63 | + elasticsearch: '8.1.3' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.1.html#breaking-changes-8.1 |
| 64 | + experimental: false |
| 65 | + - php: '8.1' |
| 66 | + symfony: '~5.0' |
| 67 | + elasticsearch: '8.5.3' # there are some bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.5.html |
| 68 | + experimental: false |
| 69 | + - php: '8.1' |
| 70 | + symfony: '~5.0' |
| 71 | + elasticsearch: '8.6.2' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.6.html |
| 72 | + experimental: false |
| 73 | + - php: '8.1' |
| 74 | + symfony: '~5.0' |
| 75 | + elasticsearch: '8.7.1' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.7.html |
| 76 | + experimental: false |
| 77 | + - php: '8.1' |
| 78 | + symfony: '~5.0' |
| 79 | + elasticsearch: '8.8.0' # there are no bc in minor version https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.8.html |
| 80 | + experimental: false |
| 81 | + - php: '8.1' |
| 82 | + symfony: '~6.0' |
| 83 | + elasticsearch: '8.10.2' # newest version |
| 84 | + experimental: false |
| 85 | + fail-fast: false |
| 86 | + steps: |
| 87 | + - name: Checkout |
| 88 | + uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - name: Setup PHP |
| 91 | + uses: shivammathur/setup-php@v2 |
| 92 | + with: |
| 93 | + php-version: '${{ matrix.php }}' |
| 94 | + coverage: 'pcov' |
| 95 | + tools: 'composer:v2' |
| 96 | + extensions: 'curl, json, mbstring, openssl' |
| 97 | + ini-values: 'memory_limit=256M' |
| 98 | + |
| 99 | + - name: 'Fix symfony/framework-bundle version' |
| 100 | + run: composer require --no-update symfony/framework-bundle:${{ matrix.symfony }} |
| 101 | + |
| 102 | + - name: 'Install dependencies with Composer' |
| 103 | + uses: 'ramsey/composer-install@v2' |
| 104 | + with: |
| 105 | + dependency-versions: '${{ matrix.dependencies }}' |
| 106 | + composer-options: '--prefer-dist' |
| 107 | + |
| 108 | + - name: 'Dump composer autoloader' |
| 109 | + run: composer dump-autoload --classmap-authoritative --no-ansi --no-interaction --no-scripts |
| 110 | + |
| 111 | + - name: 'Setup Elasticsearch' |
| 112 | + env: |
| 113 | + ELASTICSEARCH_VERSION: ${{ matrix.elasticsearch }} |
| 114 | + run: docker compose up --detach --wait ; curl -XGET 'http://localhost:'"$ELASTICSEARCH_PORT" |
| 115 | + |
| 116 | + - name: 'Run phpunit tests' |
| 117 | + run: | |
| 118 | + vendor/bin/simple-phpunit --coverage-clover=tests/App/build/clover.xml 2>/dev/null |
| 119 | +
|
| 120 | + - name: Upload coverage results to Coveralls |
| 121 | + env: |
| 122 | + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }} |
| 123 | + run: | |
| 124 | + vendor/bin/php-coveralls --coverage_clover=tests/App/build/clover.xml --json_path=tests/App/build/coveralls.json -v |
0 commit comments