Skip to content

Commit b76adf1

Browse files
committed
Merge branch 'develop' into feature/543-build
2 parents cf4f3c7 + c3e4b17 commit b76adf1

18 files changed

+1358
-656
lines changed

.coveralls.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
service_name: travis-ci
16-
coverage_clover: build/logs/clover.xml
17-
json_path: build/logs/coveralls-upload.json
15+
coverage_clover: plugin/tests/coverage/clover.xml
16+
json_path: plugin/tests/coverage/coveralls-upload.json

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ Fixes #
55

66
## Checklist
77

8-
- [ ] My pull request is addressing an [open issue](https://github.com/xwp/material-design-wp-plugin/issues) (please create one otherwise).
9-
- [ ] My code is tested and passes existing [tests](https://github.com/xwp/material-design-wp-plugin/contributing.md#scripts).
10-
- [ ] My code follows the [Contributing Guidelines](https://github.com/xwp/material-design-wp-plugin/contributing.md) (updates are often made to the guidelines, check it out periodically).
8+
- [ ] My pull request is addressing an [open issue](https://github.com/material-components/material-design-for-wordpress/issues) (please create one otherwise).
9+
- [ ] My code is tested and passes existing [tests](https://github.com/material-components/material-design-for-wordpress/contributing.md#scripts).
10+
- [ ] My code follows the [Contributing Guidelines](https://github.com/material-components/material-design-for-wordpress/contributing.md) (updates are often made to the guidelines, check it out periodically).

.github/workflows/lint-tests.yml

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
name: Coding Standards and Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
pull_request:
9+
10+
jobs:
11+
lint:
12+
name: "Coding Standards"
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-node@v1
18+
with:
19+
node-version: "14"
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Run coding standards check
25+
run: npm run lint
26+
27+
test-e2e:
28+
needs: [lint]
29+
name: "E2E tests (PHP ${{ matrix.php_versions }}, WordPress ${{ matrix.wp_versions }})"
30+
runs-on: ubuntu-latest
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
php_versions: [7.4]
36+
wp_versions: [5.7]
37+
include:
38+
- php_versions: 7.3
39+
wp_versions: 5.2
40+
41+
env:
42+
NODE_ENV: teste2e
43+
WP_VERSION: ${{ matrix.wp_versions }}
44+
PHP_VERSION: php${{ matrix.php_versions }}-apache
45+
46+
steps:
47+
- uses: actions/checkout@v2
48+
- uses: hmarr/debug-action@v2
49+
- uses: actions/setup-node@v1
50+
with:
51+
node-version: "14"
52+
53+
- name: Install dependencies
54+
run: npm ci
55+
56+
- name: Build assets
57+
run: npm run build:js
58+
59+
- name: Start docker local env
60+
run: |
61+
npm run env:start
62+
docker-compose exec -T wordpress bash -c "chown -R www-data:www-data /var/www/html/wp-content/" # ensure WP folders have correct permissions
63+
docker-compose exec -T mysql bash -c "chown -R mysql:mysql /var/lib/mysql"
64+
65+
- name: Docker containers debug information
66+
run: |
67+
docker ps -a
68+
69+
- name: Sleep for 10 seconds
70+
uses: jakejarvis/wait-action@master
71+
with:
72+
time: '10s'
73+
74+
- name: Install WordPress
75+
run: |
76+
npm run wp -- wp core install --title=WordPress --admin_user=admin --admin_password=password [email protected] --skip-email --url=http://localhost:8088 --quiet
77+
npm run wp -- wp plugin activate material-design
78+
79+
- name: Run E2E tests
80+
if: ${{ matrix.wp_versions == '5.2' }}
81+
run: npm run test:e2e
82+
83+
- name: Run E2E tests with coverage
84+
if: ${{ matrix.wp_versions != '5.2' }}
85+
run: |
86+
sudo chown -R runner:runner plugin/tests node_modules # ensure coverage folder can be created
87+
npm run test:e2e:coverage
88+
89+
- name: Coveralls
90+
if: ${{ matrix.wp_versions != '5.2' }}
91+
uses: coverallsapp/github-action@master
92+
with:
93+
github-token: ${{ secrets.GITHUB_TOKEN }}
94+
path-to-lcov: ./plugin/tests/coverage/e2e/lcov.info
95+
flag-name: "E2E Tests"
96+
parallel: true
97+
98+
test-js:
99+
needs: [lint]
100+
name: "JS unit tests (with code coverage)"
101+
runs-on: ubuntu-latest
102+
103+
steps:
104+
- uses: actions/checkout@v2
105+
- uses: actions/setup-node@v1
106+
with:
107+
node-version: "14"
108+
109+
- name: Install dependencies
110+
run: npm ci
111+
112+
- name: Run JS tests
113+
run: npm run test:js:coverage
114+
115+
- name: Coveralls
116+
uses: coverallsapp/github-action@master
117+
with:
118+
github-token: ${{ secrets.GITHUB_TOKEN }}
119+
path-to-lcov: ./plugin/tests/coverage/js/lcov.info
120+
flag-name: "JS Unit Tests"
121+
parallel: true
122+
123+
test-php:
124+
needs: [lint]
125+
name: "PHP tests (PHP ${{ matrix.php_versions }}, WordPress ${{ matrix.wp_versions }})"
126+
runs-on: ${{ matrix.os }}
127+
strategy:
128+
fail-fast: false
129+
matrix:
130+
php_versions: [7.4, 7.3, 7.2, 7.1]
131+
wp_versions: ["latest"]
132+
os: [ubuntu-latest]
133+
include:
134+
- php_versions: 7.4
135+
wp_versions: "trunk"
136+
os: ubuntu-latest
137+
138+
- php_versions: "7.0"
139+
wp_versions: "latest"
140+
os: ubuntu-18.04 # Use ubuntu-18.4 which has MySQL 5.7 for back-compat < PHP7.0
141+
142+
- php_versions: 5.6.20
143+
wp_versions: "latest"
144+
os: ubuntu-18.04
145+
146+
- php_versions: 5.6.20
147+
wp_versions: "5.2"
148+
os: ubuntu-18.04
149+
150+
env:
151+
WP_VERSION: ${{ matrix.wp_versions }}
152+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153+
COVERALLS_PARALLEL: true
154+
COVERALLS: ${{ matrix.php_versions == 7.4 && matrix.wp_versions == 'latest' }}
155+
PROJECT_TYPE: plugin
156+
157+
steps:
158+
- uses: actions/checkout@v2
159+
- name: Setup PHP ${{ matrix.php_versions }}
160+
uses: shivammathur/setup-php@v2
161+
with:
162+
php-version: ${{ matrix.php_versions }}
163+
tools: phpunit
164+
165+
- name: Start MySQL
166+
run: |
167+
sudo systemctl enable mysql.service
168+
sudo systemctl start mysql.service
169+
170+
- name: Install dependencies
171+
run: composer install
172+
173+
- name: Copy block.json files
174+
run: for file in ./plugin/assets/src/block-editor/blocks/*/block.json; do dest="${file/.\/plugin\/assets\/src\/block-editor\//./plugin/assets/js/}"; mkdir -p `dirname $dest`; cp $file $dest; done
175+
176+
- name: Install and Run tests
177+
if: ${{ matrix.php_versions == '7.0' || matrix.php_versions == '5.6.20' }}
178+
run: |
179+
wget -O bin/phpunit https://phar.phpunit.de/phpunit-5.phar
180+
chmod +x bin/phpunit
181+
source bin/php-tests.sh wordpress_test root root localhost false bin/phpunit
182+
183+
- name: Install and Run tests
184+
if: ${{ matrix.php_versions != '7.0' && matrix.php_versions != '5.6.20' }}
185+
run: source bin/php-tests.sh wordpress_test root root localhost
186+
187+
finish:
188+
needs: [test-e2e, test-js, test-php]
189+
name: Finish
190+
runs-on: ubuntu-latest
191+
steps:
192+
- name: Coveralls Finished
193+
uses: coverallsapp/github-action@master
194+
with:
195+
github-token: ${{ secrets.github_token }}
196+
parallel-finished: true

0 commit comments

Comments
 (0)