Skip to content

Commit ce2521f

Browse files
committed
Migrate to GitHub Actions
1 parent 0de5ace commit ce2521f

24 files changed

+282
-119
lines changed

.github/workflows/tests.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Tests
2+
on: pull_request
3+
jobs:
4+
phpunit:
5+
name: PHP ${{ matrix.php }}
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
php:
10+
- "5.3"
11+
- "5.4"
12+
- "5.5"
13+
- "5.6"
14+
- "7.0"
15+
- "7.1"
16+
- "7.2"
17+
- "7.3"
18+
- "7.4"
19+
- "8.0"
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
24+
- name: Install pdftk
25+
run: |
26+
cd /tmp
27+
sudo wget http://mirrors.kernel.org/ubuntu/pool/universe/p/pdftk-java/pdftk-java_3.0.9-1_all.deb
28+
sudo apt install -y -q ./pdftk-java_3.0.9-1_all.deb
29+
pdftk --version
30+
31+
- name: Install PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: ${{ matrix.php }}
35+
tools: composer:v2
36+
37+
- name: Update composer
38+
run: composer self-update
39+
40+
- name: Get composer cache directory
41+
id: composer-cache
42+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
43+
44+
- name: Cache composer cache
45+
uses: actions/cache@v2
46+
with:
47+
path: ${{ steps.composer-cache.outputs.dir }}
48+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
49+
restore-keys: ${{ runner.os }}-composer-
50+
51+
- name: Install composer packages
52+
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
53+
54+
- name: Run phpunit
55+
run: vendor/bin/phpunit --color=always

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ phpunit.xml
22
composer.lock
33
/vendor/
44
*.swp
5+
.phpunit.result.cache

.travis.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
php-pdftk
22
=========
33

