name: build-lint-etc on: [ push ] permissions: contents: read jobs: testsuite: runs-on: ubuntu-22.04 strategy: matrix: php-versions: [ '8.1', '8.2', '8.3', '8.4', '8.5' ] services: mysql: image: mysql:8.0 env: MYSQL_ROOT_PASSWORD: topSecret MYSQL_DATABASE: dmarc MYSQL_USER: dmarc_user MYSQL_PASSWORD: password ports: - 3306:3306 options: >- --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} tools: composer extensions: mbstring, mysql, xml - name: Get composer cache directory if: ${{ !env.ACT }} id: composer-cache run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies if: ${{ !env.ACT }} uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ matrix.php-versions}}-${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - name: Install dependencies run: composer install --prefer-dist -n - name: lint run: composer lint - name: static analysis run: composer phpstan - name: copy test config into place run: cp config/conf.sample.php config/conf.php - name: init database # Connecting an old version of PHP to a new version of MySQL results in error # SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client if: ${{ matrix.php-versions != '7.3' }} run: php -f utils/database_admin.php init - name: run unit tests run: composer test