Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions .github/workflows/php-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down