4-
[![Build Status](https://secure.travis-ci.org/mikehaertl/php-pdftk.png)](http://travis-ci.org/mikehaertl/php-pdftk)
5-
[![Latest Stable Version](https://poser.pugx.org/mikehaertl/php-pdftk/v/stable.svg)](https://packagist.org/packages/mikehaertl/php-pdftk)
6-
[![Total Downloads](https://poser.pugx.org/mikehaertl/php-pdftk/downloads)](https://packagist.org/packages/mikehaertl/php-pdftk)
7-
[![Latest Unstable Version](https://poser.pugx.org/mikehaertl/php-pdftk/v/unstable.svg)](https://packagist.org/packages/mikehaertl/php-pdftk)
8-
[![License](https://poser.pugx.org/mikehaertl/php-pdftk/license.svg)](https://packagist.org/packages/mikehaertl/php-pdftk)
4+
[![GitHub Tests](https://github.com/mikehaertl/php-pdftk/workflows/Tests/badge.svg)](https://github.com/mikehaertl/php-pdftk/actions)
5+
[![Packagist Version](https://img.shields.io/packagist/v/mikehaertl/php-pdftk?label=version)](https://packagist.org/packages/mikehaertl/php-pdftk)
6+
[![Packagist Downloads](https://img.shields.io/packagist/dt/mikehaertl/php-pdftk)](https://packagist.org/packages/mikehaertl/php-pdftk)
7+
[![GitHub license](https://img.shields.io/github/license/mikehaertl/php-pdftk)](https://github.com/mikehaertl/php-pdftk/blob/master/LICENSE)
8+
[![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/mikehaertl/php-pdftk)](https://packagist.org/packages/mikehaertl/php-pdftk)
99

1010
A PDF conversion and form utility based on pdftk.
1111

@@ -28,10 +28,16 @@ A PDF conversion and form utility based on pdftk.
2828
* The `pdftk` command must be installed and working on your system
2929
* This library is written for pdftk 2.x versions. You should be able to use it with pdftk 1.x but not all methods will work there.
3030
For details consult the man page of pdftk on your system.
31-
32-
> **Note** If you're on Ubuntu you may want to install the version from `ppa:malteworld/ppa`.
33-
> The default packages seems to use snap an there have been reports about file permission
34-
> issues with this version. See below for a workaround.
31+
* There is a [known issue](issues/150) on Ubuntu if you installed the `pdftk` package from snap. This
32+
version has no permission to write to the `/tmp` directory. You can either
33+
set another temporay directory as described below or use another package.
34+
For Ubuntu 18.10 there's also a `pdftk-jave` package available in apt which
35+
should work fine. For Ubuntu 18.04 you can also install this package if
36+
you download it manually. Also check [this answer](https://askubuntu.com/a/1028983/175814) on askubuntu.
37+
38+
> **Note:** The pdftk version from the alternative PPA `ppa:malteworld/ppa` is
39+
> no longer available. The author instead now points to his answer on askubuntu
40+
> linked above.
3541
3642
## Installation
3743

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
],
1313
"require": {
1414
"php": ">=5.3.0",
15-
"mikehaertl/php-shellcommand": "^1.5.0",
15+
"mikehaertl/php-shellcommand": "^1.6.3",
1616
"mikehaertl/php-tmpfile": "^1.1.0"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": ">4.0 <8"
19+
"phpunit/phpunit": ">4.0 <9.4"
2020
},
2121
"autoload": {
2222
"psr-4": {

phpunit.xml.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
>
1313
<testsuites>
1414
<testsuite name="phppdftk Test Suite">
15-
<directory>./tests/</directory>
15+
<directory phpVersion="7.2.0" phpVersionOperator=">=">./tests/phpunit89</directory>
16+
<directory phpVersion="7.2.0" phpVersionOperator="lt">./tests/phpunit4567</directory>
1617
</testsuite>
1718
</testsuites>
1819
</phpunit>

tests/CommandTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66

77
class CommandTest extends TestCase
88
{
9-
public function setUp()
10-
{
11-
@unlink($this->getOutFile());
12-
}
13-
public function tearDown()
14-
{
15-
@unlink($this->getOutFile());
16-
}
17-
189
public function testCanAddFiles()
1910
{
2011
$document1 = $this->getDocument1();

tests/DataFieldsTest.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,66 +84,66 @@ public function testDataFieldParsing()
8484
FieldStateOption: Value 3
8585
DATA;
8686

87-
protected $_parsedResult = [
88-
[
87+
protected $_parsedResult = array(
88+
array(
8989
'FieldType' => 'Text',
9090
'FieldName' => 'field1',
9191
'FieldNameAlt' => 'field1_alt',
9292
'FieldFlags' => 0,
9393
'FieldJustification' => 'Left',
94-
],
95-
[
94+
),
95+
array(
9696
'FieldType' => 'Text',
9797
'FieldName' => 'field2',
9898
'FieldNameAlt' => 'field2_alt',
9999
'FieldFlags' => 0,
100100
'FieldValue' => 'value:with:colons',
101101
'FieldJustification' => 'Left',
102-
],
103-
[
102+
),
103+
array(
104104
'FieldType' => 'Text',
105105
'FieldName' => 'field3',
106106
'FieldNameAlt' => 'field3_alt',
107107
'FieldFlags' => 0,
108108
'FieldValue' => '',
109109
'FieldJustification' => 'Left',
110-
],
111-
[
110+
),
111+
array(
112112
'FieldType' => 'Text',
113113
'FieldName' => 'field4',
114114
'FieldNameAlt' => 'field4_alt',
115115
'FieldFlags' => 0,
116116
'FieldValue' => "field:with:colons\n\n---more:colons:\nand\nmulti lines\n",
117117
'FieldJustification' => 'Left',
118-
],
119-
[
118+
),
119+
array(
120120
'FieldType' => 'Text',
121121
'FieldName' => 'field5',
122122
'FieldNameAlt' => 'field5_alt',
123123
'FieldFlags' => 0,
124124
'FieldValue' => "field:with:colons\n\n---more:colons:\nand\nmulti lines\n",
125125
'FieldValueDefault' => "default:with:colons\n\n---more:colons:\nand\nmulti lines\n",
126126
'FieldJustification' => 'Left',
127-
],
128-
[
127+
),
128+
array(
129129
'FieldType' => 'Choice',
130130
'FieldName' => 'field6',
131131
'FieldFlags' => 2097152,
132-
'FieldValue' => [1, 2, 3, 4],
132+
'FieldValue' => array(1, 2, 3, 4),
133133
'FieldJustification' => 'Left',
134-
],
135-
[
134+
),
135+
array(
136136
'FieldType' => 'Choice',
137137
'FieldName' => 'field7',
138138
'FieldFlags' => 524288,
139139
'FieldValue' => '-- Value with dashes --',
140140
'FieldValueDefault' => '-- Value with dashes --',
141-
'FieldStateOption' => [
141+
'FieldStateOption' => array(
142142
'-- Another value with dashes --',
143143
'Value 2',
144144
'Value 3',
145-
],
145+
),
146146
'FieldJustification' => 'Left',
147-
],
148-
];
147+
),
148+
);
149149
}

0 commit comments

Comments
 (0)