-
Notifications
You must be signed in to change notification settings - Fork 35
134 lines (126 loc) · 4.17 KB
/
test-and-autofix.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Tests & Autofix
on:
push:
branches:
- 2.*
pull_request:
branches:
- 2.*
paths:
- .github/workflows/test-and-autofix.yml
- '**.js'
- '**.php'
- composer.lock
- composer.json
jobs:
test:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
max-parallel: 3
matrix:
os:
- ubuntu-latest
#- windows-latest # Todo: make it work also for windows
#- macOS-latest # Todo: make it work also for macos
php:
- 7.3
- 7.4
- 8.0
- 8.1
database:
- mysql:5.6
- mariadb:10.1
composer:
- 2
experimental: [false]
name: Test - php:${{ matrix.php }}; ${{ matrix.database }}; ${{ matrix.os }}; composer:${{ matrix.composer }}
services:
mysql:
image: ${{ matrix.database }}
env:
MYSQL_ROOT_PASSWORD: icms
MYSQL_DATABASE: icms
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup CodeClimate
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
continue-on-error: true
- name: Install PHP
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php }}
extensions: curl, gd, pdo_mysql, json, mbstring, pcre, session
ini-values: post_max_size=256M
coverage: none
tools: composer:v${{ matrix.composer }}
- name: Installing ImpressCMS...
id: install_icms
uses: impresscms-dev/[email protected]
with:
database_name: icms
database_user: root
database_password: icms
database_port: ${{ job.services.mysql.ports['3306'] }}
database_prefix: icms
continue-on-error: ${{ matrix.experimental }}
- name: Prepare CodeClimate
run: GIT_BRANCH=$GITHUB_REF GIT_COMMIT_SHA=$GITHUB_SHA ./cc-test-reporter before-build
if: ${{ success() }}
continue-on-error: true
- name: Testing with PHPUnit
env:
URL: http://localhost
DB_TYPE: pdo.mysql
DB_HOST: 127.0.0.1
DB_USER: root
DB_PASS: icms
DB_PCONNECT: 0
DB_NAME: icms
DB_CHARSET: utf8
DB_COLLATION: utf8_general_ci
DB_PREFIX: icms
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
APP_KEY: ${{ steps.install_icms.outputs.app_key }}
run: |
./bin/phpunit --testdox
# mv ./storage/log/clover.xml ./clover.xml
continue-on-error: ${{ matrix.experimental }}
- name: Deleting vendor/
run: rm -rf vendor/
continue-on-error: ${{ matrix.experimental }}
- name: Install Composer dependencies (without dev)
run: composer install --no-progress --no-dev --no-suggest --prefer-dist --optimize-autoloader
continue-on-error: ${{ matrix.experimental }}
# - name: Commiting CodeClimate data
# run: GIT_BRANCH=$GITHUB_REF GIT_COMMIT_SHA=$GITHUB_SHA ./cc-test-reporter after-build --exit-code $? -t clover -r ad1f334232dc545de86fbe07abfd55145ebc0be0530cc25f4ebab9bec35b67e7
# if: ${{ success() }}
# continue-on-error: true
autofix:
runs-on: ubuntu-latest
name: Autofix some files if needed
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
continue-on-error: true
- name: Updating composer.lock...
run: composer update --lock
shell: bash
continue-on-error: true
- name: Auto committing composer.lock changes...
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Automatically composer.lock updated
file_pattern: composer.lock
skip_fetch: true
skip_checkout: true
continue-on-error: true