WebProject-xyz/ikea-tradfri-php

View on GitHub
.github/workflows/cocdeception.yml

Summary

Maintainability
Test Coverage
on: [ push, pull_request ]
name: "Unit Tests"

jobs:
    codeception-tests:
        name: "Codeception tests"
        runs-on: "ubuntu-latest"
        continue-on-error: ${{ matrix.allow-fail }}
        strategy:
            matrix:
                include:
                    - { php-version: 8.2, dependencies: locked, coverage: none, with_coverage: true, allow-fail: false }
                    - { php-version: 8.2, dependencies: highest, coverage: none, with_coverage: false, allow-fail: false }

                    - { php-version: 8.3, dependencies: locked, coverage: none, with_coverage: false, allow-fail: true }
                    - { php-version: 8.3, dependencies: highest, coverage: none, with_coverage: false, allow-fail: false }
        steps:
            -   name: "Checkout"
                uses: "actions/checkout@v4.1.6"

            -   name: "Install PHP"
                uses: "shivammathur/setup-php@2.30.5"
                with:
                    coverage: "${{ matrix.coverage }}"
                    ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767
                    php-version: "${{ matrix.php-version }}"

            -   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\""

            -   name: "Validate composer.json and composer.lock"
                run: "composer validate --ansi --strict"

            -   name: "Determine composer cache directory"
                uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.1"

            -   name: "Cache dependencies installed with composer"
                uses: "actions/cache@v4.0.2"
                with:
                    path: "${{ env.COMPOSER_CACHE_DIR }}"
                    key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
                    restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

            -   name: "Install ${{ matrix.dependencies }} dependencies with composer"
                uses: "ergebnis/.github/actions/composer/install@1.9.1"
                with:
                    dependencies: "${{ matrix.dependencies }}"

            -   name: "Run Codeception"
                run: |
                    vendor/bin/codecept run -c .