-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
87 lines (85 loc) · 3.18 KB
/
coverage.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
name: "GLPI test code coverage"
on:
# Runs coverage suite when a pull request updates workflow file
pull_request:
paths:
- ".github/workflows/coverage.yml"
# Runs coverage suite every night
schedule:
- cron: '0 0 * * *'
# Enable manual run
workflow_dispatch:
jobs:
coverage:
# Do not run scheduled coverage on tier repositories
if: github.repository == 'glpi-project/glpi' || github.event_name != 'schedule'
name: "Code coverage"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
include:
- {branch: "main", php-version: "8.1", db-image: "mariadb:10.11"}
env:
COMPOSE_FILE: ".github/actions/docker-compose-app.yml:.github/actions/docker-compose-services.yml"
APPLICATION_ROOT: "${{ github.workspace }}"
DB_IMAGE: "githubactions-${{ matrix.db-image }}"
PHP_IMAGE: "githubactions-php-coverage:${{ matrix.php-version }}"
UPDATE_FILES_ACL: true
CODE_COVERAGE: true
steps:
- name: "Clean workspace"
if: env.skip != 'true'
run: |
echo "APP_CONTAINER_HOME=${{ runner.temp }}/app_home" >> $GITHUB_ENV
rm -rf "${{ env.APPLICATION_ROOT }}/*"
rm -rf "${{ env.APP_CONTAINER_HOME }}/*"
- name: "Checkout"
uses: "actions/checkout@v3"
with:
ref: ${{ matrix.branch }}
- name: "Restore dependencies cache"
uses: actions/cache@v3
with:
path: |
${{ env.APP_CONTAINER_HOME }}/.composer/cache/
${{ env.APP_CONTAINER_HOME }}/.npm/_cacache/
key: "app_home_deps-${{ matrix.php-version }}-${{ hashFiles('composer.lock', 'package-lock.json') }}"
restore-keys: |
app_home_deps-${{ matrix.php-version }}-
app_home_deps-
- name: "Initialize containers"
run: |
.github/actions/init_containers-start.sh
- name: "Show versions"
run: |
.github/actions/init_show-versions.sh
- name: "Build dependencies / translations"
run: |
docker-compose exec -T app .github/actions/init_build.sh
- name: "Install database"
run: |
docker-compose exec -T app .github/actions/test_install.sh
- name: "Unit tests"
run: |
docker-compose exec -T app .github/actions/test_tests-units.sh
- name: "Functional tests"
run: |
docker-compose exec -T app .github/actions/test_tests-functional.sh
- name: "LDAP tests"
run: |
.github/actions/init_initialize-ldap-fixtures.sh
docker-compose exec -T app .github/actions/test_tests-ldap.sh
- name: "IMAP tests"
run: |
.github/actions/init_initialize-imap-fixtures.sh
docker-compose exec -T app .github/actions/test_tests-imap.sh
- name: "Codecov"
uses: "codecov/codecov-action@v3.1.2"
with:
files: ./tests/coverage-unit/clover.xml,./tests/coverage-functional/clover.xml,./tests/coverage-ldap/clover.xml,./tests/coverage-imap/clover.xml
override_branch: ${{ matrix.branch }}
- name: "Cleanup containers"
if: always()
run: |
.github/actions/teardown_containers-cleanup.sh