Skip to content

Commit b51ea18

Browse files
author
Greg Bowler
authored
Introduce Github action (#218)
* Update blank.yml * Improve CI * Run PHPUnit in same action * Remove PHPUnit from same job * Debug via SSH * Stupid YAML indentation * ci config * Use default command * Add PHPUnit to action * Use cached dependencies and build artifacts * Wait for build before tests execute * Improve compatibility with traits' constant usage * Specify path to download artifact * self-host from docker * yml syntax * Use v1 actions * Checkout v2 * Temporarily remove dependency cache * Use Github hosted runner to isolate issue * Check files on runner * Show pwd * Rename to match naming convention * Update path map * Remove test scripts * Rename jobs * yaml * Comment about jobs * Use test/phpunit directory * Change directory to repo * Change directory to repo * Upgrade PHPUnit * Specify PHPUnit config * Use PHP 7.4 * Use PHP 7.4 * Upgrade scrutinizer * Upgrade scrutinizer * typo in config
1 parent 0dcee82 commit b51ea18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+9329
-308
lines changed

.circleci/config.yml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
version: 2
22

3+
# Jobs are split into build and test-phpunit so that in the future, other types
4+
# of test can be run concurrently after build step has completed.
35
jobs:
46
build:
57
docker:
6-
- image: circleci/php:7.2-cli
8+
- image: circleci/php:7.4-cli
79

810
working_directory: ~/repo
911

@@ -12,8 +14,8 @@ jobs:
1214

1315
- restore_cache:
1416
keys:
15-
- v1-dependencies-{{ checksum "composer.json" }}
16-
- v1-dependencies-
17+
- v1-dependencies-{{ checksum "composer.json" }}
18+
- v1-dependencies-
1719

1820
- run: composer install -n --prefer-dist
1921

@@ -22,12 +24,38 @@ jobs:
2224
- ./vendor
2325
key: v1-dependencies-{{ checksum "composer.json" }}
2426

25-
- run: mkdir test/unit/_junit
26-
- run: vendor/bin/phpunit -c test/unit/phpunit.xml --log-junit test/unit/_junit/junit.xml -d memory_limit=512M
27+
- persist_to_workspace:
28+
root: /home/circleci/repo
29+
paths:
30+
- ./
31+
32+
test-phpunit:
33+
docker:
34+
- image: circleci/php:7.4-cli
35+
36+
working-directory: ~/repo
37+
38+
steps:
39+
- attach_workspace:
40+
at: /home/circleci/repo
41+
- run: cd ~/repo && mkdir test/phpunit/_junit
42+
- run:
43+
name: PHPUnit tests
44+
command: cd ~/repo && vendor/bin/phpunit -c test/phpunit/phpunit.xml --log-junit test/phpunit/_junit/junit.xml
2745

2846
- store_test_results:
29-
path: test/unit/_junit
47+
path: test/phpunit/_junit
3048

3149
- store_artifacts:
32-
path: test/unit/_coverage
33-
destination: TestCoverage
50+
path: test/phpunit/_coverage
51+
destination: TestCoverage
52+
53+
workflows:
54+
version: 2
55+
56+
ci:
57+
jobs:
58+
- build
59+
- test-phpunit:
60+
requires:
61+
- build

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: php-actions/composer@v2
12+
- name: Upload build for test runner
13+
uses: actions/upload-artifact@v2
14+
with:
15+
name: build-artifact
16+
path: ./
17+
18+
test:
19+
runs-on: ubuntu-latest
20+
needs: [build]
21+
22+
steps:
23+
- uses: actions/download-artifact@v2
24+
with:
25+
name: build-artifact
26+
path: ./
27+
28+
- name: PHP Unit tests
29+
uses: php-actions/phpunit@v9
30+
with:
31+
configuration: test/phpunit/phpunit.xml

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/vendor
22
/.idea
3-
/test/unit/_coverage
3+
/test/phpunit/_coverage
4+
.phpunit.result.cache

.scrutinizer.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
build:
22
environment:
33
php:
4-
version: 7.2.0
4+
version: 7.4.0
55
tests:
66
override:
7+
- php-scrutinizer-run
8+
- phpcs-run ./src
79
-
8-
command: 'vendor/bin/phpunit test/unit --coverage-clover coverage --whitelist src'
10+
command: 'vendor/bin/phpunit test/phpunit --coverage-clover coverage --whitelist src'
911
coverage:
1012
file: 'coverage'
1113
format: 'php-clover'

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414

1515
"require-dev": {
16-
"phpunit/phpunit": "8.*"
16+
"phpunit/phpunit": "9.*"
1717
},
1818

1919
"license": "MIT",
@@ -69,7 +69,7 @@
6969
},
7070
"autoload-dev": {
7171
"psr-4": {
72-
"Gt\\Dom\\Test\\": "./test/unit"
72+
"Gt\\Dom\\Test\\": "./test/phpunit"
7373
}
7474
}
7575
}

0 commit comments

Comments
 (0)