-
Notifications
You must be signed in to change notification settings - Fork 6
112 lines (85 loc) · 3.8 KB
/
main.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
jobs:
merge-to-main-job:
runs-on: ubuntu-20.04
services:
mysql-service:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Checkout app code
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: shivammathur/setup-php@verbose
with:
php-version: 7.4
coverage: xdebug
env:
update: true
- name: Install Composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Prepare Laravel Application
run: |
cp .env.example .env
php artisan key:generate
- name: Create test database
run: |
mysql -uroot -h127.0.0.1 -proot -e 'CREATE DATABASE IF NOT EXISTS test;'
- name: Setup Database
run: |
php artisan migrate --no-interaction -vvv
php artisan db:seed
- name: Install NPM modules
run: npm i --legacy-peer-deps
### START Codecov integration ### (Codecov integration - STEP 1)
- name: Download Codecov binary
run: curl -Os https://uploader.codecov.io/latest/linux/codecov
### STEPS below are not required, but are great to have for extra security
- name: Verify integrity get GPG
run: curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import #
- name: Get SHAsums
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
## VEIFY integrity (Codecov integration - STEP 2)
- name: Test Signature
run: gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
- name: Test SHAsums
run: shasum -a 256 -c codecov.SHA256SUM
- name: Fix permission
run: chmod +x codecov
# RUN tests an upload reports ## comment (Codecov integration - STEP 3)
- name: Run Service Testsuite with Coverage
run: vendor/bin/phpunit --testsuite="Services Tests" --coverage-clover=coverage-service.xml
- name: Upload Service coverage report
run: ./codecov upload-process --disable-search -t ${{ secrets.CODECOV_TOKEN }} -n 'service'-${{ github.run_id }} -F service -f coverage-service.xml
- name: Run Controller Testsuite with Coverage
run: vendor/bin/phpunit --testsuite="Controllers Tests" --coverage-clover=coverage-controller.xml
- name: Upload Controller coverage report
run: ./codecov upload-process -t ${{ secrets.CODECOV_TOKEN }} -n 'controller'-${{ github.run_id }} -F controller -f coverage-service.xml
- name: Run Unit Testsuite with Coverage
run: vendor/bin/phpunit --testsuite="Unit Tests" --coverage-clover=coverage-unit.xml
- name: Upload unit coverage report
run: ./codecov upload-process -t ${{ secrets.CODECOV_TOKEN }} -n 'unit'-${{ github.run_id }} -F unit -f coverage-unit.xml
- name: Run Complete Testsuite with Coverage
run: vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Javascript tests using Jest
run: npm run test
- name: Upload Javascript coverage
run: ./codecov upload-process -t ${{ secrets.CODECOV_TOKEN }} -n 'javascript'-${{ github.run_id }} -F 'javascript' -f coverage/coverage-final.json
- name: Trigger notifications
run: ./codecov send-notifications -t ${{ secrets.CODECOV_TOKEN }}