2023-10-22 01:22:53 -05:00
|
|
|
name: 'Code - Run Sonarcloud'
|
2023-06-02 22:52:50 -05:00
|
|
|
on:
|
2023-10-22 01:22:53 -05:00
|
|
|
pull_request:
|
2023-10-28 10:38:42 -05:00
|
|
|
workflow_dispatch:
|
2023-06-02 22:52:50 -05:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- develop
|
2023-10-20 17:00:45 -05:00
|
|
|
env:
|
|
|
|
DB_CONNECTION: mysql
|
|
|
|
DB_HOST: "127.0.0.1"
|
|
|
|
DB_DATABASE: firefly
|
|
|
|
DB_USER: firefly
|
|
|
|
DB_PASSWORD: secret_firefly_password
|
|
|
|
|
2023-06-02 22:52:50 -05:00
|
|
|
jobs:
|
|
|
|
sonarcloud:
|
|
|
|
name: SonarCloud
|
|
|
|
runs-on: ubuntu-latest
|
2023-10-20 17:00:45 -05:00
|
|
|
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
|
|
|
|
|
2023-06-02 22:52:50 -05:00
|
|
|
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
|
2023-10-20 17:00:45 -05:00
|
|
|
extensions: >-
|
|
|
|
bcmath
|
|
|
|
curl
|
|
|
|
fileinfo
|
|
|
|
iconv
|
|
|
|
intl
|
|
|
|
json
|
2023-10-29 11:52:01 -05:00
|
|
|
mysql
|
2023-10-20 17:00:45 -05:00
|
|
|
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
|
|
|
|
|
2023-10-20 17:00:45 -05:00
|
|
|
- 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
|
2023-10-20 17:00:45 -05:00
|
|
|
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
|
|
|
|
|
2023-10-20 17:00:45 -05:00
|
|
|
- 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
|
|
|
|
|
2023-06-02 22:52:50 -05:00
|
|
|
- name: SonarCloud Scan
|
|
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|