-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (49 loc) · 1.66 KB
/
run-tests.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
name: run-tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: json, mbstring, pcntl, intl, fileinfo
coverage: xdebug
- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer install --no-interaction --prefer-dist --no-progress --no-suggest
- name: Check code formatting with PHP CS Fixer
run: |
vendor/bin/php-cs-fixer fix --dry-run --diff --ansi
- name: Check quality code with PHPInsights
run: |
vendor/bin/phpinsights -n --ansi --format=github-action
- name: Analyze code statically with PHPStan
run: |
vendor/bin/phpstan
- name: Execute tests
run: |
cp phpunit.xml.dist phpunit.xml
vendor/bin/pest --coverage
- name: Prepare paths for SonarQube analysis
run: |
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" build/logs/clover.xml
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" build/report.junit.xml
- name: Run SonarQube analysis
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}