Skip to content

Commit

Permalink
Add CI files
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayesh committed Jan 10, 2024
1 parent 72527d4 commit 3a09008
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor/
/build/
composer.lock
27 changes: 27 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"
}
]
}
22 changes: 22 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" executionOrder="depends,defects" beStrictAboutOutputDuringTests="true" cacheResult="true" colors="true" cacheDirectory=".phpunit.cache" requireCoverageMetadata="false" beStrictAboutCoverageMetadata="true">
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<html outputDirectory="build/coverage-html"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
</report>
</coverage>
<logging>
<testdoxHtml outputFile="build/coverage-html"/>
</logging>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>

0 comments on commit 3a09008

Please sign in to comment.