diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..7905a61 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,69 @@ +name: Main + +on: + workflow_dispatch: + push: + branches: + - main + - master + - release/** + pull_request: + branches: + - main + - master + - release/** + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + run: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: ['ubuntu-latest'] + php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4'] + steps: + - name: Get source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: none + ini-values: post_max_size=256M, max_execution_time=180 + - name: Check package + run: | + sudo pear list + sudo pear channel-update pear.php.net + sudo pear upgrade --force pear/pear + sudo pear list + sudo pear install --force package.xml + sudo pear list + sudo pear package + sudo pear package-validate + sudo pear install --force *.tgz + sudo pear list + # For some reason ttf-mscorefonts-installer doesn't work + # so we only install Verdana + - name: Download and install Verdana font + run: | + sudo apt install cabextract + curl -L -o verdan32.exe 'http://download.sourceforge.net/corefonts/verdan32.exe' + cabextract -d Image/Canvas/Fonts/ verdan32.exe + mv Image/Canvas/Fonts/Verdana.TTF Image/Canvas/Fonts/verdana.ttf + - name: Install pre-requisites and run test scripts + run: | + composer install + php tests/gradients.php > gradients.png + php tests/imagemap.php > imagemap.html + php tests/png.php + php tests/jpg.php + # php tests/ps.php + # php tests/pdf.php + php tests/svg.php + php tests/text.php > text.png + php tests/lineends.php > lineends.png diff --git a/composer.json b/composer.json index da1e4b1..8199897 100644 --- a/composer.json +++ b/composer.json @@ -23,10 +23,8 @@ }, "type": "library", "require": { + "php": ">=5.6, < 8.0", "pear/pear_exception": "*", "pear/image_color": "*" - }, - "require-dev": { - "phpunit/phpunit": "*" } } diff --git a/tests/canvas_body.php b/tests/canvas_body.php index 1aee67d..2147baf 100644 --- a/tests/canvas_body.php +++ b/tests/canvas_body.php @@ -305,11 +305,11 @@ $canvas->addText(array('x' => 375, 'y' => 455, 'text' => 'Image')); -$canvas->image(array('x' => 445, 'y' => 455, 'filename' => './pear-icon.png', 'url' => 'http://pear.veggerby.dk/', 'target' => '_blank')); +$canvas->image(array('x' => 445, 'y' => 455, 'filename' => __DIR__ . '/pear-icon.png', 'url' => 'http://pear.veggerby.dk/', 'target' => '_blank')); -$canvas->image(array('x' => 445, 'y' => 495, 'filename' => './pear-icon.png', 'width' => 20, 'height' => 20)); +$canvas->image(array('x' => 445, 'y' => 495, 'filename' => __DIR__ . '/pear-icon.png', 'width' => 20, 'height' => 20)); -$canvas->image(array('x' => 445, 'y' => 523, 'filename' => './pear-icon.png', 'width' => 40, 'height' => 40)); +$canvas->image(array('x' => 445, 'y' => 523, 'filename' => __DIR__ . '/pear-icon.png', 'width' => 40, 'height' => 40)); //$canvas->show(); $type = basename($_SERVER['SCRIPT_NAME'], '.php'); diff --git a/tests/gradients.php b/tests/gradients.php index 93cd110..307047d 100644 --- a/tests/gradients.php +++ b/tests/gradients.php @@ -27,7 +27,7 @@ * @link http://pear.php.net/package/Image_Canvas */ -require_once 'Image/Canvas.php'; +require_once 'vendor/autoload.php'; $canvas =& Image_Canvas::factory( 'png', diff --git a/tests/imagemap.php b/tests/imagemap.php index 7e27efb..c3bb1e9 100644 --- a/tests/imagemap.php +++ b/tests/imagemap.php @@ -27,7 +27,7 @@ * @link http://pear.php.net/package/Image_Canvas */ -require_once 'Image/Canvas.php'; +require_once 'vendor/autoload.php'; $canvas =& Image_Canvas::factory( 'png', diff --git a/tests/jpg.php b/tests/jpg.php index a451b75..8dd1054 100644 --- a/tests/jpg.php +++ b/tests/jpg.php @@ -30,10 +30,10 @@ // SPECIFY HERE WHERE A TRUETYPE FONT CAN BE FOUND $testFont = 'c:/windows/fonts/Arial.ttf'; -require_once 'Image/Canvas.php'; +require_once 'vendor/autoload.php'; $canvas =& Image_Canvas::factory('jpg', array('width' => 600, 'height' => 600, 'quality' => 90)); -require_once './canvas_body.php'; +require_once __DIR__ . '/canvas_body.php'; ?> diff --git a/tests/lineends.php b/tests/lineends.php index ec4c25e..aa6d886 100644 --- a/tests/lineends.php +++ b/tests/lineends.php @@ -27,7 +27,7 @@ * @link http://pear.php.net/package/Image_Canvas */ -require_once 'Image/Canvas.php'; +require_once 'vendor/autoload.php'; $font = array('name' => 'Verdana', 'size' => 10); diff --git a/tests/pdf.php b/tests/pdf.php index aea0e8e..9e37d51 100644 --- a/tests/pdf.php +++ b/tests/pdf.php @@ -30,10 +30,10 @@ // SPECIFY HERE WHERE A TRUETYPE FONT CAN BE FOUND $testFont = 'c:/windows/fonts/Arial.ttf'; -require_once 'Image/Canvas.php'; +require_once 'vendor/autoload.php'; $canvas =& Image_Canvas::factory('pdf', array('page' => 'A4', 'align' => 'center', 'width' => 600, 'height' => 600)); -require_once './canvas_body.php'; +require_once __DIR__ . '/canvas_body.php'; ?> diff --git a/tests/png.php b/tests/png.php index 7c99b60..80f7da0 100644 --- a/tests/png.php +++ b/tests/png.php @@ -30,10 +30,10 @@ // SPECIFY HERE WHERE A TRUETYPE FONT CAN BE FOUND $testFont = 'c:/windows/fonts/Arial.ttf'; -require_once 'Image/Canvas.php'; +require_once 'vendor/autoload.php'; $canvas =& Image_Canvas::factory('png', array('width' => 600, 'height' => 600)); -require_once './canvas_body.php'; +require_once __DIR__ . '/canvas_body.php'; ?> diff --git a/tests/ps.php b/tests/ps.php index 08b1566..8226233 100644 --- a/tests/ps.php +++ b/tests/ps.php @@ -30,10 +30,10 @@ // SPECIFY HERE WHERE A TRUETYPE FONT CAN BE FOUND $testFont = 'c:/windows/fonts/Arial.ttf'; -require_once 'Image/Canvas.php'; +require_once 'vendor/autoload.php'; $canvas =& Image_Canvas::factory('ps', array('page' => 'A4', 'align' => 'center', 'width' => 600, 'height' => 600, 'filename'=>'testps.ps')); -require_once './canvas_body.php'; +require_once __DIR__ . '/canvas_body.php'; ?> diff --git a/tests/svg.php b/tests/svg.php index 162968f..b72bcec 100644 --- a/tests/svg.php +++ b/tests/svg.php @@ -30,10 +30,10 @@ // SPECIFY HERE WHERE A TRUETYPE FONT CAN BE FOUND $testFont = 'c:/windows/fonts/Arial.ttf'; -require_once 'Image/Canvas.php'; +require_once 'vendor/autoload.php'; $canvas =& Image_Canvas::factory('svg', array('width' => 600, 'height' => 600)); -require_once './canvas_body.php'; +require_once __DIR__ . '/canvas_body.php'; ?> diff --git a/tests/text.php b/tests/text.php index 61cf45a..608c951 100644 --- a/tests/text.php +++ b/tests/text.php @@ -27,7 +27,7 @@ * @link http://pear.php.net/package/Image_Canvas */ -require_once 'Image/Canvas.php'; +require_once 'vendor/autoload.php'; $canvas =& Image_Canvas::factory( 'png',