Skip to content

Commit fe4eb24

Browse files
committed
5564: Update test action to report code coverage
1 parent 23daf7a commit fe4eb24

3 files changed

Lines changed: 50 additions & 31 deletions

File tree

.github/workflows/pr.yaml

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,74 @@ env:
66
on: pull_request
77

88
jobs:
9-
phpstan:
10-
name: PHPStan static analysis
9+
test-suite:
10+
name: Test suite
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v5
13+
- uses: actions/checkout@v5
1514

16-
- name: Create docker network
15+
- name: Install Task
16+
uses: go-task/setup-task@v1
17+
18+
- name: Setup docker network
1719
run: |
1820
docker network create frontend
1921
20-
- name: Run phpstan
22+
- name: Install Site
23+
run: |
24+
task site:install
25+
26+
- name: Test suite
2127
run: |
22-
docker compose run --rm phpfpm composer install
23-
docker compose run --rm phpfpm vendor/bin/phpstan analyse src --no-progress --error-format=github --memory-limit=1G
28+
task test:setup
29+
task test
2430
25-
phpunit:
26-
name: PHP Unit tests
31+
- name: Upload coverage to Codecov test
32+
uses: codecov/codecov-action@v5
33+
with:
34+
files: ./coverage/unit.xml
35+
flags: unittests
36+
env:
37+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
38+
39+
phpstan:
40+
name: PHPStan
2741
runs-on: ubuntu-latest
2842
steps:
29-
- name: Checkout
30-
uses: actions/checkout@v5
43+
- uses: actions/checkout@v5
3144

32-
- name: Install site
45+
- name: Install Task
46+
uses: go-task/setup-task@v1
47+
48+
- name: Start docker compose setup
3349
run: |
3450
docker network create frontend
35-
docker compose pull
36-
docker compose up --detach
37-
docker compose exec --user=root phpfpm composer install
38-
docker compose exec phpfpm bin/console doctrine:migrations:migrate --no-interaction
51+
task compose -- up --detach
52+
53+
- name: Install Dependencies
54+
run: |
55+
task composer -- install
3956
40-
- name: Run tests
57+
- name: Run PHPStan
4158
run: |
42-
docker compose exec phpfpm composer run tests
59+
task code-analysis:phpstan
4360
4461
fixtures:
4562
name: Load fixtures
4663
runs-on: ubuntu-latest
4764
steps:
48-
- name: Checkout
49-
uses: actions/checkout@v5
50-
with:
51-
fetch-depth: 2
65+
- uses: actions/checkout@v5
66+
67+
- name: Install Task
68+
uses: go-task/setup-task@v1
5269

53-
- name: Install site
70+
- name: Setup docker network
5471
run: |
5572
docker network create frontend
56-
docker compose pull
57-
docker compose up --detach
58-
docker compose exec --user=root phpfpm composer install
59-
docker compose exec phpfpm bin/console doctrine:migrations:migrate --no-interaction
73+
74+
- name: Install Site
75+
run: |
76+
task site:install
6077
6178
- name: Load fixtures
6279
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ phpstan.neon
3939
/public/assets/
4040
/assets/vendor/
4141
###< symfony/asset-mapper ###
42+
coverage

Taskfile.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ vars:
1212
tasks:
1313
site:update:
1414
desc: Update/install site
15+
aliases: [site:install]
1516
cmds:
1617
- task: compose
1718
vars:
@@ -179,12 +180,12 @@ tasks:
179180
vars:
180181
CONSOLE_ARGS: doctrine:migrations:migrate --no-interaction --quiet
181182

182-
test:run:
183-
desc: "Run phpunit tests"
183+
test:
184+
desc: "Run tests"
184185
cmds:
185186
- task: compose
186187
vars:
187-
COMPOSE_ARGS: exec phpfpm bin/phpunit
188+
COMPOSE_ARGS: exec --env XDEBUG_MODE=coverage phpfpm vendor/bin/phpunit --coverage-clover=coverage/unit.xml
188189

189190
api:spec:export:
190191
desc: "Export API spec"

0 commit comments

Comments
 (0)