Update GitHub workflows. #278
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: ['*'] | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
include: | |
- php-version: '8.0' | |
db-image: mariadb | |
db-version: '10.5' | |
- php-version: '8.1' | |
db-image: mariadb | |
db-version: '10.11' | |
- php-version: '8.1' | |
db-image: mariadb | |
db-version: '11.0' | |
- php-version: '8.2' | |
db-image: mysql | |
db-version: '8.0.22' | |
- php-version: '8.2' | |
db-image: mysql | |
db-version: '8.0.34' | |
fail-fast: false | |
services: | |
database: | |
image: ${{ matrix.db-image }}:${{ matrix.db-version }} | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: test | |
ports: ['3306:3306'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: gmp, xdebug, apcu | |
ini-values: apc.enable_cli=1 | |
tools: composer:v2 | |
- name: Install | |
run: cd backend && composer install | |
- name: Test with code coverage | |
if: ${{ github.repository_owner == 'tkhamez' && matrix.php-version == '8.0' }} | |
env: | |
NEUCORE_APP_ENV: dev | |
NEUCORE_TEST_DATABASE_URL: 'mysql://root:@127.0.0.1/test' | |
NEUCORE_EVE_CLIENT_ID: '123' | |
NEUCORE_EVE_SECRET_KEY: 'abc' | |
NEUCORE_EVE_CALLBACK_URL: 'http://localhost' | |
run: cd backend && vendor/bin/phpunit --coverage-clover var/logs/clover.xml | |
- name: Test | |
if: ${{ github.repository_owner != 'tkhamez' || matrix.php-version != '8.0' }} | |
env: | |
NEUCORE_APP_ENV: dev | |
NEUCORE_TEST_DATABASE_URL: 'mysql://root:@127.0.0.1/test' | |
NEUCORE_EVE_CLIENT_ID: '123' | |
NEUCORE_EVE_SECRET_KEY: 'abc' | |
NEUCORE_EVE_CALLBACK_URL: 'http://localhost' | |
run: cd backend && vendor/bin/phpunit | |
- name: Setup Java | |
if: ${{ github.repository_owner == 'tkhamez' && matrix.php-version == '8.0' }} | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Setup SonarQube | |
if: ${{ github.repository_owner == 'tkhamez' && matrix.php-version == '8.0' }} | |
uses: warchant/setup-sonar-scanner@v7 | |
- name: SonarQube Scan | |
if: ${{ github.repository_owner == 'tkhamez' && matrix.php-version == '8.0' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: sonar-scanner | |
-Dsonar.token=${{ secrets.SONAR_TOKEN }} | |
-Dsonar.projectKey=tkhamez_neucore | |
-Dsonar.organization=tkhamez | |
-Dsonar.sources=backend/src,frontend/src | |
-Dsonar.tests=backend/tests | |
-Dsonar.php.coverage.reportPaths=backend/var/logs/clover.xml | |
-Dsonar.coverage.exclusions=backend/src/Migrations/*,frontend/src/** | |
-Dsonar.cpd.exclusions=backend/src/Migrations/* | |
-Dsonar.host.url=https://sonarcloud.io/ |