Skip to content

Commit 0222b18

Browse files
authored
add: standardized testsuites (#11)
* add: standardized testsuites * stan autoload * unit * bs * composer config
1 parent a12cb78 commit 0222b18

File tree

2 files changed

+30
-114
lines changed

2 files changed

+30
-114
lines changed

.github/workflows/tests.yml

Lines changed: 23 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -24,118 +24,27 @@ on:
2424
- '**.md'
2525
branches:
2626
- master
27-
env:
28-
DB: MYSQL
29-
PDO: 1
30-
SS_ENVIRONMENT_TYPE: "dev"
27+
3128
jobs:
32-
phpunit:
33-
name: 🧩 PHPUnit
34-
runs-on: ubuntu-latest
35-
strategy:
36-
fail-fast: false
37-
matrix:
38-
php:
39-
- '7.4'
40-
- '8.0'
41-
recipe:
42-
- 4.3.*
43-
- 4.x-dev
44-
exclude:
45-
- php: '8.0'
46-
recipe: 4.3.*
47-
container: brettt89/silverstripe-web:${{ matrix.php }}-apache
48-
services:
49-
database:
50-
image: mysql:5.7
51-
ports:
52-
- 3306:3306
53-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
54-
env:
55-
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
56-
env:
57-
SS_DEFAULT_ADMIN_USERNAME: admin
58-
SS_DEFAULT_ADMIN_PASSWORD: admin
59-
SS_DATABASE_SERVER: database
60-
SS_DATABASE_NAME: ss_default_${{ matrix.php }}
61-
SS_DATABASE_USERNAME: root
62-
SS_DATABASE_PASSWORD: ''
63-
SS_ENVIRONMENT_TYPE: dev
64-
RECIPE_CMS_VERSION: ${{ matrix.recipe }}
65-
steps:
66-
- name: Install Composer
67-
run: |
68-
curl \
69-
-sS https://getcomposer.org/installer \
70-
| php && \
71-
mv -f composer.phar /usr/local/bin/composer
72-
- name: Install git
73-
run: |
74-
apt update && apt-get install git -yqq
75-
- name: Checkout code
76-
uses: actions/checkout@v3
77-
- name: install dependencies
78-
run: |
79-
composer require --no-update silverstripe/recipe-cms:$RECIPE_CMS_VERSION &&\
80-
composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile
81-
- name: run phpunit
82-
run: vendor/bin/phpunit -d memory_limit=1G -c "tests/phpunit.xml" tests/
83-
# - name: generate coverage
84-
# run: phpdbg -qrr vendor/bin/phpunit -d memory_limit=4G --process-isolation --coverage-clover=coverage.xml -c "tests/phpunit.xml" tests/
85-
# if: ${{ matrix.php == '7.4' && matrix.recipe == '4.x-dev' }}
86-
# - name: submit coverage
87-
# uses: codecov/codecov-action@v2
88-
# with:
89-
# token: ${{ secrets.CODECOV_TOKEN }}
90-
# files: ./coverage.xml
91-
# if: ${{ matrix.php == '7.4' && matrix.recipe == '4.x-dev' }}
92-
phpstan:
93-
name: 🔍 PHPStan
94-
runs-on: ubuntu-latest
95-
strategy:
96-
fail-fast: false
97-
matrix:
98-
php:
99-
- '7.4'
100-
- '8.0'
101-
recipe:
102-
- 4.3.*
103-
- 4.x-dev
104-
exclude:
105-
- php: '8.0'
106-
recipe: 4.3.*
107-
container: brettt89/silverstripe-web:7.4-apache
108-
env:
109-
RECIPE_CMS_VERSION: ${{ matrix.recipe }}
110-
steps:
111-
- name: Install Composer
112-
run: |
113-
curl \
114-
-sS https://getcomposer.org/installer \
115-
| php && \
116-
mv -f composer.phar /usr/local/bin/composer
117-
- name: Install git
118-
run: |
119-
apt update && apt-get install git -yqq
120-
- name: Checkout code
121-
uses: actions/checkout@v3
122-
- name: install dependencies
123-
run: |
124-
composer require --no-update silverstripe/recipe-cms:$RECIPE_CMS_VERSION &&\
125-
composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile
126-
- name: run phpstan
127-
run: vendor/bin/phpstan analyse src/ tests/ -c "tests/phpstan.neon" -a "tests/bootstrap-phpstan.php" --level 4 --memory-limit 1G
128-
phpcs:
129-
name: 🔮 PHPcs
130-
runs-on: ubuntu-latest
131-
steps:
132-
- name: Checkout code
133-
uses: actions/checkout@v3
134-
- name: lint source
135-
uses: chindit/actions-phpcs@master
136-
with:
137-
dir: src/
138-
- name: lint tests
139-
uses: chindit/actions-phpcs@master
140-
with:
141-
dir: tests/
29+
silverstripe-module:
30+
name: 🧰 Silverstripe Module Testsuite
31+
uses: syntro-opensource/workflows/.github/workflows/silverstripe-module.yml@master
32+
with:
33+
phpunit: true
34+
phpunit_config_file: tests/phpunit.xml
35+
phpstan: true
36+
phpstan_config: tests/phpstan.neon
37+
phpstan_bootstrap: tests/bootstrap-phpstan.php
38+
phpcs: true
39+
# silverstripe-client:
40+
# name: 📦 Client Testsuite
41+
# uses: syntro-opensource/workflows/.github/workflows/client.yml@master
42+
# with:
43+
# eslint: true
44+
# eslint_dir: client/src/seo-field/
45+
# eslint_configfile: client/src/seo-field/.eslintrc
46+
# eslint_ext:
47+
# eslint_max-warnings:
48+
# stylelint: true
49+
# stylelint_glob: client/src/seo-field/**/*.scss
50+
# stylelint_max-warnings:

composer.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
"dev-master": "1.x-dev"
5050
}
5151
},
52+
"config": {
53+
"allow-plugins": {
54+
"composer/installers": true,
55+
"silverstripe/vendor-plugin": true,
56+
"silverstripe/recipe-plugin": true
57+
}
58+
},
5259
"prefer-stable": true,
5360
"minimum-stability": "dev"
5461
}

0 commit comments

Comments
 (0)