Skip to content

Data mapper

Data mapper #101

Workflow file for this run

name: SonarCloud
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
postgres:
image: postgres:12
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
mongodb:
image: mongo
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
ports:
- 27017:27017
memcached:
image: memcached
ports:
- 11211:11211
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server
strategy:
fail-fast: true
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2
coverage: xdebug
extensions: redis
- name: Install dependencies
run: composer install
- name: Load Mysql database
run: mysql -uroot -h0.0.0.0 -ppassword < vendor/linna/db-dumps/src/linna_db_mysql_test.sql
- name: Load Postgres database
run: PGPASSWORD=password psql -U postgres -h0.0.0.0 -a -f vendor/linna/db-dumps/src/linna_db_pgsql.sql
- name: Execute tests
run: vendor/bin/phpunit --coverage-clover=coverage-report.clover --log-junit=test-report.xml
- name: Fix code coverage paths
run: sed -i 's/\/home\/runner\/work\/framework\/framework\//\/github\/workspace\//g' coverage-report.clover
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=linna
-Dsonar.projectKey=linna_framework
-Dsonar.sources=src
-Dsonar.tests=tests
-Dsonar.language=php
-Dsonar.sourceEncoding=UTF-8
-Dsonar.php.coverage.reportPaths=coverage-report.clover
-Dsonar.php.tests.reportPath=test-report.xml