From 3a09008125ae7f28ba2715d1fdd9ad6f9df3eaa3 Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Wed, 10 Jan 2024 16:41:39 +0700 Subject: [PATCH] Add CI files --- .gitattributes | 12 ++++++++++++ .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ .gitignore | 3 +++ composer.json | 27 +++++++++++++++++++++++++++ phpunit.xml.dist | 22 ++++++++++++++++++++++ 5 files changed, 101 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 composer.json create mode 100644 phpunit.xml.dist diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0fd12f2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,12 @@ +# https://php.watch/articles/composer-gitattributes + +# Exclude build/test files from archive +/.github export-ignore +/build export-ignore +/tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/phpunit.xml.dist export-ignore + +# Configure diff output for .php and .phar files. +*.php diff=php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3464c80 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +on: + - pull_request + - push + +name: CI + +jobs: + tests: + name: Tests + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + php: + - "8.1" + - "8.2" + - "8.3" + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: pcov + ini-values: assert.exception=1, zend.assertions=1 + + - name: Install composer dependencies + run: composer update --no-ansi --no-interaction --no-progress + + - name: Run tests with phpunit + run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..487a7d6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/vendor/ +/build/ +composer.lock diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..0f7193f --- /dev/null +++ b/composer.json @@ -0,0 +1,27 @@ +{ + "name": "phpwatch/mb-trim-polyfill", + "description": "PHP: Provides a user-land polyfill for `mb_trim`, `mb_ltrim`, and `mb_rtrim` functions added in PHP 8.4.", + "type": "library", + "require": { + "php": "^8.1", + "ext-mbstring": "*" + }, + "require-dev": { + "phpunit/phpunit": "^10.5.5" + }, + "conflict": { + "php": "^8.4" + }, + "license": "MIT", + "autoload": { + "psr-4": { + "Phpwatch\\MbTrimPolyfill\\": "src/" + } + }, + "authors": [ + { + "name": "Ayesh Karunaratne", + "email": "ayesh@aye.sh" + } + ] +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..cb59378 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,22 @@ + + + + + tests + + + + + + + + + + + + + + src + + +