diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..d7448c2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,42 @@ +name: tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + tests: + strategy: + matrix: + php-versions: ['7.2', '7.3', '7.4'] + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + uses: php-actions/composer@v6 + with: + version: 2 + php_version: ${{ matrix.php-versions }} + + - name: Run test suite + run: vendor/bin/phpunit diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1a95c8c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -os: linux -language: php - -php: -- '7.1' -- '7.2' -- '7.3' -- '7.4' - -before_script: -- composer self-update -- composer update - -script: -- COMPOSER=composer PHP=php make phpunit - -after_script: -- make clean - -branches: - only: - - master - - '/^ft-.*/' - - '/^\d+\.\d+\.\d+$/' - -cache: - directories: - - $HOME/.composer/cache/files diff --git a/Makefile b/Makefile index 6f04787..8f331e3 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ composer-update: phpunit: @mkdir -p build/tmp build/share/test/schemas build/build/interop/data @chmod -R a+w build - PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpunit --coverage-text test/AllTests.php + PHP_VERSION=$(PHP_VERSION) $(PHP) vendor/bin/phpunit --coverage-text run: PHP_VERSION=$(PHP_VERSION) $(PHP) $(ARGS) diff --git a/README.md b/README.md index 2a7ae5f..a71a306 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.com/researchgate/avro-php.svg?branch=master)](https://travis-ci.com/researchgate/avro-php) +![Test status](https://github.com/researchgate/phpnsc/actions/workflows/tests.yml/badge.svg) What the Avro PHP library is ============================ @@ -11,13 +11,10 @@ Requirements * On 32-bit platforms, the [GMP PHP extension](http://php.net/gmp) * For testing, [PHPUnit](http://www.phpunit.de/) -Both GMP and PHPUnit are often available via package management -systems as `php5-gmp` and `phpunit`, respectively. - Getting started =============== -Untar the avro-php distribution, untar it, and put it in your include path: +Untar the avro-php distribution and put it in your include path: tar xjf avro-php.tar.bz2 # avro-php.tar.bz2 is likely avro-php-1.4.0.tar.bz2 cp avro-php /path/to/where/you/want/it diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..6202a9c --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,20 @@ + + + + test + + + + + lib + + + diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index 6e7df67..0000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - lib/ - - - - diff --git a/test/AllTests.php b/test/AllTests.php deleted file mode 100644 index fc4921a..0000000 --- a/test/AllTests.php +++ /dev/null @@ -1,55 +0,0 @@ -addTestSuite('DataFileTest'); - $suite->addTestSuite('SchemaTest'); - $suite->addTestSuite('NameTest'); - $suite->addTestSuite('StringIOTest'); - $suite->addTestSuite('IODatumReaderTest'); - $suite->addTestSuite('LongEncodingTest'); - $suite->addTestSuite('FloatIntEncodingTest'); - $suite->addTestSuite('DatumIOTest'); - $suite->addTestSuite('ProtocolFileTest'); - $suite->addTestSuite('FileIOTest'); - return $suite; - } -} diff --git a/test/test_helper.php b/test/test_helper.php index 7a8be54..b13879c 100644 --- a/test/test_helper.php +++ b/test/test_helper.php @@ -32,6 +32,16 @@ define('AVRO_TEST_SCHEMAS_DIR', implode(DIRECTORY_SEPARATOR, array(AVRO_SHARE_DIR, 'test', 'schemas'))); define('AVRO_INTEROP_SCHEMA', implode(DIRECTORY_SEPARATOR, array(AVRO_TEST_SCHEMAS_DIR, 'interop.avsc'))); +if (!file_exists(TEST_TEMP_DIR)) { + mkdir(TEST_TEMP_DIR, 0777, true); +} +if (!file_exists(AVRO_TEST_SCHEMAS_DIR)) { + mkdir(AVRO_TEST_SCHEMAS_DIR, 0777, true); +} +if (!file_exists(AVRO_BUILD_DATA_DIR)) { + mkdir(AVRO_BUILD_DATA_DIR, 0777, true); +} + $tz = ini_get('date.timezone'); if (empty($tz)) { date_default_timezone_set('UTC');