Skip to content

GLPI test code coverage #154

GLPI test code coverage

GLPI test code coverage #154

Workflow file for this run

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.2", db-image: "mariadb:11.0"}
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@v4"
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.4"
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