-
Notifications
You must be signed in to change notification settings - Fork 11
116 lines (104 loc) · 3.13 KB
/
ci-workflow.yml
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
name: CI workflow
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
static_code_analysis:
name: Static code analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.11
- run: pip install pre-commit
- run: pre-commit run --all-files --show-diff-on-failure
frontend:
name: Build frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: yarn install
- run: yarn build
env:
NODE_ENV: production
backend:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
include:
- php_version: "5.6"
composer: "composer-v5.json"
- php_version: "7.4"
composer: "composer-v5.json"
- php_version: "8.0"
composer: "composer.json"
- php_version: "8.1"
composer: "composer.json"
- php_version: "8.2"
composer: "composer.json"
- php_version: "8.3"
composer: "composer.json"
env:
APP_DEBUG: true
DB_HOST: 127.0.0.1
DB_DATABASE: sklep_sms_test
DB_USERNAME: root
DB_PASSWORD: secret
COMPOSER: ${{ matrix.composer }}
services:
mysql:
image: mysql:5.5
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_DATABASE: sklep_sms_test
MYSQL_ROOT_PASSWORD: secret
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v3
- run: sudo /etc/init.d/mysql start
- name: Setup PHP ${{ matrix.php_version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
extensions: mysqli
coverage: xdebug
- uses: ramsey/composer-install@v2
with:
composer-options: "--optimize-autoloader"
# We need to remove psy/psysh cause otherwise rector doesn't work for php 5.6
- run: composer remove --dev psy/psysh
- name: Transpile to PHP ${{ matrix.php_version }}
run: |
docker run \
--rm \
--env PHP_VERSION=${{ matrix.php_version }} \
-v $(pwd):/project \
budziam/rector:0.12.23 \
process \
/project/includes \
/project/tests \
--config /project/rector.php
- run: php artisan test:setup
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
# - uses: mxschmitt/action-tmate@v3
- name: Run tests
run: ./vendor/bin/phpunit --coverage-clover clover.xml --testdox
env:
XDEBUG_MODE: coverage
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
- name: Upload coverage results to Coveralls
run: |
if [[ ${{ matrix.php_version }} == 8.2 ]]; then
./vendor/bin/php-coveralls --coverage_clover clover.xml --json_path coveralls.json
fi
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}