-
Notifications
You must be signed in to change notification settings - Fork 9
92 lines (88 loc) · 3.16 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Test
on:
push:
branches: ['*']
jobs:
test:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- php-version: '8.1'
db-image: mariadb
db-version: '10.5'
- php-version: '8.1'
db-image: mariadb
db-version: '10.11'
- php-version: '8.2'
db-image: mariadb
db-version: '11.4'
- php-version: '8.3'
db-image: mysql
db-version: '8.0.22'
- php-version: '8.3'
db-image: mysql
db-version: '8.4.0'
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.2' }}
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.2' }}
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.2' }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Setup SonarQube
if: ${{ github.repository_owner == 'tkhamez' && matrix.php-version == '8.2' }}
uses: warchant/setup-sonar-scanner@v7
- name: SonarQube Scan
if: ${{ github.repository_owner == 'tkhamez' && matrix.php-version == '8.2' }}
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/