forked from xwp-hiring/wordpress-coding-challenge
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (79 loc) · 2.41 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: CI/CD Pipeline
on:
push:
branches:
- '**'
jobs:
lint:
name: Lint JS & PHP
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get npm cache directory
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"
- name: Configure npm cache
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Setup PHP with Xdebug 2.x
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
coverage: xdebug2
- name: Install Node dependencies
run: npm install
- name: Detect coding standard violations
run: npm run lint
test:
name: Unit test JS & PHP
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get npm cache directory
id: npm-cache
run: echo "::set-output name=dir::$(npm config get cache)"
- name: Configure npm cache
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Setup PHP with Xdebug 2.x
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
coverage: xdebug2
- name: Install Node dependencies
run: npm install
- name: Run unit tests (with coverage)
run: npm run test:coverage
- name: Run Coveralls for JS
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: './tests/coverage/js/lcov.info'
flag-name: run-js
parallel: true
- name: Run Coveralls for PHP
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: run-php
run: composer coverage
finish:
name: Finish parallel tests
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true