|
1 |
| -name: CI |
2 |
| -on: |
3 |
| - pull_request: |
4 |
| - push: |
5 |
| - branches: |
6 |
| - - master |
| 1 | +name: PHPWord |
| 2 | +on: [push, pull_request] |
7 | 3 | jobs:
|
8 |
| - test: |
| 4 | + php-cs-fixer: |
| 5 | + name: PHP CS Fixer |
9 | 6 | runs-on: ubuntu-latest
|
10 |
| - strategy: |
11 |
| - matrix: |
12 |
| - php-version: |
13 |
| - - "7.1.3" |
14 |
| - - "7.2" |
15 |
| - - "7.3" |
16 |
| - - "7.4" |
17 |
| - - "8.0" |
18 |
| - - "8.1" |
19 |
| - - "8.2" |
20 |
| - - "8.3" |
21 |
| - |
22 |
| - name: PHP ${{ matrix.php-version }} |
23 |
| - |
24 | 7 | steps:
|
25 |
| - - name: Checkout |
26 |
| - uses: actions/checkout@v3 |
27 |
| - |
28 |
| - - name: Setup PHP, with composer and extensions |
| 8 | + - name: Setup PHP |
29 | 9 | uses: shivammathur/setup-php@v2
|
30 | 10 | with:
|
31 |
| - php-version: ${{ matrix.php-version }} |
32 |
| - extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib |
33 |
| - coverage: none |
34 |
| - |
35 |
| - - name: Get composer cache directory |
36 |
| - id: composer-cache |
37 |
| - run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
38 |
| - |
39 |
| - - name: Cache composer dependencies |
40 |
| - uses: actions/cache@v3 |
41 |
| - with: |
42 |
| - path: ${{ steps.composer-cache.outputs.dir }} |
43 |
| - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
44 |
| - restore-keys: ${{ runner.os }}-composer- |
45 |
| - |
46 |
| - - name: Remove lock for old EOL PHP versions |
47 |
| - if: matrix.php-version == '7.1.3' || matrix.php-version == '7.2' || matrix.php-version == '7.3' || matrix.php-version == '7.4' |
48 |
| - run: rm composer.lock && composer config platform.php ${{ matrix.php-version }} |
| 11 | + php-version: '8.3' |
| 12 | + extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv |
| 13 | + - uses: actions/checkout@v2 |
49 | 14 |
|
50 |
| - - name: Install dependencies |
51 |
| - run: composer install --no-progress --prefer-dist --optimize-autoloader |
| 15 | + - name: Validate composer config |
| 16 | + run: composer validate --strict |
52 | 17 |
|
53 |
| - - name: Setup problem matchers for PHP |
54 |
| - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" |
| 18 | + - name: Composer Install |
| 19 | + run: composer global require friendsofphp/php-cs-fixer |
55 | 20 |
|
56 |
| - - name: Setup problem matchers for PHPUnit |
57 |
| - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 21 | + - name: Add environment path |
| 22 | + run: export PATH="$PATH:$HOME/.composer/vendor/bin" |
58 | 23 |
|
59 |
| - - name: Configure matchers |
60 |
| - uses: mheap/phpunit-matcher-action@v1 |
| 24 | + - name: Run PHPCSFixer |
| 25 | + run: php-cs-fixer fix --dry-run --diff |
61 | 26 |
|
62 |
| - - name: Test with PHPUnit |
63 |
| - run: ./vendor/bin/phpunit --no-coverage |
64 |
| - |
65 |
| - php-cs-fixer: |
| 27 | + phpmd: |
| 28 | + name: PHP Mess Detector |
66 | 29 | runs-on: ubuntu-latest
|
67 | 30 | steps:
|
68 |
| - - name: Checkout |
69 |
| - uses: actions/checkout@v3 |
| 31 | + - name: Setup PHP |
| 32 | + uses: shivammathur/setup-php@v2 |
| 33 | + with: |
| 34 | + php-version: '8.4' |
| 35 | + extensions: gd, xml, zip |
| 36 | + - uses: actions/checkout@v2 |
70 | 37 |
|
71 |
| - - name: Setup PHP, with composer and extensions |
72 |
| - uses: shivammathur/setup-php@v2 |
73 |
| - with: |
74 |
| - php-version: 8.0 |
75 |
| - extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib |
76 |
| - coverage: none |
77 |
| - tools: cs2pr |
| 38 | + - name: Composer Install |
| 39 | + run: composer install --ansi --prefer-dist --no-interaction --no-progress |
78 | 40 |
|
79 |
| - - name: Get composer cache directory |
80 |
| - id: composer-cache |
81 |
| - run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
82 |
| - |
83 |
| - - name: Cache composer dependencies |
84 |
| - uses: actions/cache@v3 |
85 |
| - with: |
86 |
| - path: ${{ steps.composer-cache.outputs.dir }} |
87 |
| - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
88 |
| - restore-keys: ${{ runner.os }}-composer- |
89 |
| - |
90 |
| - - name: Install dependencies |
91 |
| - run: composer install --no-progress --prefer-dist --optimize-autoloader |
92 |
| - |
93 |
| - - name: Code style with PHP-CS-Fixer |
94 |
| - run: ./vendor/bin/php-cs-fixer fix --dry-run --diff |
| 41 | + - name: Run phpmd |
| 42 | + run: ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude "src/PhpWord/Shared/PCLZip/*" |
95 | 43 |
|
96 | 44 | phpstan:
|
| 45 | + name: PHP Static Analysis |
97 | 46 | runs-on: ubuntu-latest
|
| 47 | + strategy: |
| 48 | + fail-fast: false |
| 49 | + matrix: |
| 50 | + # Disabled PHPStan in '7.1' |
| 51 | + php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] |
98 | 52 | steps:
|
99 |
| - - name: Checkout |
100 |
| - uses: actions/checkout@v3 |
| 53 | + - name: Setup PHP |
| 54 | + uses: shivammathur/setup-php@v2 |
| 55 | + with: |
| 56 | + php-version: ${{ matrix.php }} |
| 57 | + extensions: gd, xml, zip |
| 58 | + - uses: actions/checkout@v2 |
101 | 59 |
|
102 |
| - - name: Setup PHP, with composer and extensions |
103 |
| - uses: shivammathur/setup-php@v2 |
104 |
| - with: |
105 |
| - php-version: 8.0 |
106 |
| - extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib |
107 |
| - coverage: none |
108 |
| - tools: cs2pr |
| 60 | + - name: Composer Install |
| 61 | + run: composer install --ansi --prefer-dist --no-interaction --no-progress |
109 | 62 |
|
110 |
| - - name: Get composer cache directory |
111 |
| - id: composer-cache |
112 |
| - run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
113 |
| - |
114 |
| - - name: Cache composer dependencies |
115 |
| - uses: actions/cache@v3 |
116 |
| - with: |
117 |
| - path: ${{ steps.composer-cache.outputs.dir }} |
118 |
| - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
119 |
| - restore-keys: ${{ runner.os }}-composer- |
| 63 | + - name: Run phpstan |
| 64 | + run: ./vendor/bin/phpstan analyse -c phpstan.neon.dist |
120 | 65 |
|
121 |
| - - name: Install dependencies |
122 |
| - run: composer install --no-progress --prefer-dist --optimize-autoloader |
123 |
| - |
124 |
| - - name: Static analysis with PHPStan |
125 |
| - run: ./vendor/bin/phpstan analyse |
126 |
| - |
127 |
| - coverage: |
| 66 | + phpunit: |
| 67 | + name: PHPUnit ${{ matrix.php }} |
128 | 68 | runs-on: ubuntu-latest
|
| 69 | + strategy: |
| 70 | + fail-fast: false |
| 71 | + matrix: |
| 72 | + php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] |
129 | 73 | steps:
|
130 |
| - - name: Checkout |
131 |
| - uses: actions/checkout@v3 |
132 |
| - with: |
133 |
| - fetch-depth: 0 |
| 74 | + - name: Setup PHP |
| 75 | + uses: shivammathur/setup-php@v2 |
| 76 | + with: |
| 77 | + php-version: ${{ matrix.php }} |
| 78 | + extensions: gd, xml, zip |
| 79 | + coverage: ${{ (matrix.php == '7.3') && 'xdebug' || 'none' }} |
| 80 | + |
| 81 | + - uses: actions/checkout@v2 |
| 82 | + |
| 83 | + - name: Composer Install |
| 84 | + run: composer install --ansi --prefer-dist --no-interaction --no-progress |
| 85 | + |
| 86 | + - name: Run phpunit |
| 87 | + if: matrix.php != '7.3' |
| 88 | + run: ./vendor/bin/phpunit -c phpunit.xml.dist --no-coverage |
| 89 | + |
| 90 | + - name: Run phpunit |
| 91 | + if: matrix.php == '7.3' |
| 92 | + run: ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/clover.xml |
| 93 | + |
| 94 | + - name: Upload coverage results to Coveralls |
| 95 | + if: matrix.php == '7.3' |
| 96 | + env: |
| 97 | + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 98 | + run: | |
| 99 | + wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar |
| 100 | + chmod +x php-coveralls.phar |
| 101 | + php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv |
| 102 | +
|
| 103 | + samples: |
| 104 | + name: Check samples |
| 105 | + runs-on: ubuntu-latest |
| 106 | + strategy: |
| 107 | + fail-fast: false |
| 108 | + matrix: |
| 109 | + php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] |
| 110 | + steps: |
| 111 | + - name: Setup PHP |
| 112 | + uses: shivammathur/setup-php@v2 |
| 113 | + with: |
| 114 | + php-version: ${{ matrix.php }} |
| 115 | + extensions: gd, xml, zip |
| 116 | + coverage: xdebug |
134 | 117 |
|
135 |
| - - name: Setup PHP, with composer and extensions |
136 |
| - uses: shivammathur/setup-php@v2 |
137 |
| - with: |
138 |
| - php-version: 8.1 |
139 |
| - extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib |
140 |
| - coverage: xdebug |
| 118 | + - uses: actions/checkout@v2 |
141 | 119 |
|
142 |
| - - name: Get composer cache directory |
143 |
| - id: composer-cache |
144 |
| - run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 120 | + - name: Composer Install |
| 121 | + run: composer install --ansi --prefer-dist --no-interaction --no-progress |
145 | 122 |
|
146 |
| - - name: Cache composer dependencies |
147 |
| - uses: actions/cache@v3 |
148 |
| - with: |
149 |
| - path: ${{ steps.composer-cache.outputs.dir }} |
150 |
| - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
151 |
| - restore-keys: ${{ runner.os }}-composer- |
152 |
| - |
153 |
| - - name: Install dependencies |
154 |
| - run: composer install --no-progress --prefer-dist --optimize-autoloader |
155 |
| - |
156 |
| - - name: Run phpunit |
157 |
| - run: ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/clover.xml |
158 |
| - |
159 |
| - - name: Upload coverage results to Coveralls |
160 |
| - env: |
161 |
| - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
162 |
| - run: | |
163 |
| - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar |
164 |
| - chmod +x php-coveralls.phar |
165 |
| - php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv |
| 123 | + - name: Generate samples files |
| 124 | + run: composer run samples |
0 commit comments