diff --git a/.github/workflows/phpunit-lowest.yml b/.github/workflows/phpunit-lowest.yml new file mode 100644 index 0000000..4f06a64 --- /dev/null +++ b/.github/workflows/phpunit-lowest.yml @@ -0,0 +1,94 @@ +# This workflow runs tests on MySQLi with the lowest PHP version and Composer dependencies. +name: PHPUnit Lowest + +on: + pull_request: + branches: + - develop + paths: + - '**.php' + - 'composer.*' + - 'phpunit*' + - '.github/workflows/phpunit.yml' + push: + branches: + - develop + paths: + - '**.php' + - 'composer.*' + - 'phpunit*' + - '.github/workflows/phpunit.yml' + workflow_call: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + main: + name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }} - ${{ matrix.dependencies }} + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[ci skip]')" + strategy: + matrix: + php-versions: ['7.4'] + db-platforms: ['MySQLi'] + mysql-versions: ['5.7'] + dependencies: ['lowest'] + + services: + mysql: + image: mysql:${{ matrix.mysql-versions }} + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: test + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + steps: + - name: Check disk space + run: df -h + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + tools: composer, phive, phpunit + extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3 + coverage: xdebug + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Get composer cache directory + run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV + + - name: Cache composer dependencies + uses: actions/cache@v3 + with: + path: ${{ env.COMPOSER_CACHE_FILES_DIR }} + key: ${{ runner.os }}-composer-lowest-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer-lowest- + + - name: Install dependencies + run: | + if [ -f composer.lock ]; then + composer install ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader + else + composer update ${{ env.COMPOSER_UPDATE_FLAGS }} --no-progress --no-interaction --prefer-dist --optimize-autoloader + fi + env: + COMPOSER_UPDATE_FLAGS: ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }} + + - name: Test with PHPUnit + run: vendor/bin/phpunit --verbose --coverage-text --testsuite main + env: + DB: ${{ matrix.db-platforms }} + TERM: xterm-256color + TACHYCARDIA_MONITOR_GA: enabled diff --git a/.github/workflows/phpunit-no-db.yml b/.github/workflows/phpunit-no-db.yml index bc6f9c4..77f71de 100644 --- a/.github/workflows/phpunit-no-db.yml +++ b/.github/workflows/phpunit-no-db.yml @@ -38,6 +38,9 @@ jobs: dependencies: ['highest', 'lowest'] steps: + - name: Check disk space + run: df -h + - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index adf5304..518c54e 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -29,7 +29,7 @@ permissions: jobs: main: - name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }} - ${{ matrix.dependencies }} + name: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }} runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, '[ci skip]')" strategy: @@ -43,27 +43,18 @@ jobs: - php-versions: '7.4' db-platforms: MySQLi mysql-versions: '8.0' - dependencies: 'highest' - # Lowest Dependency - - php-versions: '7.4' - db-platforms: MySQLi - mysql-versions: '5.7' - dependencies: 'lowest' # Postgre - php-versions: '7.4' db-platforms: Postgre mysql-versions: '5.7' - dependencies: 'highest' # SQLSRV - php-versions: '7.4' db-platforms: SQLSRV mysql-versions: '5.7' - dependencies: 'highest' # OCI8 - php-versions: '7.4' db-platforms: OCI8 mysql-versions: '5.7' - dependencies: 'highest' services: mysql: @@ -104,6 +95,22 @@ jobs: options: --health-cmd="/opt/oracle/product/18c/dbhomeXE/bin/sqlplus -s sys/Oracle18@oracledbxe/XE as sysdba <<< 'SELECT 1 FROM DUAL'" --health-interval=10s --health-timeout=5s --health-retries=3 steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false + + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: false + docker-images: true + swap-storage: true + - name: Create database for MSSQL Server if: matrix.db-platforms == 'SQLSRV' run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test"