Skip to content

Commit 1b25385

Browse files
committed
ci: add github actions
1 parent f034c74 commit 1b25385

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

.github/workflows/run-tests.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: run-tests
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: 8.2
23+
extensions: json, mbstring, pcntl, intl, fileinfo, sqlite, pdo_sqlite
24+
coverage: pcov
25+
26+
- name: Setup problem matchers
27+
run: |
28+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
29+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
30+
31+
- name: Install dependencies
32+
run: |
33+
composer install --no-interaction --prefer-dist --no-progress --no-suggest
34+
35+
- name: Check code formatting with PHP CS Fixer
36+
run: |
37+
vendor/bin/php-cs-fixer fix --dry-run --diff --ansi
38+
39+
- name: Analyze code statically with PHPStan
40+
run: |
41+
vendor/bin/phpstan
42+
43+
- name: Execute tests
44+
run: |
45+
cp phpunit.xml.dist phpunit.xml
46+
vendor/bin/pest --coverage
47+
48+
- name: Prepare paths for SonarQube analysis
49+
run: |
50+
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" build/logs/clover.xml
51+
sed -i "s|$GITHUB_WORKSPACE|/github/workspace|g" build/report.junit.xml
52+
53+
- name: Run SonarQube analysis
54+
uses: sonarsource/sonarqube-scan-action@master
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)