{"id":21117245,"url":"https://github.com/wp-content-framework/ci-helper","last_synced_at":"2025-07-16T11:39:39.503Z","repository":{"id":42042587,"uuid":"193848991","full_name":"wp-content-framework/ci-helper","owner":"wp-content-framework","description":"Scripts for Travis CI Test","archived":false,"fork":false,"pushed_at":"2021-07-14T03:18:06.000Z","size":1796,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-08T20:04:39.173Z","etag":null,"topics":["eslint","gh-pages","github-pages","github-releases","jest","phpcs","phpmd","wordpress"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-content-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"custom":"https://paypal.me/technote0space"}},"created_at":"2019-06-26T07:07:11.000Z","updated_at":"2021-11-09T10:13:00.000Z","dependencies_parsed_at":"2022-08-12T03:10:46.170Z","dependency_job_id":null,"html_url":"https://github.com/wp-content-framework/ci-helper","commit_stats":null,"previous_names":[],"tags_count":100,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-content-framework%2Fci-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-content-framework%2Fci-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-content-framework%2Fci-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-content-framework%2Fci-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-content-framework","download_url":"https://codeload.github.com/wp-content-framework/ci-helper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243565416,"owners_count":20311703,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eslint","gh-pages","github-pages","github-releases","jest","phpcs","phpmd","wordpress"],"created_at":"2024-11-20T02:41:10.761Z","updated_at":"2025-03-14T10:44:01.270Z","avatar_url":"https://github.com/wp-content-framework.png","language":"Shell","readme":"# Scripts for Travis CI\r\n\r\n[![Update dependencies](https://github.com/wp-content-framework/ci-helper/workflows/Update%20dependencies/badge.svg)](https://github.com/wp-content-framework/ci-helper/actions?query=workflow%3A%22Update+dependencies%22)\r\n[![CodeFactor](https://www.codefactor.io/repository/github/wp-content-framework/ci-helper/badge)](https://www.codefactor.io/repository/github/wp-content-framework/ci-helper)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/technote-space/jquery.marker-animation/blob/master/LICENSE)\r\n\r\n## Table of Contents\r\n\r\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eDetails\u003c/summary\u003e\n\n- [Overview](#overview)\n- [Usage](#usage)\n  - [0. Prepare `composer.json`, `package.json`](#0-prepare-composerjson-packagejson)\n  - [1. Prepare scripts](#1-prepare-scripts)\n  - [2. Use](#2-use)\n  - [3. Slack](#3-slack)\n- [Check List](#check-list)\n- [Sample Plugins](#sample-plugins)\n\n\u003c/details\u003e\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\r\n## Overview\r\n- Code check\r\n  - PHP\r\n    - PHP_CodeSniffer\r\n    - PHPMD\r\n  - JavaScript\r\n    - ESLint\r\n- Test\r\n  - PHP\r\n    - PHPUnit\r\n  - JavaScript\r\n    - Jest\r\n- Coverage\r\n  - Codecov\r\n- Deploy\r\n  - GitHub releases\r\n  - GitHub pages\r\n  - WP Directory\r\n\r\n## Usage\r\n### 0. Prepare `composer.json`, `package.json`\r\n#### `composer.json`\r\n- require-dev\r\n```json\r\n{\r\n  \"require-dev\": {\r\n    \"squizlabs/php_codesniffer\": \"*\",\r\n    \"wp-coding-standards/wpcs\": \"*\",\r\n    \"phpmd/phpmd\": \"^2.6\",\r\n    \"phpcompatibility/phpcompatibility-wp\": \"*\",\r\n    \"dealerdirect/phpcodesniffer-composer-installer\": \"^0.5.0\",\r\n    \"roave/security-advisories\": \"dev-master\",\r\n    \"phake/phake\": \"^2.3 || ^3.1\",\r\n    \"phpunit/phpunit\": \"^4.8 || ^5.7 || ^7.5\"\r\n  }\r\n}\r\n```\r\n- scripts\r\n```json\r\n{\r\n  \"scripts\": {\r\n    \"phpunit\": [\r\n      \"phpunit\"\r\n    ],\r\n    \"phpcs\": [\r\n      \"phpcs --standard=./phpcs.xml\"\r\n    ],\r\n    \"fix\": [\r\n      \"phpcbf --standard=./phpcs.xml\"\r\n    ],\r\n    \"phpmd\": [\r\n      \"phpmd ./src/,./configs/,./tests/ ansi phpmd.xml\"\r\n    ]\r\n  }\r\n}\r\n```\r\n#### `package.json`\r\n- scripts\r\n```json\r\n{\r\n  \"scripts\": {\r\n    \"lint\": \"eslint src/**/**/*.js \u0026\u0026 eslint __tests__/**/**/*.js\",\r\n    \"cover\": \"jest --coverage\"\r\n  }\r\n}\r\n```\r\n### 1. Prepare scripts\r\nDownload and run `prepare.sh` to create test configs.\r\n\r\n_.travis.yml_\r\n```yaml\r\nbefore_script:\r\n  - git clone --depth=1 https://github.com/wp-content-framework/ci-helper.git ci-helper\r\n  - bash ci-helper/bin/prepare.sh\r\n```\r\n### 2. Use\r\n#### Check coding style\r\n_.travis.yml_\r\n```yaml\r\njobs:\r\n  fast_finish: true\r\n  include:\r\n    - stage: check\r\n      language: php\r\n      php: '7.2'\r\n      script: bash tests/bin/php/phpcs.sh\r\n\r\n    - stage: check\r\n      language: php\r\n      php: '7.2'\r\n      script: bash tests/bin/php/phpmd.sh\r\n\r\n    - stage: check\r\n      language: node_js\r\n      node_js: '11'\r\n      dist: trusty\r\n      script: bash tests/bin/js/js-lint.sh\r\n```\r\n#### Test\r\n\r\n_.travis.yml_\r\n```yaml\r\n    - stage: test\r\n      language: php\r\n      php: '7.2'\r\n      env: WP_VERSION=latest\r\n      script: bash tests/bin/php/wp-test.sh\r\n\r\n    - stage: test\r\n      language: php\r\n      php: '7.2'\r\n      env:\r\n        - WP_VERSION=5.2\r\n        - WP_MULTISITE=1\r\n      script: bash tests/bin/php/wp-test.sh\r\n\r\n    - stage: test\r\n      language: node_js\r\n      node_js: '11'\r\n      dist: trusty\r\n      script: bash tests/bin/js/js-test.sh\r\n```\r\n#### SVN diff\r\n_.travis.yml_\r\n```yaml\r\n    - stage: prepare\r\n      language: node_js\r\n      node_js: '11'\r\n      dist: trusty\r\n      script:\r\n        - source tests/bin/deploy/env.sh\r\n        - bash tests/bin/deploy/wp-check-diff.sh\r\n```\r\n#### Deploy\r\n-  GitHub releases  \r\n1. Go to [Personal access tokens](https://github.com/settings/tokens).\r\n2. Generate token which has **repo** scope.\r\n3. Run `travis encrypt` command to encrypt the token ([Details](https://docs.ci-helper.com/user/encryption-keys/)).  \r\nlike `travis encrypt \"\u003cGitHub Token\u003e\" --com -r \u003cowner\u003e/\u003crepo\u003e`\r\n\r\nor use `travis setup releases` command.\r\n\r\n_.travis.yml_\r\n```yaml\r\n    - stage: deploy\r\n      language: node_js\r\n      node_js: '11'\r\n      dist: trusty\r\n      script: skip\r\n      before_deploy:\r\n        - source tests/bin/deploy/env.sh\r\n        - bash tests/bin/deploy/create.sh\r\n      deploy:\r\n        provider: releases\r\n        skip_cleanup: true\r\n        name: ${RELEASE_TITLE}\r\n        tag_name: ${RELEASE_TAG}\r\n        file: ${RELEASE_FILE}\r\n        api_key:\r\n          secure: \u003cencrypted token\u003e\r\n        overwrite: true\r\n        on:\r\n          tags: true\r\n```\r\n- GitHub pages\r\n1. Go to [Personal access tokens](https://github.com/settings/tokens).\r\n2. Generate token which has **repo** scope and set as Environment Variables _GITHUB_TOKEN_ in the settings page.\r\n3. Create script `bin/gh-pages/setup.sh`, `bin/gh-pages/pre_install.sh` or `bin/gh-pages/pre_setup.sh` to setup assets.\r\n\r\n_.travis.yml_\r\n```yaml\r\n    - stage: deploy\r\n      language: node_js\r\n      node_js: '11'\r\n      dist: trusty\r\n      env:\r\n        - GH_PAGES_PLUGIN_SCRIPT=\"./index.min.js\"\r\n        - GH_PAGES_PLUGIN_STYLE=\"./index.css\"\r\n        - GH_PAGES_TITLE=\"Test\"\r\n        - GH_PAGES_TEMPLATE=gutenberg\r\n        - GH_PAGES_TRACKING_ID=UA-XXXXXXXX-X\r\n      script: skip\r\n      before_deploy:\r\n        - source tests/bin/deploy/env.sh\r\n        - bash tests/bin/deploy/gh-pages.sh\r\n      deploy:\r\n        provider: pages\r\n        skip_cleanup: true\r\n        github_token: ${GITHUB_TOKEN}\r\n        keep_history: true\r\n        local_dir: ${GH_PAGES_DIR}\r\n        on:\r\n          branch: master\r\n```\r\n\r\n- WP Directory\r\n1. Set Environment Variables _SVN_USER_ and _SVN_PASS_ in the settings page\r\n\r\n_.travis.yml_\r\n```yaml\r\n    - stage: deploy\r\n      language: node_js\r\n      node_js: '11'\r\n      dist: trusty\r\n      script: skip\r\n      before_deploy:\r\n        - source tests/bin/deploy/env.sh\r\n      deploy:\r\n        provider: script\r\n        skip_cleanup: true\r\n        script: bash tests/bin/deploy/wp-release.sh\r\n        on:\r\n          tags: true\r\n```\r\n\r\n### 3. Slack\r\n1. Install Travis CI slack app and get `Token`.\r\n2. Run `travis encrypt` command to encrypt the token.  \r\nlike `travis encrypt \"\u003caccount\u003e:\u003ctoken\u003e\" --com -r \u003cowner\u003e/\u003crepo\u003e`\r\n\r\n_.travis.yml_\r\n```yaml\r\nnotifications:\r\n  email: false\r\n  slack:\r\n    secure: \u003cencrypted token\u003e\r\n```\r\n\r\n## Check List\r\n- [ ] composer.json\r\n  - [ ] require\r\n  - [ ] scripts\r\n- [ ] package.json\r\n  - [ ] scripts\r\n- [ ] .travis.yml\r\n  - [ ] before_script\r\n  - [ ] jobs\r\n    - [ ] Check coding style\r\n    - [ ] Test\r\n    - [ ] SVN diff\r\n    - [ ] Deploy\r\n      - [ ] GitHub release\r\n        - [ ] `GITHUB_TOKEN`\r\n      - [ ] GitHub pages\r\n        - [ ] `GITHUB_TOKEN`\r\n        - [ ] `bin/gh-pages/plugin.sh`\r\n      - [ ] WP Directory\r\n        - [ ] `SVN_USER`\r\n        - [ ] `SVN_PASS`\r\n  - [ ] Slack\r\n    - [ ] `SLACK_TOKEN`\r\n\r\n## Sample Plugins\r\n[Test Travis](https://github.com/technote-space/test-travis)  \r\n","funding_links":["https://paypal.me/technote0space"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-content-framework%2Fci-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-content-framework%2Fci-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-content-framework%2Fci-helper/lists"}