-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,11 @@ | ||
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ '**' ] | ||
pull_request: | ||
branches: [ '**' ] | ||
|
||
name: "CI" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
name: "Tests" | ||
|
||
runs-on: "ubuntu-latest" | ||
|
||
env: | ||
php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip | ||
|
||
services: | ||
mysql: | ||
image: "mysql:8.0" | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: true | ||
MYSQL_ROOT_PASSWORD: | ||
MYSQL_DATABASE: test_db | ||
ports: | ||
- 3306/tcp | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: | ||
- "8.1" | ||
- "8.2" | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v2" | ||
|
||
- name: "Install PHP with extensions" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
extensions: "${{ env.php_extensions }}" | ||
coverage: "xdebug" | ||
|
||
- name: "Start mysql service" | ||
run: "sudo /etc/init.d/mysql start" | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: "actions/cache@v1" | ||
with: | ||
path: "~/.composer/cache" | ||
key: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}" | ||
restore-keys: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" | ||
|
||
- name: "Authorize private packagist" | ||
env: | ||
COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }} | ||
run: "if [[ $COMPOSER_TOKEN ]]; then composer config --global --auth http-basic.repo.packagist.com token $COMPOSER_TOKEN; fi" | ||
|
||
- name: "Install dependencies with composer" | ||
run: "composer install --no-ansi --no-interaction --no-progress" | ||
|
||
- name: "Run tests with phpunit/phpunit" | ||
env: | ||
SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }} | ||
run: "vendor/bin/phpunit --coverage-html=build/logs/coverage/html --coverage-xml=build/logs/coverage" | ||
|
||
- name: "Archive code coverage results" | ||
uses: "actions/upload-artifact@v2" | ||
with: | ||
name: "coverage" | ||
path: "build/logs/coverage/html" | ||
|
||
- name: "Run tests with squizlabs/php_codesniffer" | ||
run: "vendor/bin/phpcs src/ tests/ --standard=phpcs.xml.dist --report=checkstyle --report-file=build/logs/checkstyle.xml" | ||
|
||
- name: "Archive checkstyle results" | ||
uses: "actions/upload-artifact@v2" | ||
with: | ||
name: "checkstyle" | ||
path: "build/logs/checkstyle.xml" | ||
|
||
- name: "Run tests with phpmd/phpmd" | ||
run: "vendor/bin/phpmd src xml codesize,unusedcode,naming --reportfile build/logs/pmd.xml --exclude vendor/ --exclude autoload.php || exit 0" | ||
|
||
- name: "Run tests with phploc/phploc" | ||
run: "vendor/bin/phploc --count-tests --exclude vendor/ --log-csv build/logs/phploc.csv --log-xml build/logs/phploc.xml src/ tests/ | ||
" | ||
- name: "Run tests with pdepend/pdepend" | ||
run: "vendor/bin/pdepend --jdepend-xml=build/logs/jdepend.xml --ignore=vendor src" | ||
|
||
- name: "Publish documentation" | ||
run: "vendor/bin/phpdox -f phpdox.xml" | ||
|
||
- name: "Archive documentation" | ||
uses: "actions/upload-artifact@v2" | ||
with: | ||
name: "documentation" | ||
path: "docs/html" | ||
ci: | ||
name: CI | ||
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ruleset name="SilverStripe"> | ||
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description> | ||
<ruleset name="Silverstripe"> | ||
<description>CodeSniffer ruleset for Silverstripe coding conventions.</description> | ||
|
||
<file>src</file> | ||
<file>tests</file> | ||
|
||
<!-- base rules are PSR-12 --> | ||
<rule ref="PSR12" > | ||
<!-- Current exclusions --> | ||
<!--<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />--> | ||
<!-- You may need to use this exclusion if you override some core methods --> | ||
<!--<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />--> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true"> | ||
<testsuite name="silverstripe-module/skeleton"> | ||
<directory>tests/</directory> | ||
</testsuite> | ||
<filter> | ||
<whitelist addUncoveredFilesFromWhitelist="true"> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
<coverage includeUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">src/</directory> | ||
<exclude> | ||
<directory suffix=".php">tests/</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
</include> | ||
<exclude> | ||
<directory suffix=".php">tests/</directory> | ||
</exclude> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="default"> | ||
<directory>tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |