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:e370cd5f64599d46985b7729b452f2153825246f88d82753ec595c5dfc6fef6a # 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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: persist-credentials: false - name: Setup PHP uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 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@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 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