firefly-iii/.github/workflows/sonarcloud.yml

102 lines
2.6 KiB
YAML
Raw Normal View History

2023-10-22 01:22:53 -05:00
name: 'Code - Run Sonarcloud'
on:
2023-10-22 01:22:53 -05:00
pull_request:
2023-10-28 10:38:42 -05:00
workflow_dispatch:
push:
branches:
- main
- develop
env:
DB_CONNECTION: mysql
DB_HOST: "127.0.0.1"
DB_DATABASE: firefly
DB_USER: firefly
DB_PASSWORD: secret_firefly_password
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:latest
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: yes
MYSQL_USER: ${{ env.DB_USER }}
MYSQL_PASSWORD: ${{ env.DB_PASSWORD }}
MYSQL_DATABASE: ${{ env.DB_DATABASE }}
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
2023-07-03 09:37:11 -05:00
- name: Checkout
2023-10-29 11:52:01 -05:00
uses: actions/checkout@v3
2023-07-03 09:37:11 -05:00
with:
fetch-depth: 0
- name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: xdebug
extensions: >-
bcmath
curl
fileinfo
iconv
intl
json
2023-10-29 11:52:01 -05:00
mysql
mbstring
openssl
pdo
session
simplexml
sodium
tokenizer
xml
xmlwriter
2023-07-03 09:37:11 -05:00
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts
- name: Verify Database connection
env:
PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
while ! mysqladmin ping -h"${{env.DB_HOST}}" -P"${PORT}" --silent; do
sleep 1
done
2023-07-03 09:37:11 -05:00
- name: Copy environment file
run: sed 's@DB_HOST=.*@DB_HOST=${{env.DB_HOST}}@g' .env.example > .env
2023-07-03 09:37:11 -05:00
- name: Generate app key
run: php artisan key:generate
- name: "Create the database"
run: php artisan firefly-iii:create-database
- name: "Upgrades the database to the latest version"
run: php artisan firefly-iii:upgrade-database
- name: "Integrity Database Report"
run: php artisan firefly-iii:report-integrity
2023-07-03 09:37:11 -05:00
- name: "Run tests with coverage"
run: composer coverage
- name: Fix code coverage paths
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}