generated from SolidWorx/project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (80 loc) · 2.69 KB
/
unit-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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Unit Tests
on: [ pull_request ]
jobs:
unit:
name: Unit ( PHP ${{ matrix.php }} )
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
php: [ '8.2', '8.3' ]
fail-fast: false
env:
APP_ENV: test
APP_DEBUG: 0
steps:
- name: Checkout
uses: actions/checkout@v4.2.1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: xdebug
php-version: ${{ matrix.php }}
extensions: intl, ctype, iconv
- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""
- name: "Set up problem matchers for phpunit/phpunit"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\""
- uses: "ramsey/composer-install@v3"
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun run build
- name: Create Database
run: bin/console --env=test doctrine:database:create
- name: Create Schema
run: bin/console --env=test doctrine:schema:create
- name: Run test suite
run: vendor/bin/phpunit
coverage:
name: Code Coverage ( PHP ${{ matrix.php }} )
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
php:
- 8.2
fail-fast: false
env:
APP_ENV: test
APP_DEBUG: 0
steps:
- name: Checkout
uses: actions/checkout@v4.2.1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: xdebug
php-version: ${{ matrix.php }}
extensions: intl, ctype, iconv
- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""
- name: "Set up problem matchers for phpunit/phpunit"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\""
- uses: "ramsey/composer-install@v3"
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun run build
- name: Create Database
run: bin/console --env=test doctrine:database:create
- name: Create Schema
run: bin/console --env=test doctrine:schema:create
- name: Run test suite
run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml
- name: Upload coverage results to Coveralls
if: matrix.coverage
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require --prefer-dist --no-interaction --no-progress --ansi php-coveralls/php-coveralls
export PATH="$PATH:$HOME/.composer/vendor/bin"
php-coveralls --coverage_clover=build/logs/clover.xml -v