name: Tests on: pull_request: null push: branches: - main concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true permissions: {} jobs: integration: name: Integration (${{ matrix.php }}) runs-on: ubuntu-latest services: mysql: image: mysql@sha256:c36050afdca850f23cef85703f84c7531a5ae155a11b5ee1c60acb09937c4084 # 8.4.9 env: MYSQL_ALLOW_EMPTY_PASSWORD: false MYSQL_ROOT_PASSWORD: kimai MYSQL_DATABASE: kimai ports: - 3306/tcp options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 strategy: matrix: php: ['8.2', '8.3', '8.4', '8.5'] steps: - name: Clone Kimai uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: Setup PHP uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1 with: php-version: ${{ matrix.php }} coverage: pcov extensions: ctype, gd, iconv, intl, ldap, mbstring, mysql, xml, zip tools: cs2pr, symfony-cli env: fail-fast: true - name: Determine software versions run: mysql --version && php --version - name: Determine composer cache directory id: composer-cache run: echo "composer_cache_directory=$(composer config cache-dir)" >> $GITHUB_ENV - name: Cache Composer dependencies uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: "${{ env.composer_cache_directory }}" key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} - name: Install dependencies run: composer install - name: Install LDAP package (for tests) run: composer require laminas/laminas-ldap - name: Setup problem matchers (for PHPUnit) # zizmor: ignore[template-injection] coming from the https://github.com/marketplace/actions/setup-php-action run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Run quick unit-tests run: composer tests-unit env: DATABASE_URL: mysql://root:kimai@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/kimai?charset=utf8mb4&serverVersion=8.0.35 APP_ENV: test MAILER_URL: null://localhost - name: Full test-suite if: matrix.php != '8.5' run: vendor/bin/phpunit tests/ env: DATABASE_URL: mysql://root:kimai@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/kimai?charset=utf8mb4&serverVersion=8.0.35 APP_ENV: test MAILER_URL: null://localhost - name: Full test-suite with coverage if: matrix.php == '8.5' run: vendor/bin/phpunit tests/ --coverage-clover=coverage.xml env: DATABASE_URL: mysql://root:kimai@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/kimai?charset=utf8mb4&serverVersion=8.0.35 APP_ENV: dev MAILER_URL: null://localhost - name: Upload code coverage if: matrix.php == '8.5' uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml fail_ci_if_error: true - name: Run migrations on MySQL run: | bin/console doctrine:database:drop --if-exists --force -n bin/console doctrine:database:create --if-not-exists -n bin/console doctrine:migrations:migrate -n bin/console doctrine:migrations:migrate first -n env: DATABASE_URL: mysql://root:kimai@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/kimai?charset=utf8mb4&serverVersion=8.0.35 APP_ENV: dev MAILER_URL: null://localhost