Skip to content

Commit cd616c8

Browse files
committed
CI GitHub workflow initial (#9)
* require recipe-cms
1 parent 3e09943 commit cd616c8

File tree

12 files changed

+334
-57
lines changed

12 files changed

+334
-57
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: 'BUG '
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: 'FEATURE '
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/workflows/ci.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
name: "CI"
10+
11+
jobs:
12+
tests:
13+
name: "Tests"
14+
15+
runs-on: "ubuntu-latest"
16+
17+
env:
18+
php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip
19+
20+
services:
21+
mysql:
22+
image: "mysql:5.7"
23+
env:
24+
MYSQL_ALLOW_EMPTY_PASSWORD: true
25+
MYSQL_ROOT_PASSWORD:
26+
MYSQL_DATABASE: test_db
27+
ports:
28+
- 3306/tcp
29+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
30+
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
php-version:
35+
- "7.3"
36+
- "7.4"
37+
38+
steps:
39+
- name: "Checkout"
40+
uses: "actions/checkout@v2"
41+
42+
- name: "Install PHP with extensions"
43+
uses: "shivammathur/setup-php@v2"
44+
with:
45+
php-version: "${{ matrix.php-version }}"
46+
extensions: "${{ env.php_extensions }}"
47+
coverage: "xdebug"
48+
49+
- name: "Start mysql service"
50+
run: "sudo /etc/init.d/mysql start"
51+
52+
- name: "Cache dependencies installed with composer"
53+
uses: "actions/cache@v1"
54+
with:
55+
path: "~/.composer/cache"
56+
key: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}"
57+
restore-keys: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
58+
59+
- name: "Authorize private packagist"
60+
env:
61+
COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }}
62+
run: "if [[ $COMPOSER_TOKEN ]]; then composer config --global --auth http-basic.repo.packagist.com token $COMPOSER_TOKEN; fi"
63+
64+
- name: "Install dependencies with composer"
65+
run: "composer install --no-ansi --no-interaction --no-progress"
66+
67+
- name: "Run tests with phpunit/phpunit"
68+
env:
69+
SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
70+
run: "vendor/bin/phpunit --coverage-html=build/logs/coverage/html --coverage-xml=build/logs/coverage"
71+
72+
- name: "Archive code coverage results"
73+
uses: "actions/upload-artifact@v2"
74+
with:
75+
name: "coverage"
76+
path: "build/logs/coverage/html"
77+
78+
- name: "Run tests with squizlabs/php_codesniffer"
79+
run: "vendor/bin/phpcs src/ tests/ --standard=phpcs.xml.dist --report=checkstyle --report-file=build/logs/checkstyle.xml"
80+
81+
- name: "Archive checkstyle results"
82+
uses: "actions/upload-artifact@v2"
83+
with:
84+
name: "checkstyle"
85+
path: "build/logs/checkstyle.xml"
86+
87+
#- name: "Run tests with phpmd/phpmd"
88+
# run: "vendor/bin/phpmd src xml codesize,unusedcode,naming --reportfile build/logs/pmd.xml --exclude vendor/ --exclude autoload.php"
89+
90+
- name: "Run tests with phploc/phploc"
91+
run: "vendor/bin/phploc --count-tests --exclude vendor/ --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml src/ tests/
92+
"
93+
- name: "Run tests with pdepend/pdepend"
94+
run: "vendor/bin/pdepend --jdepend-xml=build/logs/jdepend.xml --ignore=vendor src"
95+
96+
- name: "Publish documentation"
97+
run: "vendor/bin/phpdox -f phpdox.xml"
98+
99+
- name: "Archive documentation"
100+
uses: "actions/upload-artifact@v2"
101+
with:
102+
name: "documentation"
103+
path: "docs/html"

.scrutinizer.yml

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,15 @@
11
inherit: true
22

