-
Notifications
You must be signed in to change notification settings - Fork 1
162 lines (128 loc) · 4.32 KB
/
continuous-integration.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Continuous Integration
on:
push:
branches:
- develop
- accept
- master
pull_request:
jobs:
code-analysis:
name: Code Analysis
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v3
- name: Set Up PHP and Tools
uses: shivammathur/setup-php@master
with:
php-version: "8.1"
tools: composer:v2
coverage: none
- name: Setup Analysis Environment
run: yes | cp .env.testing.example .env
- name: Install Composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Static Code Analysis
run: ./vendor/bin/phpstan analyse --memory-limit=2G
code-style:
name: Code Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Up PHP and Tools
uses: shivammathur/setup-php@master
with:
php-version: "8.1"
tools: composer:v2, phpcs, php-cs-fixer, phpmd
coverage: none
- name: Install required NVM version
run: . ~/.nvm/nvm.sh && nvm install 20
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8
- name: Syntax Errors
run: find app database tests config routes -name "*.php" -print0 | xargs -0 -n1 -P8 php -l
- name: PHP_CodeSniffer
run: phpcs
- name: PHP-CS-Fixer
run: php-cs-fixer fix app database config routes tests --dry-run --diff --allow-risky=yes --config=.php-cs-fixer.php
- name: PHPMD
run: phpmd app text phpmd.xml
- name: Lint Assets
run: ./lintHook.sh $PWD
security-check:
name: Security Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Up PHP and Tools
uses: shivammathur/setup-php@master
with:
php-version: "8.1"
tools: composer:v2
coverage: none
- name: Check Composer Packages
uses: symfonycorp/security-checker-action@v4
tests:
name: Tests
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: tests_db
ports:
- 13306:3306
steps:
- uses: actions/checkout@v3
- name: Initialize the Database
run: |
sudo systemctl start mysql
mysql --user="root" --password="root" -e "CREATE DATABASE tests_db character set UTF8mb4 collate utf8mb4_bin;"
- name: Setup minio
run: |
docker run -d -p 9000:9000 --name minio \
-e "MINIO_ACCESS_KEY=application" \
-e "MINIO_SECRET_KEY=password" \
-v /tmp/data:/data \
-v /tmp/config:/root/.minio \
minio/minio server /data
export AWS_ACCESS_KEY_ID=application
export AWS_SECRET_ACCESS_KEY=password
export AWS_EC2_METADATA_DISABLED=true
aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://sreapp-public
- name: Set Up PHP and Tools
uses: shivammathur/setup-php@master
with:
php-version: "8.1"
extensions: bz2, bcmath, curl, exif, gd, imagick, imap, intl, mysqli, pcntl, pcov, pdo_mysql, soap, xmlrpc, xsl, zip, iconv, pdo
tools: composer:v2
coverage: pcov
- name: Install required NVM version
run: . ~/.nvm/nvm.sh && nvm install 20
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8
- name: Install Composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Setup PHPUnit Environment
run: yes | cp .env.testing.example .env
- name: Build Assets
run: ./buildHook.sh $PWD
- name: Run Test & Coverage Report
run: composer test-coverage-xml
env:
DB_HOST: localhost
DB_DATABASE: tests_db
DB_USERNAME: root
DB_PASSWORD: root
- name: Check Test Coverage
uses: johanvanhelden/gha-clover-test-coverage-check@v1
with:
percentage: "58"
filename: "coverage.xml"