From 323a608465c5e91cc1aa18a316bfb4bcd2bff754 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Wed, 22 Sep 2021 21:12:37 -0500 Subject: [PATCH] Add a GitHub workflow for the 3.x branch --- .github/workflows/continuous-integration.yml | 108 +++++++++++++++++++ LICENSE | 2 +- composer.json | 4 +- tests/Builder/DefaultUuidBuilderTest.php | 4 +- tests/Builder/DegradedUuidBuilderTest.php | 4 +- 5 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/continuous-integration.yml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..bc71be1 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,108 @@ +# GitHub Actions Documentation: https://docs.github.com/en/actions + +name: "build" + +on: ["pull_request", "push"] + +env: + COMPOSER_ROOT_VERSION: "1.99.99" + +jobs: + coding-standards: + name: "Coding standards" + runs-on: "ubuntu-latest" + steps: + - name: "Checkout repository" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "latest" + extensions: bcmath, ctype, gmp, libsodium, uuid + coverage: "none" + + - name: "Install dependencies (Composer)" + uses: "ramsey/composer-install@v1" + + - name: "Check syntax (php-parallel-lint)" + run: "./vendor/bin/parallel-lint src tests --colors" + + - name: "Check coding standards (PHP_CodeSniffer)" + run: "./vendor/bin/phpcs src tests --standard=psr2 -sp --colors" + + code-coverage: + name: "Code coverage" + runs-on: "ubuntu-latest" + steps: + - name: "Checkout repository" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "latest" + extensions: bcmath, ctype, gmp, libsodium, uuid + coverage: "pcov" + ini-values: "memory_limit=-1" + + - name: "Install dependencies (Composer)" + uses: "ramsey/composer-install@v1" + + - name: "Run unit tests (PHPUnit)" + run: "./vendor/bin/phpunit --verbose --colors=always --coverage-text --coverage-clover build/logs/clover.xml" + + - name: "Publish coverage report to Codecov" + uses: "codecov/codecov-action@v1" + + unit-tests: + name: "Unit Tests" + runs-on: "ubuntu-latest" + continue-on-error: ${{ matrix.experimental }} + + strategy: + fail-fast: false + matrix: + php-version: + - "5.4" + - "5.5" + - "5.6" + - "7.0" + - "7.1" + - "7.2" + - "7.3" + - "7.4" + # Commenting out the following until I can work out a solution for the + # development libraries I use, since many of them or their dependencies + # do not support PHP 8. + # + # - "8.0" + # experimental: + # - false + # include: + # - php-version: "8.1" + # experimental: true + # composer-options: "--ignore-platform-req=php" + + steps: + - name: "Checkout repository" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + extensions: bcmath, ctype, gmp, libsodium, uuid + coverage: "none" + ini-values: "memory_limit=-1" + + - name: "Create the logs directory" + run: "mkdir -p build/logs" + + - name: "Install dependencies (Composer)" + uses: "ramsey/composer-install@v1" + with: + composer-options: "${{ matrix.composer-options }}" + + - name: "Run unit tests (PHPUnit)" + run: "./vendor/bin/phpunit --verbose --colors=always --no-coverage" diff --git a/LICENSE b/LICENSE index b2aa4b5..1db0ef8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2012-2020 Ben Ramsey +Copyright (c) 2012-2021 Ben Ramsey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/composer.json b/composer.json index 62ece07..8baf11d 100644 --- a/composer.json +++ b/composer.json @@ -30,12 +30,12 @@ "codeception/aspect-mock": "^1 | ^2", "doctrine/annotations": "^1.2", "goaop/framework": "1.0.0-alpha.2 | ^1 | ^2.1", - "jakub-onderka/php-parallel-lint": "^1", "mockery/mockery": "^0.9.11 | ^1", "moontoast/math": "^1.1", "paragonie/random-lib": "^2", "php-mock/php-mock-phpunit": "^0.3 | ^1.1", - "phpunit/phpunit": "^4.8 | ^5.4 | ^6.5", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpunit/phpunit": ">=4.8.36", "squizlabs/php_codesniffer": "^3.5" }, "suggest": { diff --git a/tests/Builder/DefaultUuidBuilderTest.php b/tests/Builder/DefaultUuidBuilderTest.php index 125b497..b8bd593 100644 --- a/tests/Builder/DefaultUuidBuilderTest.php +++ b/tests/Builder/DefaultUuidBuilderTest.php @@ -2,15 +2,15 @@ namespace Ramsey\Uuid\Test\Builder; -use PHPUnit_Framework_TestCase; use Ramsey\Uuid\Builder\DefaultUuidBuilder; +use Ramsey\Uuid\Test\TestCase; /** * Class DefaultUuidBuilderTest * @package Ramsey\Uuid\Test\Builder * @covers Ramsey\Uuid\Builder\DefaultUuidBuilder */ -class DefaultUuidBuilderTest extends PHPUnit_Framework_TestCase +class DefaultUuidBuilderTest extends TestCase { public function testBuildCreatesUuid() diff --git a/tests/Builder/DegradedUuidBuilderTest.php b/tests/Builder/DegradedUuidBuilderTest.php index ce017e2..0ab682d 100644 --- a/tests/Builder/DegradedUuidBuilderTest.php +++ b/tests/Builder/DegradedUuidBuilderTest.php @@ -2,15 +2,15 @@ namespace Ramsey\Uuid\Test\Builder; -use PHPUnit_Framework_TestCase; use Ramsey\Uuid\Builder\DegradedUuidBuilder; +use Ramsey\Uuid\Test\TestCase; /** * Class DegradedUuidBuilderTest * @package Ramsey\Uuid\Test\Builder * @covers Ramsey\Uuid\Builder\DegradedUuidBuilder */ -class DegradedUuidBuilderTest extends PHPUnit_Framework_TestCase +class DegradedUuidBuilderTest extends TestCase { public function testBuildCreatesUuid()