3-
#Copied from https://www.adayinthelifeof.nl/2013/11/20/external-code-coverage-with-travis-scrutinizer/
4-
tools:
5-
external_code_coverage:
6-
timeout: 600
7-
php_code_sniffer:
8-
config:
9-
standard: PSR2
10-
php_cs_fixer:
11-
extensions:
12-
# Default:
13-
- php
14-
fixers: []
15-
enabled: false
16-
filter:
17-
paths: [tests/*,src/*]
18-
excluded_paths: []
19-
coding_style:
20-
php:
21-
indentation:
22-
general:
23-
use_tabs: false
24-
25-
checks:
26-
php:
27-
code_rating: true
28-
duplication: true
29-
303
build:
314
nodes:
325
analysis:
336
tests:
347
override: [php-scrutinizer-run]
358

9+
checks:
10+
php:
11+
code_rating: true
12+
duplication: true
13+
3614
filter:
37-
paths: [tests/*,src/*]
15+
paths: [src/*, tests/*]

.travis.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
language: php
22

3+
services:
4+
- mysql
5+
- postgresql
6+
37
env:
48
global:
5-
- COMPOSER_ROOT_VERSION=4.0.x-dev
6-
- CODECOV_TOKEN=
7-
- SCRUT_TOKEN=
9+
- TRAVIS_NODE_VERSION="10"
810

911
matrix:
1012
include:
11-
- php: 7.0
12-
env: DB=MYSQL PHPUNIT_TEST=1 PHPCS_TEST=1
13-
- php: 7.1
14-
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
15-
- php: 5.6
16-
env: DB=MYSQL PHPUNIT_TEST=1
13+
- php: 7.2
14+
env: DB=MYSQL RECIPE_VERSION=4.4.x-dev PHPUNIT_TEST=1
15+
- php: 7.3
16+
env: DB=MYSQL RECIPE_VERSION=4.5.x-dev PHPUNIT_TEST=1 PHPCS_TEST=1
17+
- php: 7.4
18+
env: DB=PGSQL RECIPE_VERSION=4.6.x-dev PHPUNIT_COVERAGE_TEST=1
19+
- php: 7.4
20+
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1
1721

1822
before_script:
19-
# Init PHP
2023
- phpenv rehash
2124
- phpenv config-rm xdebug.ini
22-
- echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
2325

24-
# Install composer dependencies
25-
- composer require --prefer-dist --no-update silverstripe-themes/simple:~3.2
26-
- composer update --no-suggest --prefer-dist
26+
- composer validate
27+
- composer require --no-update silverstripe/recipe-cms:"$RECIPE_VERSION"
28+
- if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.1.x-dev; fi
29+
- composer install --prefer-source --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile
2730

2831
script:
2932
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
30-
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml && wget https://scrutinizer-ci.com/ocular.phar; fi
31-
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi
33+
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
34+
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/ *.php; fi
3235

3336
after_success:
34-
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml -t $CODECOV_TOKEN && travis_retry php ocular.phar code-coverage:upload --format=php-clover --access-token=$SCRUT_TOKEN coverage.xml; fi
37+
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml -F php; fi

CONTRIBUTING.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
# Contributing
2+
- Maintenance on this module is a shared effort of those who use it
3+
- To contribute improvements to the code, ensure you raise a pull request and discuss with the module maintainers
4+
- Please follow the SilverStripe [code contribution guidelines](https://docs.silverstripe.org/en/contributing/code/) and [Module Standard](https://docs.silverstripe.org/en/developer_guides/extending/modules/#module-standard)
5+
- Supply documentation that followS the [GitHub Flavored Markdown](https://help.github.com/articles/markdown-basics/) conventions
6+
- When having discussions about this module in issues or pull request please adhere to the [SilverStripe Community Code of Conduct](https://docs.silverstripe.org/en/contributing/code_of_conduct/)
27

3-
Contributions are welcome! Create an issue, explaining a bug or proposal. Submit pull requests if you feel brave.
8+
9+
## Contributor license agreement
10+
By supplying code to this module in patches, tickets and pull requests, you agree to assign copyright
11+
of that code to Dynamic, on the condition that these code changes are released under the
12+
same BSD license as the original module. We ask for this so that the ownership in the license is clear
13+
and unambiguous. By releasing this code under a permissive license such as BSD, this copyright assignment
14+
won't prevent you from using the code in any way you see fit.

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2018, Dynamic
1+
Copyright (c) 2018, Dynamic, Inc.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@
1515
"license": "BSD-3-Clause",
1616
"require": {
1717
"dnadesign/silverstripe-elemental": "^4.0",
18+
"silverstripe/recipe-cms": "^4.4",
1819
"silverstripe/vendor-plugin": "^1.0"
1920
},
2021
"require-dev": {
22+
"pdepend/pdepend": "^2.5",
23+
"phploc/phploc": "^4.0",
24+
"phpmd/phpmd": "^2.6",
2125
"phpunit/phpunit": "^5.7",
22-
"squizlabs/php_codesniffer": "*"
26+
"sebastian/phpcpd": "^3.0",
27+
"squizlabs/php_codesniffer": "^3.0",
28+
"theseer/phpdox": "^0.11"
2329
},
2430
"config": {
2531
"process-timeout": 600

docs/en/index.md

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

docs/en/userguide/index.md

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

0 commit comments

Comments
 (0)