Tests #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Tests" | |
| on: | |
| pull_request: ~ | |
| push: | |
| branches: | |
| - master | |
| schedule: | |
| - cron: "0 9 * * 1" | |
| jobs: | |
| test: | |
| name: PHP ${{ matrix.php }} | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| experimental: | |
| - false | |
| php: | |
| - "7.1" | |
| - "7.2" | |
| - "7.3" | |
| - "7.4" | |
| - "8.0" | |
| - "8.1" | |
| - "8.2" | |
| - "8.3" | |
| - "8.4" | |
| - "8.5" | |
| # to add a new PHP version as experimental during compat work | |
| # (experimental: true allows CI to pass even if that version fails): | |
| # include: | |
| # - php: "8.6" | |
| # experimental: true | |
| env: | |
| MYSQL_USER: "zftest" | |
| MYSQL_PASSWORD: "zftest" | |
| MYSQL_DATABASE: "zftest" | |
| MYSQL_HOST: "127.0.0.1" | |
| POSTGRES_USER: "zftest" | |
| POSTGRES_PASSWORD: "zftest" | |
| POSTGRES_DB: "zftest" | |
| POSTGRES_HOST: "127.0.0.1" | |
| # https://hub.docker.com/r/bitnamilegacy/openldap | |
| LDAP_ROOT: "dc=example,dc=com" | |
| LDAP_ALLOW_ANON_BINDING: false | |
| LDAP_SKIP_DEFAULT_TREE: "yes" | |
| LDAP_ADMIN_USERNAME: "admin" | |
| LDAP_ADMIN_PASSWORD: "insecure" | |
| LDAP_CONFIG_ADMIN_USERNAME: "admin" | |
| LDAP_CONFIG_ADMIN_PASSWORD: "configpassword" | |
| # Default locales are: C C.UTF-8 POSIX en_US.utf8 | |
| LOCALES: "fr_FR@euro fr_FR fr_BE.UTF-8 de en_US" | |
| services: | |
| memcache: | |
| image: memcached:1-alpine | |
| ports: | |
| - 11211:11211 | |
| mysql: | |
| image: mysql/mysql-server:5.7 | |
| ports: | |
| - 3306:3306 | |
| env: | |
| MYSQL_USER: ${{ env.MYSQL_USER }} | |
| MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }} | |
| MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }} | |
| MYSQL_ALLOW_EMPTY_PASSWORD: "1" | |
| options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 | |
| postgres: | |
| image: postgres:12 | |
| ports: | |
| - 5432:5432 | |
| env: | |
| POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
| POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
| POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
| # Set health checks to wait until postgres has started | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| openldap: | |
| image: bitnamilegacy/openldap:2.6 | |
| ports: | |
| - 1389:1389 | |
| env: | |
| LDAP_ROOT: ${{ env.LDAP_ROOT }} | |
| LDAP_ALLOW_ANON_BINDING: ${{ env.LDAP_ALLOW_ANON_BINDING }} | |
| LDAP_SKIP_DEFAULT_TREE: ${{ env.LDAP_SKIP_DEFAULT_TREE }} | |
| LDAP_ADMIN_USERNAME: ${{ env.LDAP_ADMIN_USERNAME }} | |
| LDAP_ADMIN_PASSWORD: ${{ env.LDAP_ADMIN_PASSWORD }} | |
| LDAP_CONFIG_ADMIN_ENABLED: "yes" | |
| LDAP_CONFIG_ADMIN_USERNAME: ${{ env.LDAP_CONFIG_ADMIN_USERNAME }} | |
| LDAP_CONFIG_ADMIN_PASSWORD: ${{ env.LDAP_CONFIG_ADMIN_PASSWORD }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v6 | |
| - name: Setup PHP ${{ matrix.php }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| ini-values: display_errors=off, log_errors=on | |
| tools: cs2pr | |
| extensions: :xdebug, ctype, dom, gd, iconv, ldap, mbstring, reflection, session, simplexml, spl, xml, zlib, memcache, pdo_sqlite, bcmath | |
| env: | |
| # https://github.com/shivammathur/setup-php/issues/407#issuecomment-773675741 | |
| fail-fast: true | |
| # https://github.com/zf1s/zf1/pull/6#issuecomment-495397170 | |
| - name: Validate composer.json for all packages | |
| run: | | |
| for json in composer.json packages/*/composer.json; do echo COMPOSER=$json; done | parallel env {} composer validate | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --no-suggest | |
| # runs on every PHP version to catch syntax incompatible with older versions | |
| - name: Lint PHP source files | |
| run: | | |
| composer lint.checkstyle | cs2pr | |
| - name: Setup environment for PHPUnit | |
| run: | | |
| cp tests/TestConfiguration.ci.php tests/TestConfiguration.php | |
| echo "Existing locales" | |
| locale -a | |
| sudo apt-get update && sudo apt-get install tzdata locales -y && sudo locale-gen $LOCALES | |
| echo "All languages..." | |
| locale -a | |
| - name: Setup LDAP | |
| run: | | |
| sudo apt-get install -y libnss-ldap libpam-ldap ldap-utils | |
| tests/resources/openldap/docker-entrypoint-initdb.d/init.sh | |
| - name: "Run PHPUnit tests (Experimental: ${{ matrix.experimental }})" | |
| run: vendor/bin/phpunit --verbose | |
| continue-on-error: ${{ matrix.experimental }} | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v6 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| # lint only needs to run once, not per PHP version | |
| php-version: "8.5" | |
| tools: phpcs, cs2pr | |
| - name: Run phpcs | |
| run: phpcs --report=checkstyle -q | cs2pr | |
| # vim:ft=yaml:et:ts=2:sw=2 |