From 25d35d6250f965a5d46a5a0dcb41b8fe8f7eeb86 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 28 Sep 2023 12:08:05 +0900 Subject: [PATCH 1/4] Remove lowest from phpunit.yml To reduce the Composer cache size. --- .github/workflows/phpunit.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index adf5304..0fd48e9 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: From de693eea9980af2d7454ec4de8f9e7393ae24c6b Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 28 Sep 2023 12:08:37 +0900 Subject: [PATCH 2/4] Add PHPUnit Lowest workflow --- .github/workflows/phpunit-lowest.yml | 94 ++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/phpunit-lowest.yml 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 From fe8009646570610ff77f4257edbb46bd3b24ac5b Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 28 Sep 2023 15:03:19 +0900 Subject: [PATCH 3/4] Add step to check disk space --- .github/workflows/phpunit-no-db.yml | 3 +++ 1 file changed, 3 insertions(+) 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 From f1b5ab6f2cc0ce779c46c5b403c3123690f10a79 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 28 Sep 2023 15:03:37 +0900 Subject: [PATCH 4/4] Add step to free disk space --- .github/workflows/phpunit.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 0fd48e9..518c54e 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -95,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"