Skip to content

Commit 67ea856

Browse files
committed
add git workflow
1 parent 1bd7cd6 commit 67ea856

File tree

3 files changed

+199
-0
lines changed

3 files changed

+199
-0
lines changed

.github/support.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Label used to mark issues as support requests
2+
supportLabel: Question
3+
# Comment to post on issues marked as support requests. Add a link
4+
# to a support page, or set to `false` to disable
5+
supportComment: >
6+
This looks like a support question. Please ask your support questions on
7+
[StackOverflow](http://stackoverflow.com/questions/tagged/phpword),
8+
or [Gitter](https://gitter.im/PHPOffice/PHPWord).
9+
10+
Thank you for your contributions.
11+
12+
# Whether to close issues marked as support requests
13+
close: true
14+
# Whether to lock issues marked as support requests
15+
lock: false

.github/workflows/ci.yml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: CI
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
php-version:
11+
- '7.2'
12+
- "7.3"
13+
- "7.4"
14+
- "8.0"
15+
16+
name: PHP ${{ matrix.php-version }}
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Setup PHP, with composer and extensions
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: ${{ matrix.php-version }}
26+
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
27+
coverage: none
28+
29+
- name: Get composer cache directory
30+
id: composer-cache
31+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
32+
33+
- name: Cache composer dependencies
34+
uses: actions/cache@v2
35+
with:
36+
path: ${{ steps.composer-cache.outputs.dir }}
37+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
38+
restore-keys: ${{ runner.os }}-composer-
39+
40+
- name: Delete composer lock file
41+
id: composer-lock
42+
if: "startsWith(matrix.php-version, '8.')"
43+
run: |
44+
rm composer.lock
45+
echo "::set-output name=flags::--ignore-platform-reqs"
46+
47+
- name: Install dependencies
48+
run: composer update --no-progress --prefer-dist --optimize-autoloader ${{ steps.composer-lock.outputs.flags }}
49+
50+
- name: Setup problem matchers for PHP
51+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
52+
53+
- name: Setup problem matchers for PHPUnit
54+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
55+
56+
- name: Configure matchers
57+
uses: mheap/phpunit-matcher-action@v1
58+
59+
- name: Test with PHPUnit
60+
run: ./vendor/bin/phpunit --teamcity test
61+
62+
php-cs-fixer:
63+
runs-on: ubuntu-latest
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v2
67+
68+
- name: Setup PHP, with composer and extensions
69+
uses: shivammathur/setup-php@v2
70+
with:
71+
php-version: 7.4
72+
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
73+
coverage: none
74+
tools: cs2pr
75+
76+
- name: Get composer cache directory
77+
id: composer-cache
78+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
79+
80+
- name: Cache composer dependencies
81+
uses: actions/cache@v2
82+
with:
83+
path: ${{ steps.composer-cache.outputs.dir }}
84+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
85+
restore-keys: ${{ runner.os }}-composer-
86+
87+
- name: Install dependencies
88+
run: composer install --no-progress --prefer-dist --optimize-autoloader
89+
90+
- name: Code style with PHP-CS-Fixer
91+
run: ./vendor/bin/php-cs-fixer fix --format=checkstyle | cs2pr
92+
93+
phpcs:
94+
runs-on: ubuntu-latest
95+
steps:
96+
- name: Checkout
97+
uses: actions/checkout@v2
98+
99+
- name: Setup PHP, with composer and extensions
100+
uses: shivammathur/setup-php@v2
101+
with:
102+
php-version: 7.4
103+
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
104+
coverage: none
105+
tools: cs2pr
106+
107+
- name: Get composer cache directory
108+
id: composer-cache
109+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
110+
111+
- name: Cache composer dependencies
112+
uses: actions/cache@v2
113+
with:
114+
path: ${{ steps.composer-cache.outputs.dir }}
115+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
116+
restore-keys: ${{ runner.os }}-composer-
117+
118+
- name: Install dependencies
119+
run: composer install --no-progress --prefer-dist --optimize-autoloader
120+
121+
- name: Code style with PHP_CodeSniffer
122+
run: ./vendor/bin/phpcs -q --report=checkstyle | cs2pr
123+
124+
coverage:
125+
runs-on: ubuntu-latest
126+
steps:
127+
- name: Checkout
128+
uses: actions/checkout@v2
129+
130+
- name: Setup PHP, with composer and extensions
131+
uses: shivammathur/setup-php@v2
132+
with:
133+
php-version: 7.4
134+
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
135+
coverage: pcov
136+
137+
- name: Get composer cache directory
138+
id: composer-cache
139+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
140+
141+
- name: Cache composer dependencies
142+
uses: actions/cache@v2
143+
with:
144+
path: ${{ steps.composer-cache.outputs.dir }}
145+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
146+
restore-keys: ${{ runner.os }}-composer-
147+
148+
- name: Install dependencies
149+
run: composer install --no-progress --prefer-dist --optimize-autoloader
150+
151+
- name: Coverage
152+
run: |
153+
./vendor/bin/phpunit --coverage-clover coverage-clover.xml
154+
curl -LO https://scrutinizer-ci.com/ocular.phar
155+
php ocular.phar code-coverage:upload --format=php-clover coverage-clover.xml

.github/workflows/github-pages.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: GithHub Pages
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
7+
jobs:
8+
github-pages:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
14+
- name: Setup PHP, with composer and extensions
15+
uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: 7.4
18+
coverage: none # remove xdebug
19+
20+
- name: Build API documentation
21+
run: |
22+
curl -LO https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.0.0/phpDocumentor.phar
23+
php phpDocumentor.phar --directory src/ --target docs/api
24+
25+
- name: Deploy to GithHub Pages
26+
uses: peaceiris/actions-gh-pages@v3
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
publish_dir: ./docs/api

0 commit comments

Comments
 (0)