Repository navigation
Merge pull request #21 from pluginsGLPI/dependabot/github_actions/act… #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PHPUnit | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| pull_request: | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.ref }}" | |
| cancel-in-progress: true | |
| jobs: | |
| # ── Job 1 : tests unitaires purs (pas de base de données) ────────────────── | |
| unit-tests: | |
| name: "Unit tests (PHP ${{ matrix.php-version }})" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: ["8.3", "8.4"] | |
| steps: | |
| - name: Checkout GLPI core (shallow) | |
| uses: actions/checkout@v7 | |
| with: | |
| repository: glpi-project/glpi | |
| ref: 11.0/bugfixes | |
| path: glpi | |
| - name: Checkout plugin | |
| uses: actions/checkout@v7 | |
| with: | |
| path: glpi/plugins/vip | |
| - name: Setup PHP ${{ matrix.php-version }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: mbstring, openssl | |
| coverage: none | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v6 | |
| with: | |
| path: ~/.cache/composer | |
| key: composer-${{ matrix.php-version }}-${{ hashFiles('glpi/composer.lock') }} | |
| restore-keys: composer-${{ matrix.php-version }}- | |
| - name: Install GLPI Composer dependencies | |
| run: composer install --no-interaction --prefer-dist --no-progress | |
| working-directory: glpi | |
| - name: Run unit tests | |
| run: > | |
| php vendor/bin/phpunit | |
| --configuration plugins/vip/phpunit.xml | |
| --testsuite Unit | |
| working-directory: glpi | |
| # ── Job 2 : tests d'intégration (avec base de données GLPI) ──────────────── | |
| integration-tests: | |
| name: "Integration tests (PHP ${{ matrix.php-version }} / ${{ matrix.db-image }})" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - php-version: "8.3" | |
| db-image: "mysql:8.0" | |
| - php-version: "8.3" | |
| db-image: "mariadb:10.11" | |
| services: | |
| db: | |
| image: ${{ matrix.db-image }} | |
| env: | |
| MYSQL_ROOT_PASSWORD: "" | |
| MYSQL_ALLOW_EMPTY_PASSWORD: "yes" | |
| MYSQL_DATABASE: glpi_test | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping -uroot" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=10 | |
| steps: | |
| - name: Checkout GLPI core | |
| uses: actions/checkout@v7 | |
| with: | |
| repository: glpi-project/glpi | |
| ref: 11.0/bugfixes | |
| path: glpi | |
| - name: Checkout plugin | |
| uses: actions/checkout@v7 | |
| with: | |
| path: glpi/plugins/vip | |
| - name: Setup PHP ${{ matrix.php-version }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: mbstring, openssl, mysqli, pdo_mysql | |
| coverage: none | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v6 | |
| with: | |
| path: ~/.cache/composer | |
| key: composer-${{ matrix.php-version }}-${{ hashFiles('glpi/composer.lock') }} | |
| restore-keys: composer-${{ matrix.php-version }}- | |
| - name: Install GLPI Composer dependencies | |
| run: composer install --no-interaction --prefer-dist --no-progress | |
| working-directory: glpi | |
| - name: Build GLPI frontend dependencies | |
| run: | | |
| npm install --no-save | |
| npm run-script build | |
| working-directory: glpi | |
| - name: Compile GLPI locales | |
| run: | | |
| sudo apt-get install -y gettext | |
| php bin/console tools:locales:compile --allow-superuser | |
| working-directory: glpi | |
| - name: Install GLPI test database | |
| run: > | |
| php bin/console database:install | |
| --no-interaction --force | |
| --env=testing | |
| --db-host=127.0.0.1 | |
| --db-name=glpi_test | |
| --db-user=root | |
| --db-password="" | |
| working-directory: glpi | |
| - name: Install vip plugin | |
| run: | | |
| php bin/console glpi:plugin:install --no-interaction --env=testing vip | |
| php bin/console glpi:plugin:activate --no-interaction --env=testing vip | |
| working-directory: glpi | |
| - name: Run integration tests | |
| run: > | |
| php vendor/bin/phpunit | |
| --configuration plugins/vip/phpunit.integration.xml | |
| --testsuite Integration | |
| working-directory: glpi |