Details
- Code check
- PHP
- PHP_CodeSniffer
- PHPMD
- JavaScript
- ESLint
- PHP
- Test
- PHP
- PHPUnit
- JavaScript
- Jest
- PHP
- Coverage
- Codecov
- Deploy
- GitHub releases
- GitHub pages
- WP Directory
- require-dev
{
"require-dev": {
"squizlabs/php_codesniffer": "*",
"wp-coding-standards/wpcs": "*",
"phpmd/phpmd": "^2.6",
"phpcompatibility/phpcompatibility-wp": "*",
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"roave/security-advisories": "dev-master",
"phake/phake": "^2.3 || ^3.1",
"phpunit/phpunit": "^4.8 || ^5.7 || ^7.5"
}
}
- scripts
{
"scripts": {
"phpunit": [
"phpunit"
],
"phpcs": [
"phpcs --standard=./phpcs.xml"
],
"fix": [
"phpcbf --standard=./phpcs.xml"
],
"phpmd": [
"phpmd ./src/,./configs/,./tests/ ansi phpmd.xml"
]
}
}
- scripts
{
"scripts": {
"lint": "eslint src/**/**/*.js && eslint __tests__/**/**/*.js",
"cover": "jest --coverage"
}
}
Download and run prepare.sh
to create test configs.
.travis.yml
before_script:
- git clone --depth=1 https://github.com/wp-content-framework/ci-helper.git ci-helper
- bash ci-helper/bin/prepare.sh
.travis.yml
jobs:
fast_finish: true
include:
- stage: check
language: php
php: '7.2'
script: bash tests/bin/php/phpcs.sh
- stage: check
language: php
php: '7.2'
script: bash tests/bin/php/phpmd.sh
- stage: check
language: node_js
node_js: '11'
dist: trusty
script: bash tests/bin/js/js-lint.sh
.travis.yml
- stage: test
language: php
php: '7.2'
env: WP_VERSION=latest
script: bash tests/bin/php/wp-test.sh
- stage: test
language: php
php: '7.2'
env:
- WP_VERSION=5.2
- WP_MULTISITE=1
script: bash tests/bin/php/wp-test.sh
- stage: test
language: node_js
node_js: '11'
dist: trusty
script: bash tests/bin/js/js-test.sh
.travis.yml
- stage: prepare
language: node_js
node_js: '11'
dist: trusty
script:
- source tests/bin/deploy/env.sh
- bash tests/bin/deploy/wp-check-diff.sh
- GitHub releases
- Go to Personal access tokens.
- Generate token which has repo scope.
- Run
travis encrypt
command to encrypt the token (Details).
liketravis encrypt "<GitHub Token>" --com -r <owner>/<repo>
or use travis setup releases
command.
.travis.yml
- stage: deploy
language: node_js
node_js: '11'
dist: trusty
script: skip
before_deploy:
- source tests/bin/deploy/env.sh
- bash tests/bin/deploy/create.sh
deploy:
provider: releases
skip_cleanup: true
name: ${RELEASE_TITLE}
tag_name: ${RELEASE_TAG}
file: ${RELEASE_FILE}
api_key:
secure: <encrypted token>
overwrite: true
on:
tags: true
- GitHub pages
- Go to Personal access tokens.
- Generate token which has repo scope and set as Environment Variables GITHUB_TOKEN in the settings page.
- Create script
bin/gh-pages/setup.sh
,bin/gh-pages/pre_install.sh
orbin/gh-pages/pre_setup.sh
to setup assets.
.travis.yml
- stage: deploy
language: node_js
node_js: '11'
dist: trusty
env:
- GH_PAGES_PLUGIN_SCRIPT="./index.min.js"
- GH_PAGES_PLUGIN_STYLE="./index.css"
- GH_PAGES_TITLE="Test"
- GH_PAGES_TEMPLATE=gutenberg
- GH_PAGES_TRACKING_ID=UA-XXXXXXXX-X
script: skip
before_deploy:
- source tests/bin/deploy/env.sh
- bash tests/bin/deploy/gh-pages.sh
deploy:
provider: pages
skip_cleanup: true
github_token: ${GITHUB_TOKEN}
keep_history: true
local_dir: ${GH_PAGES_DIR}
on:
branch: master
- WP Directory
- Set Environment Variables SVN_USER and SVN_PASS in the settings page
.travis.yml
- stage: deploy
language: node_js
node_js: '11'
dist: trusty
script: skip
before_deploy:
- source tests/bin/deploy/env.sh
deploy:
provider: script
skip_cleanup: true
script: bash tests/bin/deploy/wp-release.sh
on:
tags: true
- Install Travis CI slack app and get
Token
. - Run
travis encrypt
command to encrypt the token.
liketravis encrypt "<account>:<token>" --com -r <owner>/<repo>
.travis.yml
notifications:
email: false
slack:
secure: <encrypted token>
- composer.json
- require
- scripts
- package.json
- scripts
- .travis.yml
- before_script
- jobs
- Check coding style
- Test
- SVN diff
- Deploy
- GitHub release
-
GITHUB_TOKEN
-
- GitHub pages
-
GITHUB_TOKEN
-
bin/gh-pages/plugin.sh
-
- WP Directory
-
SVN_USER
-
SVN_PASS
-
- GitHub release
- Slack
-
SLACK_TOKEN
-