diff --git a/.github/workflows/php-unit.yml b/.github/workflows/php-unit.yml index 62542fa..e1a7811 100644 --- a/.github/workflows/php-unit.yml +++ b/.github/workflows/php-unit.yml @@ -43,6 +43,19 @@ jobs: steps: - uses: Icinga/github-actions/.github/actions/php-and-dependencies@main name: Setup PHP and dependencies + env: &phpunit-env + ICINGAWEB_TEST_MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} + ICINGAWEB_TEST_PGSQL_PORT: ${{ job.services.pgsql.ports['5432'] }} + MYSQL_TESTDB_HOST: 127.0.0.1 + MYSQL_TESTDB_PORT: ${{ job.services.mysql.ports['3306'] }} + MYSQL_TESTDB: icinga_unittest + MYSQL_TESTDB_USER: icinga_unittest + MYSQL_TESTDB_PASSWORD: icinga_unittest + PGSQL_TESTDB_HOST: 127.0.0.1 + PGSQL_TESTDB_PORT: ${{ job.services.pgsql.ports['5432'] }} + PGSQL_TESTDB: icinga_unittest + PGSQL_TESTDB_USER: icinga_unittest + PGSQL_TESTDB_PASSWORD: icinga_unittest with: php-version: ${{ inputs.php-version }} php-extensions: ${{ inputs.php-extensions }} @@ -58,19 +71,7 @@ jobs: run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Run PHPUnit - env: - ICINGAWEB_TEST_MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} - ICINGAWEB_TEST_PGSQL_PORT: ${{ job.services.pgsql.ports['5432'] }} - MYSQL_TESTDB_HOST: 127.0.0.1 - MYSQL_TESTDB_PORT: ${{ job.services.mysql.ports['3306'] }} - MYSQL_TESTDB: icinga_unittest - MYSQL_TESTDB_USER: icinga_unittest - MYSQL_TESTDB_PASSWORD: icinga_unittest - PGSQL_TESTDB_HOST: 127.0.0.1 - PGSQL_TESTDB_PORT: ${{ job.services.pgsql.ports['5432'] }} - PGSQL_TESTDB: icinga_unittest - PGSQL_TESTDB_USER: icinga_unittest - PGSQL_TESTDB_PASSWORD: icinga_unittest + env: *phpunit-env # Unlike linting and static analysis, which report errors via the GitHub Actions API and # therefore (have to) use relative paths, we can use working-directory here because # PHPUnit provides absolute paths and GitHub Actions problem matchers work with absolute paths. @@ -121,10 +122,10 @@ jobs: # Service will not be started if image is empty. image: ${{ inputs.databases && 'mariadb' || '' }} env: - MARIADB_RANDOM_ROOT_PASSWORD: yes MARIADB_DATABASE: icinga_unittest MARIADB_USER: icinga_unittest MARIADB_PASSWORD: icinga_unittest + MARIADB_ROOT_PASSWORD: icinga_unittest options: >- --health-cmd "mariadb-admin ping" --health-interval 10s