Skip to content

Support only PHP 8.3 #155

Support only PHP 8.3

Support only PHP 8.3 #155

name: Continuous Integration
on:
push:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened ]
env:
fail-fast: true
jobs:
build:
name: PHPUnit
runs-on: ubuntu-22.04
strategy:
matrix:
php-version:
- 8.3
mysql-version:
- 5.7
elasticsearch-version:
- 6.8.15
dependencies:
- lowest
- highest
services:
mysql:
image: mysql:${{ matrix.mysql-version }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: root
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
elasticsearch:
image: elasticsearch:${{ matrix.elasticsearch-version }}
env:
discovery.type: single-node
options: >-
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 9200:9200
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
extensions: ${{ matrix.extensions }}
- name: Install Composer Dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: "--prefer-stable"
- name: Setup databases
run: ./tests/App/bin/setup_databases.sh
env:
DEF_DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/default_db
PERSISTENCE_DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/persistence_db
MONOLITHIC_DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/monolithic_db
ELASTICSEARCH_URL: http://localhost:9200
DATABASE_SERVER_VERSION: ${{ matrix.mysql-version }}
- name: Run PHPUnit
run: vendor/bin/phpunit --log-junit tests/.results/tests-junit.xml --coverage-clover tests/.results/tests-clover.xml
env:
DEF_DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/default_db
PERSISTENCE_DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/persistence_db
MONOLITHIC_DATABASE_URL: mysql://root:[email protected]:${{ job.services.mysql.ports['3306'] }}/monolithic_db
ELASTICSEARCH_URL: http://localhost:9200
DATABASE_SERVER_VERSION: ${{ matrix.mysql-version }}
- name: Upload coverage files
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.php-version }}-${{ matrix.dependencies }}-coverage
include-hidden-files: true
path: tests/.results/
sonarcloud:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: build-8.3-highest-coverage
path: tests/.results/
- name: Fix Code Coverage Paths
working-directory: tests/.results/
run: |
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' tests-clover.xml
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' tests-junit.xml
- name: SonarCloud Scan
uses: sonarsource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}